diff --git a/.eslintignore b/.eslintignore index e58be97cbaf5..2854c10c59f3 100644 --- a/.eslintignore +++ b/.eslintignore @@ -14,7 +14,6 @@ packages/docusaurus-*/lib/* packages/docusaurus-*/lib-next/ packages/eslint-plugin/lib/ packages/stylelint-copyright/lib/ -copyUntypedFiles.mjs packages/create-docusaurus/lib/* packages/create-docusaurus/templates/facebook diff --git a/admin/scripts/copyUntypedFiles.mjs b/admin/scripts/copyUntypedFiles.mjs new file mode 100644 index 000000000000..59178146452a --- /dev/null +++ b/admin/scripts/copyUntypedFiles.mjs @@ -0,0 +1,36 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import fs from 'fs-extra'; +import path from 'path'; +import chokidar from 'chokidar'; + +const srcDir = path.join(process.cwd(), 'src'); +const libDir = path.join(process.cwd(), 'lib'); + +const ignoredPattern = /(?:__tests__|\.tsx?$)/; + +async function copy() { + await fs.copy(srcDir, libDir, { + filter(testedPath) { + return !ignoredPattern.test(testedPath); + }, + }); +} + +if (process.argv.includes('--watch')) { + const watcher = chokidar.watch(srcDir, { + ignored: ignoredPattern, + ignoreInitial: true, + persistent: true, + }); + ['add', 'change', 'unlink', 'addDir', 'unlinkDir'].forEach((event) => + watcher.on(event, copy), + ); +} else { + await copy(); +} diff --git a/packages/create-docusaurus/.npmignore b/packages/create-docusaurus/.npmignore index 0bc0b32a6248..1f851e4a70c0 100644 --- a/packages/create-docusaurus/.npmignore +++ b/packages/create-docusaurus/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* __tests__ node_modules diff --git a/packages/create-docusaurus/package.json b/packages/create-docusaurus/package.json index 583b6f06617f..d7a60dba1c13 100755 --- a/packages/create-docusaurus/package.json +++ b/packages/create-docusaurus/package.json @@ -14,7 +14,7 @@ "scripts": { "create-docusaurus": "create-docusaurus", "build": "tsc --build", - "watch": "tsc --watch" + "watch": "tsc --build --watch" }, "bin": "bin/index.js", "publishConfig": { diff --git a/packages/docusaurus-cssnano-preset/.npmignore b/packages/docusaurus-cssnano-preset/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-cssnano-preset/.npmignore +++ b/packages/docusaurus-cssnano-preset/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-logger/.npmignore b/packages/docusaurus-logger/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-logger/.npmignore +++ b/packages/docusaurus-logger/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-mdx-loader/.npmignore b/packages/docusaurus-mdx-loader/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-mdx-loader/.npmignore +++ b/packages/docusaurus-mdx-loader/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-migrate/.npmignore b/packages/docusaurus-migrate/.npmignore index b3d2bb61f7d9..e4132af42172 100644 --- a/packages/docusaurus-migrate/.npmignore +++ b/packages/docusaurus-migrate/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-migrate/package.json b/packages/docusaurus-migrate/package.json index ea7affc71cf1..9e980899705f 100644 --- a/packages/docusaurus-migrate/package.json +++ b/packages/docusaurus-migrate/package.json @@ -8,7 +8,7 @@ }, "scripts": { "build": "tsc --build", - "watch": "tsc --watch" + "watch": "tsc --build --watch" }, "repository": { "type": "git", diff --git a/packages/docusaurus-plugin-client-redirects/.npmignore b/packages/docusaurus-plugin-client-redirects/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-plugin-client-redirects/.npmignore +++ b/packages/docusaurus-plugin-client-redirects/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-content-blog/.npmignore b/packages/docusaurus-plugin-content-blog/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-plugin-content-blog/.npmignore +++ b/packages/docusaurus-plugin-content-blog/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-content-docs/.npmignore b/packages/docusaurus-plugin-content-docs/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-plugin-content-docs/.npmignore +++ b/packages/docusaurus-plugin-content-docs/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-content-docs/package.json b/packages/docusaurus-plugin-content-docs/package.json index c02fc60957b0..bf59cd020096 100644 --- a/packages/docusaurus-plugin-content-docs/package.json +++ b/packages/docusaurus-plugin-content-docs/package.json @@ -13,7 +13,7 @@ "types": "src/plugin-content-docs.d.ts", "scripts": { "build": "tsc --build", - "watch": "tsc --watch" + "watch": "tsc --build --watch" }, "publishConfig": { "access": "public" diff --git a/packages/docusaurus-plugin-content-pages/.npmignore b/packages/docusaurus-plugin-content-pages/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-plugin-content-pages/.npmignore +++ b/packages/docusaurus-plugin-content-pages/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-debug/.npmignore b/packages/docusaurus-plugin-debug/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-plugin-debug/.npmignore +++ b/packages/docusaurus-plugin-debug/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-debug/copyUntypedFiles.mjs b/packages/docusaurus-plugin-debug/copyUntypedFiles.mjs deleted file mode 100644 index 8b230152f1af..000000000000 --- a/packages/docusaurus-plugin-debug/copyUntypedFiles.mjs +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import fs from 'fs-extra'; -import {fileURLToPath} from 'url'; - -/** - * Copy all untyped and static assets files to lib. - */ -const srcDir = fileURLToPath(new URL('src', import.meta.url)); -const libDir = fileURLToPath(new URL('lib', import.meta.url)); -await fs.copy(srcDir, libDir, { - filter(filepath) { - return !/__tests__/.test(filepath) && !/\.tsx?$/.test(filepath); - }, -}); diff --git a/packages/docusaurus-plugin-debug/package.json b/packages/docusaurus-plugin-debug/package.json index eb9ce3d41a4e..3c68544c139b 100644 --- a/packages/docusaurus-plugin-debug/package.json +++ b/packages/docusaurus-plugin-debug/package.json @@ -5,8 +5,10 @@ "main": "lib/index.js", "types": "src/plugin-debug.d.ts", "scripts": { - "build": "tsc --build && node copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"", - "watch": "node copyUntypedFiles.mjs && tsc --watch" + "build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"", + "watch": "run-p -c copy:watch build:watch", + "build:watch": "tsc --build --watch", + "copy:watch": "node ../../admin/scripts/copyUntypedFiles.mjs --watch" }, "publishConfig": { "access": "public" diff --git a/packages/docusaurus-plugin-google-analytics/.npmignore b/packages/docusaurus-plugin-google-analytics/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-plugin-google-analytics/.npmignore +++ b/packages/docusaurus-plugin-google-analytics/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-google-analytics/package.json b/packages/docusaurus-plugin-google-analytics/package.json index 99531da0ac1f..f62db432005c 100644 --- a/packages/docusaurus-plugin-google-analytics/package.json +++ b/packages/docusaurus-plugin-google-analytics/package.json @@ -9,7 +9,7 @@ }, "scripts": { "build": "tsc --build", - "watch": "tsc --watch" + "watch": "tsc --build --watch" }, "repository": { "type": "git", diff --git a/packages/docusaurus-plugin-google-gtag/.npmignore b/packages/docusaurus-plugin-google-gtag/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-plugin-google-gtag/.npmignore +++ b/packages/docusaurus-plugin-google-gtag/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-google-gtag/package.json b/packages/docusaurus-plugin-google-gtag/package.json index 169b2c962a7a..c353d7a1a28c 100644 --- a/packages/docusaurus-plugin-google-gtag/package.json +++ b/packages/docusaurus-plugin-google-gtag/package.json @@ -6,7 +6,7 @@ "types": "lib/index.d.ts", "scripts": { "build": "tsc --build", - "watch": "tsc --watch" + "watch": "tsc --build --watch" }, "publishConfig": { "access": "public" diff --git a/packages/docusaurus-plugin-ideal-image/.npmignore b/packages/docusaurus-plugin-ideal-image/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-plugin-ideal-image/.npmignore +++ b/packages/docusaurus-plugin-ideal-image/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-ideal-image/copyUntypedFiles.mjs b/packages/docusaurus-plugin-ideal-image/copyUntypedFiles.mjs deleted file mode 100644 index 8b230152f1af..000000000000 --- a/packages/docusaurus-plugin-ideal-image/copyUntypedFiles.mjs +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import fs from 'fs-extra'; -import {fileURLToPath} from 'url'; - -/** - * Copy all untyped and static assets files to lib. - */ -const srcDir = fileURLToPath(new URL('src', import.meta.url)); -const libDir = fileURLToPath(new URL('lib', import.meta.url)); -await fs.copy(srcDir, libDir, { - filter(filepath) { - return !/__tests__/.test(filepath) && !/\.tsx?$/.test(filepath); - }, -}); diff --git a/packages/docusaurus-plugin-ideal-image/package.json b/packages/docusaurus-plugin-ideal-image/package.json index 6449d75574fe..4feb2ff1b92c 100644 --- a/packages/docusaurus-plugin-ideal-image/package.json +++ b/packages/docusaurus-plugin-ideal-image/package.json @@ -5,7 +5,10 @@ "main": "lib/index.js", "types": "src/plugin-ideal-image.d.ts", "scripts": { - "build": "tsc --build && node copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"" + "build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"", + "watch": "run-p -c copy:watch build:watch", + "build:watch": "tsc --build --watch", + "copy:watch": "node ../../admin/scripts/copyUntypedFiles.mjs --watch" }, "publishConfig": { "access": "public" diff --git a/packages/docusaurus-plugin-pwa/.npmignore b/packages/docusaurus-plugin-pwa/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-plugin-pwa/.npmignore +++ b/packages/docusaurus-plugin-pwa/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-plugin-pwa/copyUntypedFiles.mjs b/packages/docusaurus-plugin-pwa/copyUntypedFiles.mjs deleted file mode 100644 index 8b230152f1af..000000000000 --- a/packages/docusaurus-plugin-pwa/copyUntypedFiles.mjs +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import fs from 'fs-extra'; -import {fileURLToPath} from 'url'; - -/** - * Copy all untyped and static assets files to lib. - */ -const srcDir = fileURLToPath(new URL('src', import.meta.url)); -const libDir = fileURLToPath(new URL('lib', import.meta.url)); -await fs.copy(srcDir, libDir, { - filter(filepath) { - return !/__tests__/.test(filepath) && !/\.tsx?$/.test(filepath); - }, -}); diff --git a/packages/docusaurus-plugin-pwa/package.json b/packages/docusaurus-plugin-pwa/package.json index 3bc6d0cd22ee..92465928d16c 100644 --- a/packages/docusaurus-plugin-pwa/package.json +++ b/packages/docusaurus-plugin-pwa/package.json @@ -5,7 +5,10 @@ "main": "lib/index.js", "types": "src/plugin-pwa.d.ts", "scripts": { - "build": "tsc --build && node copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"" + "build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"", + "watch": "run-p -c copy:watch build:watch", + "build:watch": "tsc --build --watch", + "copy:watch": "node ../../admin/scripts/copyUntypedFiles.mjs --watch" }, "publishConfig": { "access": "public" diff --git a/packages/docusaurus-plugin-sitemap/.npmignore b/packages/docusaurus-plugin-sitemap/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-plugin-sitemap/.npmignore +++ b/packages/docusaurus-plugin-sitemap/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-preset-classic/.npmignore b/packages/docusaurus-preset-classic/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-preset-classic/.npmignore +++ b/packages/docusaurus-preset-classic/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-remark-plugin-npm2yarn/.npmignore b/packages/docusaurus-remark-plugin-npm2yarn/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-remark-plugin-npm2yarn/.npmignore +++ b/packages/docusaurus-remark-plugin-npm2yarn/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-theme-classic/.npmignore b/packages/docusaurus-theme-classic/.npmignore index 3f56a7b661b6..955841b312a2 100644 --- a/packages/docusaurus-theme-classic/.npmignore +++ b/packages/docusaurus-theme-classic/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-theme-common/.npmignore b/packages/docusaurus-theme-common/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-theme-common/.npmignore +++ b/packages/docusaurus-theme-common/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-theme-common/copyUntypedFiles.mjs b/packages/docusaurus-theme-common/copyUntypedFiles.mjs deleted file mode 100644 index 8b230152f1af..000000000000 --- a/packages/docusaurus-theme-common/copyUntypedFiles.mjs +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import fs from 'fs-extra'; -import {fileURLToPath} from 'url'; - -/** - * Copy all untyped and static assets files to lib. - */ -const srcDir = fileURLToPath(new URL('src', import.meta.url)); -const libDir = fileURLToPath(new URL('lib', import.meta.url)); -await fs.copy(srcDir, libDir, { - filter(filepath) { - return !/__tests__/.test(filepath) && !/\.tsx?$/.test(filepath); - }, -}); diff --git a/packages/docusaurus-theme-common/package.json b/packages/docusaurus-theme-common/package.json index 4cd433a79e1b..59a1d91f87c2 100644 --- a/packages/docusaurus-theme-common/package.json +++ b/packages/docusaurus-theme-common/package.json @@ -13,8 +13,10 @@ "./Details": "./lib/components/Details/index.js" }, "scripts": { - "build": "node copyUntypedFiles.mjs && tsc", - "watch": "node copyUntypedFiles.mjs && tsc --watch" + "build": "tsc && node ../../admin/scripts/copyUntypedFiles.mjs", + "watch": "run-p -c copy:watch build:watch", + "build:watch": "tsc --watch", + "copy:watch": "node ../../admin/scripts/copyUntypedFiles.mjs --watch" }, "publishConfig": { "access": "public" diff --git a/packages/docusaurus-theme-live-codeblock/.npmignore b/packages/docusaurus-theme-live-codeblock/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-theme-live-codeblock/.npmignore +++ b/packages/docusaurus-theme-live-codeblock/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-theme-live-codeblock/copyUntypedFiles.mjs b/packages/docusaurus-theme-live-codeblock/copyUntypedFiles.mjs deleted file mode 100644 index 8b230152f1af..000000000000 --- a/packages/docusaurus-theme-live-codeblock/copyUntypedFiles.mjs +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import fs from 'fs-extra'; -import {fileURLToPath} from 'url'; - -/** - * Copy all untyped and static assets files to lib. - */ -const srcDir = fileURLToPath(new URL('src', import.meta.url)); -const libDir = fileURLToPath(new URL('lib', import.meta.url)); -await fs.copy(srcDir, libDir, { - filter(filepath) { - return !/__tests__/.test(filepath) && !/\.tsx?$/.test(filepath); - }, -}); diff --git a/packages/docusaurus-theme-live-codeblock/package.json b/packages/docusaurus-theme-live-codeblock/package.json index 661b8b3cc45e..04d45ca3d01f 100644 --- a/packages/docusaurus-theme-live-codeblock/package.json +++ b/packages/docusaurus-theme-live-codeblock/package.json @@ -11,7 +11,10 @@ "access": "public" }, "scripts": { - "build": "tsc --build && node copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"" + "build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"", + "watch": "run-p -c copy:watch build:watch", + "build:watch": "tsc --build --watch", + "copy:watch": "node ../../admin/scripts/copyUntypedFiles.mjs --watch" }, "repository": { "type": "git", diff --git a/packages/docusaurus-theme-search-algolia/.npmignore b/packages/docusaurus-theme-search-algolia/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-theme-search-algolia/.npmignore +++ b/packages/docusaurus-theme-search-algolia/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-theme-search-algolia/copyUntypedFiles.mjs b/packages/docusaurus-theme-search-algolia/copyUntypedFiles.mjs deleted file mode 100644 index 8b230152f1af..000000000000 --- a/packages/docusaurus-theme-search-algolia/copyUntypedFiles.mjs +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import fs from 'fs-extra'; -import {fileURLToPath} from 'url'; - -/** - * Copy all untyped and static assets files to lib. - */ -const srcDir = fileURLToPath(new URL('src', import.meta.url)); -const libDir = fileURLToPath(new URL('lib', import.meta.url)); -await fs.copy(srcDir, libDir, { - filter(filepath) { - return !/__tests__/.test(filepath) && !/\.tsx?$/.test(filepath); - }, -}); diff --git a/packages/docusaurus-theme-search-algolia/package.json b/packages/docusaurus-theme-search-algolia/package.json index 2a809087b4cc..9c062e117952 100644 --- a/packages/docusaurus-theme-search-algolia/package.json +++ b/packages/docusaurus-theme-search-algolia/package.json @@ -21,7 +21,10 @@ }, "license": "MIT", "scripts": { - "build": "tsc --build && node copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"" + "build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"", + "watch": "run-p -c copy:watch build:watch", + "build:watch": "tsc --build --watch", + "copy:watch": "node ../../admin/scripts/copyUntypedFiles.mjs --watch" }, "dependencies": { "@docsearch/react": "^3.0.0", diff --git a/packages/docusaurus-theme-translations/.npmignore b/packages/docusaurus-theme-translations/.npmignore index acffb6122e75..7059569fc57d 100644 --- a/packages/docusaurus-theme-translations/.npmignore +++ b/packages/docusaurus-theme-translations/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-theme-translations/package.json b/packages/docusaurus-theme-translations/package.json index ea54a523851f..a296a446f3eb 100644 --- a/packages/docusaurus-theme-translations/package.json +++ b/packages/docusaurus-theme-translations/package.json @@ -15,7 +15,7 @@ "license": "MIT", "scripts": { "build": "tsc --build", - "watch": "tsc --watch", + "watch": "tsc --build --watch", "update": "node ./update.mjs" }, "dependencies": { diff --git a/packages/docusaurus-utils-common/.npmignore b/packages/docusaurus-utils-common/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-utils-common/.npmignore +++ b/packages/docusaurus-utils-common/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-utils-validation/.npmignore b/packages/docusaurus-utils-validation/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-utils-validation/.npmignore +++ b/packages/docusaurus-utils-validation/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus-utils/.npmignore b/packages/docusaurus-utils/.npmignore index 16beccca2e07..03c9ae1e1b54 100644 --- a/packages/docusaurus-utils/.npmignore +++ b/packages/docusaurus-utils/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus/.npmignore b/packages/docusaurus/.npmignore index b3d2bb61f7d9..e4132af42172 100644 --- a/packages/docusaurus/.npmignore +++ b/packages/docusaurus/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/docusaurus/copyUntypedFiles.mjs b/packages/docusaurus/copyUntypedFiles.mjs deleted file mode 100644 index 8b230152f1af..000000000000 --- a/packages/docusaurus/copyUntypedFiles.mjs +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import fs from 'fs-extra'; -import {fileURLToPath} from 'url'; - -/** - * Copy all untyped and static assets files to lib. - */ -const srcDir = fileURLToPath(new URL('src', import.meta.url)); -const libDir = fileURLToPath(new URL('lib', import.meta.url)); -await fs.copy(srcDir, libDir, { - filter(filepath) { - return !/__tests__/.test(filepath) && !/\.tsx?$/.test(filepath); - }, -}); diff --git a/packages/docusaurus/package.json b/packages/docusaurus/package.json index 1fb6245f9fb1..ac1af6b0a864 100644 --- a/packages/docusaurus/package.json +++ b/packages/docusaurus/package.json @@ -24,8 +24,10 @@ "docusaurus": "bin/docusaurus.mjs" }, "scripts": { - "build": "tsc --build && node copyUntypedFiles.mjs", - "watch": "node copyUntypedFiles.mjs && tsc --watch" + "build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.mjs", + "watch": "run-p -c copy:watch build:watch", + "build:watch": "tsc --build --watch", + "copy:watch": "node ../../admin/scripts/copyUntypedFiles.mjs --watch" }, "bugs": { "url": "https://github.com/facebook/docusaurus/issues" diff --git a/packages/eslint-plugin/.npmignore b/packages/eslint-plugin/.npmignore index 3e3043484f2e..733c0b46e93a 100644 --- a/packages/eslint-plugin/.npmignore +++ b/packages/eslint-plugin/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/packages/lqip-loader/.npmignore b/packages/lqip-loader/.npmignore index b3d2bb61f7d9..e4132af42172 100644 --- a/packages/lqip-loader/.npmignore +++ b/packages/lqip-loader/.npmignore @@ -1,4 +1,3 @@ -copyUntypedFiles.mjs .tsbuildinfo* tsconfig* __tests__ diff --git a/website/package.json b/website/package.json index 734cd2e4faf4..416bc81e47b1 100644 --- a/website/package.json +++ b/website/package.json @@ -30,8 +30,7 @@ "netlify:crowdin:downloadTranslationsFailSafe": "yarn netlify:crowdin:wait && (yarn --cwd .. crowdin:download:website || echo 'Crowdin translation download failure (only internal PRs have access to the Crowdin env token)')", "netlify:crowdin:uploadSources": "yarn --cwd .. crowdin:upload:website", "netlify:test": "yarn netlify:build:deployPreview && npx --package netlify-cli netlify dev -- --debug", - "typecheck": "tsc", - "watch": "tsc --watch" + "typecheck": "tsc" }, "dependencies": { "@crowdin/cli": "^3.7.8",