mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 00:27:21 +02:00
misc: make copyUntypedFiles work for watch mode (#7445)
This commit is contained in:
parent
5c3d3cfef1
commit
6b53d4263d
51 changed files with 71 additions and 187 deletions
|
@ -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
|
||||
|
|
36
admin/scripts/copyUntypedFiles.mjs
Normal file
36
admin/scripts/copyUntypedFiles.mjs
Normal file
|
@ -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();
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
__tests__
|
||||
node_modules
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"scripts": {
|
||||
"create-docusaurus": "create-docusaurus",
|
||||
"build": "tsc --build",
|
||||
"watch": "tsc --watch"
|
||||
"watch": "tsc --build --watch"
|
||||
},
|
||||
"bin": "bin/index.js",
|
||||
"publishConfig": {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"build": "tsc --build",
|
||||
"watch": "tsc --watch"
|
||||
"watch": "tsc --build --watch"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
});
|
|
@ -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"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"build": "tsc --build",
|
||||
"watch": "tsc --watch"
|
||||
"watch": "tsc --build --watch"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"types": "lib/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc --build",
|
||||
"watch": "tsc --watch"
|
||||
"watch": "tsc --build --watch"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
});
|
|
@ -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"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
});
|
|
@ -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"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
});
|
|
@ -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"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
});
|
|
@ -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",
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
});
|
|
@ -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",
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "tsc --build",
|
||||
"watch": "tsc --watch",
|
||||
"watch": "tsc --build --watch",
|
||||
"update": "node ./update.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
});
|
|
@ -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"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
copyUntypedFiles.mjs
|
||||
.tsbuildinfo*
|
||||
tsconfig*
|
||||
__tests__
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue