misc: make copyUntypedFiles work for watch mode (#7445)

This commit is contained in:
Joshua Chen 2022-05-18 19:18:32 +08:00 committed by GitHub
parent 5c3d3cfef1
commit 6b53d4263d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 71 additions and 187 deletions

View file

@ -1,4 +1,3 @@
copyUntypedFiles.mjs
.tsbuildinfo*
tsconfig*
__tests__

View file

@ -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);
},
});

View file

@ -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"