From 838c10fc01e46c82c25daeb677fd06e858282ef9 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Wed, 29 Jan 2025 16:27:50 -0800 Subject: [PATCH] simplify more --- .vscode/launch.json | 15 --- apps/E2E/tsconfig.json | 2 +- apps/fluent-tester/tsconfig.json | 2 +- apps/win32/tsconfig.json | 4 +- package.json | 1 - packages/components/Link/tsconfig.json | 5 +- packages/components/Menu/tsconfig.json | 5 +- packages/components/RadioGroup/tsconfig.json | 5 +- packages/components/TabList/tsconfig.json | 5 +- .../foundation-tokens/tsconfig.json | 7 +- packages/experimental/Checkbox/tsconfig.json | 1 - packages/experimental/Dropdown/tsconfig.json | 1 - packages/experimental/Overflow/tsconfig.json | 5 +- packages/experimental/Popover/tsconfig.json | 5 +- packages/experimental/Stack/tsconfig.json | 5 +- packages/experimental/Tooltip/tsconfig.json | 5 +- .../experimental/VibrancyView/tsconfig.json | 7 +- packages/framework/framework/tsconfig.json | 5 +- .../framework/immutable-merge/tsconfig.json | 5 +- packages/framework/memo-cache/tsconfig.json | 5 +- packages/framework/merge-props/tsconfig.json | 5 +- packages/framework/use-slot/tsconfig.json | 5 +- packages/framework/use-styling/tsconfig.json | 5 +- packages/framework/use-tokens/tsconfig.json | 5 +- packages/libraries/core/tsconfig.json | 2 +- packages/theming/android-theme/tsconfig.json | 7 +- packages/theming/apple-theme/tsconfig.json | 7 +- packages/theming/theme-tokens/tsconfig.json | 7 +- packages/theming/win32-theme/tsconfig.json | 8 +- .../utils/interactive-hooks/tsconfig.json | 5 +- packages/utils/tokens/tsconfig.json | 7 +- scripts/src/clean-all.js | 109 ------------------ scripts/src/debug-metro-pack.js | 4 - scripts/tsconfig.json | 5 +- tsconfig.json | 5 +- 35 files changed, 32 insertions(+), 249 deletions(-) delete mode 100644 scripts/src/clean-all.js delete mode 100644 scripts/src/debug-metro-pack.js diff --git a/.vscode/launch.json b/.vscode/launch.json index 023b581669..cb80c70857 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -46,21 +46,6 @@ "sourceMaps": true, "outFiles": [] }, - { - "name": "Debug metro bundling task", - "type": "node", - "request": "launch", - "program": "${workspaceRoot}/scripts/debug-metro-pack.js", - "cwd": "${workspaceFolder}/packages/libraries/core", - "args": ["rnTester"], - "runtimeArgs": ["--nolazy"], - "env": { - "NODE_ENV": "development" - }, - "console": "integratedTerminal", - "sourceMaps": true, - "outFiles": [] - }, { "name": "Debug Fabric Tester", "type": "node", diff --git a/apps/E2E/tsconfig.json b/apps/E2E/tsconfig.json index 758cef9cb6..ac62dcc8b7 100644 --- a/apps/E2E/tsconfig.json +++ b/apps/E2E/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@fluentui-react-native/scripts/tsconfig.json", "compilerOptions": { "baseUrl": ".", - "importHelpers": true, + "outDir": "lib", "paths": { "*": ["*", "*.win32", "./*"], diff --git a/apps/fluent-tester/tsconfig.json b/apps/fluent-tester/tsconfig.json index 758cef9cb6..ac62dcc8b7 100644 --- a/apps/fluent-tester/tsconfig.json +++ b/apps/fluent-tester/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@fluentui-react-native/scripts/tsconfig.json", "compilerOptions": { "baseUrl": ".", - "importHelpers": true, + "outDir": "lib", "paths": { "*": ["*", "*.win32", "./*"], diff --git a/apps/win32/tsconfig.json b/apps/win32/tsconfig.json index c4159edda5..f6cc56acb6 100644 --- a/apps/win32/tsconfig.json +++ b/apps/win32/tsconfig.json @@ -2,11 +2,11 @@ "extends": "@fluentui-react-native/scripts/tsconfig.json", "compilerOptions": { "baseUrl": ".", - "importHelpers": true, + "paths": { "*": ["*", "*.win32"], "src/*": ["./src/*"] - }, + } }, "include": ["src"] } diff --git a/package.json b/package.json index b0bbb5db02..8398d66ad7 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "build-tools": "lage build-tools", "buildci": "lage buildci", "bump-versions": "beachball bump", - "clean-all": "node ./scripts/clean-all.js", "docs": "yarn workspace fluent-rn-website start", "bundle": "lage bundle", "clean": "lage clean", diff --git a/packages/components/Link/tsconfig.json b/packages/components/Link/tsconfig.json index feff7a3229..b59f552e9b 100644 --- a/packages/components/Link/tsconfig.json +++ b/packages/components/Link/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib" - }, + "include": ["src"] } diff --git a/packages/components/Menu/tsconfig.json b/packages/components/Menu/tsconfig.json index feff7a3229..b59f552e9b 100644 --- a/packages/components/Menu/tsconfig.json +++ b/packages/components/Menu/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib" - }, + "include": ["src"] } diff --git a/packages/components/RadioGroup/tsconfig.json b/packages/components/RadioGroup/tsconfig.json index feff7a3229..b59f552e9b 100644 --- a/packages/components/RadioGroup/tsconfig.json +++ b/packages/components/RadioGroup/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib" - }, + "include": ["src"] } diff --git a/packages/components/TabList/tsconfig.json b/packages/components/TabList/tsconfig.json index feff7a3229..b59f552e9b 100644 --- a/packages/components/TabList/tsconfig.json +++ b/packages/components/TabList/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib" - }, + "include": ["src"] } diff --git a/packages/deprecated/foundation-tokens/tsconfig.json b/packages/deprecated/foundation-tokens/tsconfig.json index de2e5b3c76..559954a6e9 100644 --- a/packages/deprecated/foundation-tokens/tsconfig.json +++ b/packages/deprecated/foundation-tokens/tsconfig.json @@ -1,8 +1,3 @@ { - "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "outDir": "lib", - "types": ["node", "jest", "react"] - }, - "include": ["src"] + "extends": "@fluentui-react-native/scripts/tsconfig.json" } diff --git a/packages/experimental/Checkbox/tsconfig.json b/packages/experimental/Checkbox/tsconfig.json index 22647b458d..d61066838b 100644 --- a/packages/experimental/Checkbox/tsconfig.json +++ b/packages/experimental/Checkbox/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "@fluentui-react-native/scripts/tsconfig.json", "compilerOptions": { - "importHelpers": true, "outDir": "lib", "types": ["node"] }, diff --git a/packages/experimental/Dropdown/tsconfig.json b/packages/experimental/Dropdown/tsconfig.json index 22647b458d..d61066838b 100644 --- a/packages/experimental/Dropdown/tsconfig.json +++ b/packages/experimental/Dropdown/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "@fluentui-react-native/scripts/tsconfig.json", "compilerOptions": { - "importHelpers": true, "outDir": "lib", "types": ["node"] }, diff --git a/packages/experimental/Overflow/tsconfig.json b/packages/experimental/Overflow/tsconfig.json index feff7a3229..b59f552e9b 100644 --- a/packages/experimental/Overflow/tsconfig.json +++ b/packages/experimental/Overflow/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib" - }, + "include": ["src"] } diff --git a/packages/experimental/Popover/tsconfig.json b/packages/experimental/Popover/tsconfig.json index feff7a3229..b59f552e9b 100644 --- a/packages/experimental/Popover/tsconfig.json +++ b/packages/experimental/Popover/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib" - }, + "include": ["src"] } diff --git a/packages/experimental/Stack/tsconfig.json b/packages/experimental/Stack/tsconfig.json index feff7a3229..b59f552e9b 100644 --- a/packages/experimental/Stack/tsconfig.json +++ b/packages/experimental/Stack/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib" - }, + "include": ["src"] } diff --git a/packages/experimental/Tooltip/tsconfig.json b/packages/experimental/Tooltip/tsconfig.json index feff7a3229..b59f552e9b 100644 --- a/packages/experimental/Tooltip/tsconfig.json +++ b/packages/experimental/Tooltip/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib" - }, + "include": ["src"] } diff --git a/packages/experimental/VibrancyView/tsconfig.json b/packages/experimental/VibrancyView/tsconfig.json index feff7a3229..559954a6e9 100644 --- a/packages/experimental/VibrancyView/tsconfig.json +++ b/packages/experimental/VibrancyView/tsconfig.json @@ -1,8 +1,3 @@ { - "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib" - }, - "include": ["src"] + "extends": "@fluentui-react-native/scripts/tsconfig.json" } diff --git a/packages/framework/framework/tsconfig.json b/packages/framework/framework/tsconfig.json index 127f1c197a..6e5c38b691 100644 --- a/packages/framework/framework/tsconfig.json +++ b/packages/framework/framework/tsconfig.json @@ -7,7 +7,6 @@ "target": "es5", "sourceMap": true, "experimentalDecorators": true, - "importHelpers": true, "strictNullChecks": true, "noImplicitAny": true, "noEmitOnError": true, @@ -15,8 +14,6 @@ "moduleResolution": "node", "noUnusedLocals": true, "strict": true, - "suppressImplicitAnyIndexErrors": true, "lib": ["es6"] - }, - "include": ["src"] + } } diff --git a/packages/framework/immutable-merge/tsconfig.json b/packages/framework/immutable-merge/tsconfig.json index feff7a3229..b59f552e9b 100644 --- a/packages/framework/immutable-merge/tsconfig.json +++ b/packages/framework/immutable-merge/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib" - }, + "include": ["src"] } diff --git a/packages/framework/memo-cache/tsconfig.json b/packages/framework/memo-cache/tsconfig.json index feff7a3229..b59f552e9b 100644 --- a/packages/framework/memo-cache/tsconfig.json +++ b/packages/framework/memo-cache/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib" - }, + "include": ["src"] } diff --git a/packages/framework/merge-props/tsconfig.json b/packages/framework/merge-props/tsconfig.json index feff7a3229..b59f552e9b 100644 --- a/packages/framework/merge-props/tsconfig.json +++ b/packages/framework/merge-props/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib" - }, + "include": ["src"] } diff --git a/packages/framework/use-slot/tsconfig.json b/packages/framework/use-slot/tsconfig.json index feff7a3229..b59f552e9b 100644 --- a/packages/framework/use-slot/tsconfig.json +++ b/packages/framework/use-slot/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib" - }, + "include": ["src"] } diff --git a/packages/framework/use-styling/tsconfig.json b/packages/framework/use-styling/tsconfig.json index feff7a3229..b59f552e9b 100644 --- a/packages/framework/use-styling/tsconfig.json +++ b/packages/framework/use-styling/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib" - }, + "include": ["src"] } diff --git a/packages/framework/use-tokens/tsconfig.json b/packages/framework/use-tokens/tsconfig.json index feff7a3229..b59f552e9b 100644 --- a/packages/framework/use-tokens/tsconfig.json +++ b/packages/framework/use-tokens/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib" - }, + "include": ["src"] } diff --git a/packages/libraries/core/tsconfig.json b/packages/libraries/core/tsconfig.json index c02956dd07..9c8a17457f 100644 --- a/packages/libraries/core/tsconfig.json +++ b/packages/libraries/core/tsconfig.json @@ -7,7 +7,7 @@ "declaration": true, "sourceMap": true, "experimentalDecorators": true, - "importHelpers": true, + "strictNullChecks": true, "noImplicitAny": true, "noEmitOnError": true, diff --git a/packages/theming/android-theme/tsconfig.json b/packages/theming/android-theme/tsconfig.json index 7e582b8e03..559954a6e9 100644 --- a/packages/theming/android-theme/tsconfig.json +++ b/packages/theming/android-theme/tsconfig.json @@ -1,8 +1,3 @@ { - "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "outDir": "lib", - "resolveJsonModule": true - }, - "include": ["src"] + "extends": "@fluentui-react-native/scripts/tsconfig.json" } diff --git a/packages/theming/apple-theme/tsconfig.json b/packages/theming/apple-theme/tsconfig.json index 7e582b8e03..559954a6e9 100644 --- a/packages/theming/apple-theme/tsconfig.json +++ b/packages/theming/apple-theme/tsconfig.json @@ -1,8 +1,3 @@ { - "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "outDir": "lib", - "resolveJsonModule": true - }, - "include": ["src"] + "extends": "@fluentui-react-native/scripts/tsconfig.json" } diff --git a/packages/theming/theme-tokens/tsconfig.json b/packages/theming/theme-tokens/tsconfig.json index 7e582b8e03..559954a6e9 100644 --- a/packages/theming/theme-tokens/tsconfig.json +++ b/packages/theming/theme-tokens/tsconfig.json @@ -1,8 +1,3 @@ { - "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "outDir": "lib", - "resolveJsonModule": true - }, - "include": ["src"] + "extends": "@fluentui-react-native/scripts/tsconfig.json" } diff --git a/packages/theming/win32-theme/tsconfig.json b/packages/theming/win32-theme/tsconfig.json index f17f80fe2e..559954a6e9 100644 --- a/packages/theming/win32-theme/tsconfig.json +++ b/packages/theming/win32-theme/tsconfig.json @@ -1,9 +1,3 @@ { - "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib", - "resolveJsonModule": true - }, - "include": ["src"] + "extends": "@fluentui-react-native/scripts/tsconfig.json" } diff --git a/packages/utils/interactive-hooks/tsconfig.json b/packages/utils/interactive-hooks/tsconfig.json index feff7a3229..b59f552e9b 100644 --- a/packages/utils/interactive-hooks/tsconfig.json +++ b/packages/utils/interactive-hooks/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib" - }, + "include": ["src"] } diff --git a/packages/utils/tokens/tsconfig.json b/packages/utils/tokens/tsconfig.json index feff7a3229..559954a6e9 100644 --- a/packages/utils/tokens/tsconfig.json +++ b/packages/utils/tokens/tsconfig.json @@ -1,8 +1,3 @@ { - "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "importHelpers": true, - "outDir": "lib" - }, - "include": ["src"] + "extends": "@fluentui-react-native/scripts/tsconfig.json" } diff --git a/scripts/src/clean-all.js b/scripts/src/clean-all.js deleted file mode 100644 index 276818b2c1..0000000000 --- a/scripts/src/clean-all.js +++ /dev/null @@ -1,109 +0,0 @@ -// @ts-check - -const child_process = require('child_process'); -const fs = require('fs'); -const path = require('path'); -const os = require('os'); -// This script MUST NOT have any deps aside from Node built-ins, because it deletes all node_modules! - -/** @returns {Promise} */ -function prompt(question) { - return new Promise(resolve => { - process.stdin.resume(); - process.stdout.write(question); - - process.stdin.once('data', data => { - resolve(data.toString().trim()); - process.stdin.pause(); - }); - }); -} - -function deleteIfSymlink(itemPath) { - itemPath = path.resolve(itemPath); - try { - // Compare realpath since fs.statSync(itemPath).isSymbolicLink() doesn't work on Windows - if (fs.realpathSync(itemPath) !== itemPath) { - console.log(' Deleting symlink: ' + itemPath); - fs.unlinkSync(itemPath); - } - } catch (ex) { - console.warn(`Error running stat or unlink on ${itemPath}: ${ex}`); - } -} - -function deleteNodeModulesSymlinks(nodeModulesPath) { - if (!fs.existsSync(nodeModulesPath)) { - return; - } - // Check node_modules for symlinks and manually remove those - const modules = fs.readdirSync(nodeModulesPath); - for (const mod of modules) { - const modulePath = path.join(nodeModulesPath, mod); - if (mod[0] === '@' && !/[/\\]/.test(mod)) { - // Add any scoped modules to the list of things to check - modules.push(...fs.readdirSync(modulePath).map(m => path.join(mod, m))); - } else { - deleteIfSymlink(modulePath); - } - } -} - -function deleteSymlinks(parentFolder) { - const parentPath = path.join(process.cwd(), parentFolder); - if (!fs.existsSync(parentPath)) { - return; - } - for (const child of fs.readdirSync(parentPath)) { - const nodeModulesPath = path.join(parentPath, child, 'node_modules'); - deleteNodeModulesSymlinks(nodeModulesPath); - } -} - -async function run() { - if (!fs.existsSync(path.join(process.cwd(), '.git'))) { - console.error('Please run this script from the root of the Git repo'); - process.exit(1); - } - - const gitStatus = child_process - .execSync('git status --porcelain') - .toString() - .trim(); - - if (!process.argv.includes('-y')) { - console.log('WARNING: This command will PERMANENTLY DELETE all untracked files (such as build output and node_modules).'); - if (gitStatus) { - console.log('It will also revert uncommitted changes to the following files:'); - const lines = gitStatus.split(/\r?\n/g).map(line => ' ' + line); - console.log(lines.slice(0, 20).join(os.EOL)); - if (lines.length > 20) { - console.log(` ...and ${lines.length - 20} more`); - } - } - const answer = await prompt('Are you sure you want to proceed? (yes/no) '); - if (answer.toLowerCase()[0] !== 'y') { - return; - } - } - - console.log("Deleting symlinks from packages' node_modules..."); - deleteSymlinks('apps'); - deleteSymlinks('packages'); - - console.log('Deleting symlinks from rush temp files...'); - deleteNodeModulesSymlinks('common/temp/node_modules'); - deleteIfSymlink('common/temp/pnpm-local'); - - console.log(); - - console.log('Running "git clean -fdx" to remove all untracked files/folders (this may take awhile)...'); - child_process.execSync('git clean -fdx'); - console.log('Done!'); -} - -run().catch(ex => { - console.error('Caught error:'); - console.error(ex); - process.exit(1); -}); diff --git a/scripts/src/debug-metro-pack.js b/scripts/src/debug-metro-pack.js deleted file mode 100644 index 82cf5a69ab..0000000000 --- a/scripts/src/debug-metro-pack.js +++ /dev/null @@ -1,4 +0,0 @@ -const { metroPackTask } = require('./tasks/metro-pack'); - -const bundleName = process.argv[2]; -metroPackTask(bundleName)().then(() => console.log('Successful..')); diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index bf800e1a02..e2bb6b3324 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "outDir": "./lib", + "outDir": "lib", "target": "es2015", "types": ["node", "jest"], "module": "CommonJS", @@ -21,7 +21,8 @@ "skipDefaultLibCheck": true, "sourceMap": true, "jsx": "react", - "resolveJsonModule": true + "resolveJsonModule": true, + "importHelpers": true }, "baseUrl": ".", "paths": { diff --git a/tsconfig.json b/tsconfig.json index d5f207d12f..559954a6e9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,3 @@ { - "extends": "@fluentui-react-native/scripts/tsconfig.json", - "compilerOptions": { - "outDir": "lib" - } + "extends": "@fluentui-react-native/scripts/tsconfig.json" }