From 5fb294e7d7c3cc4e638993659644923b200cefae Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Mon, 5 Sep 2022 04:43:40 -0400 Subject: [PATCH] Use native shell commands for clean/clean-all --- package.json | 4 ++-- packages/backend/package.json | 2 ++ packages/client/package.json | 4 +++- packages/foundkey-js/package.json | 4 +++- packages/sw/package.json | 4 +++- scripts/clean-all.js | 19 ------------------- scripts/clean.js | 10 ---------- 7 files changed, 13 insertions(+), 34 deletions(-) delete mode 100644 scripts/clean-all.js delete mode 100644 scripts/clean.js diff --git a/package.json b/package.json index 2bb5c8f8a..d2cd16453 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,8 @@ "mocha": "yarn workspace backend run mocha", "test": "yarn mocha", "format": "gulp format", - "clean": "node ./scripts/clean.js", - "clean-all": "node ./scripts/clean-all.js", + "clean": "yarn workspaces foreach run clean && rm -rf built/", + "clean-all": "yarn workspaces foreach run clean-all && rm -rf built/ node_modules/", "cleanall": "yarn clean-all" }, "dependencies": { diff --git a/packages/backend/package.json b/packages/backend/package.json index 0109b4d3b..77932e931 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -6,6 +6,8 @@ "type": "module", "scripts": { "build": "tsc -p tsconfig.json || echo done. && tsc-alias -p tsconfig.json", + "clean": "rm -rf built/ tsconfig.tsbuildinfo", + "clean-all": "yarn clean && rm -rf node_modules/", "watch": "node watch.mjs", "lint": "eslint src --ext .ts", "mocha": "cross-env NODE_ENV=test TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=\"./test/tsconfig.json\" mocha", diff --git a/packages/client/package.json b/packages/client/package.json index cbde1937e..75f48bb93 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -5,7 +5,9 @@ "scripts": { "watch": "vite build --watch --mode development", "build": "vite build", - "lint": "eslint src --ext .ts,.vue" + "lint": "eslint src --ext .ts,.vue", + "clean": "rm -rf built/", + "clean-all": "yarn clean && rm -rf node_modules/" }, "resolutions": { "chokidar": "^3.3.1", diff --git a/packages/foundkey-js/package.json b/packages/foundkey-js/package.json index 05134402d..a599684c9 100644 --- a/packages/foundkey-js/package.json +++ b/packages/foundkey-js/package.json @@ -14,7 +14,9 @@ "api-prod": "npx api-extractor run --verbose", "lint": "eslint . --ext .js,.jsx,.ts,.tsx", "jest": "jest --coverage --detectOpenHandles", - "test": "yarn jest && yarn tsd" + "test": "yarn jest && yarn tsd", + "clean": "rm -rf built/", + "clean-all": "yarn clean && rm -rf node_modules/" }, "devDependencies": { "@microsoft/api-extractor": "^7.19.3", diff --git a/packages/sw/package.json b/packages/sw/package.json index 43ed93390..2886ff69e 100644 --- a/packages/sw/package.json +++ b/packages/sw/package.json @@ -5,7 +5,9 @@ "scripts": { "watch": "node build.js watch", "build": "node build.js", - "lint": "eslint src --ext .ts" + "lint": "eslint src --ext .ts", + "clean": "rm -rf built/", + "clean-all": "yarn clean && rm -rf node_modules/" }, "dependencies": { "esbuild": "^0.14.13", diff --git a/scripts/clean-all.js b/scripts/clean-all.js deleted file mode 100644 index 19cfd34d4..000000000 --- a/scripts/clean-all.js +++ /dev/null @@ -1,19 +0,0 @@ -const fs = require('fs'); - -(async () => { - fs.rmSync(__dirname + '/../packages/backend/built', { recursive: true, force: true }); - fs.rmSync(__dirname + '/../packages/backend/tsconfig.tsbuildinfo', { recursive: true, force: true }); - fs.rmSync(__dirname + '/../packages/backend/node_modules', { recursive: true, force: true }); - - fs.rmSync(__dirname + '/../packages/client/built', { recursive: true, force: true }); - fs.rmSync(__dirname + '/../packages/client/node_modules', { recursive: true, force: true }); - - fs.rmSync(__dirname + '/../packages/foundkey-js/built', { recursive: true, force: true }); - fs.rmSync(__dirname + '/../packages/foundkey-js/node_modules', { recursive: true, force: true }); - - fs.rmSync(__dirname + '/../packages/sw/built', { recursive: true, force: true }); - fs.rmSync(__dirname + '/../packages/sw/node_modules', { recursive: true, force: true }); - - fs.rmSync(__dirname + '/../built', { recursive: true, force: true }); - fs.rmSync(__dirname + '/../node_modules', { recursive: true, force: true }); -})(); diff --git a/scripts/clean.js b/scripts/clean.js deleted file mode 100644 index f13b1250b..000000000 --- a/scripts/clean.js +++ /dev/null @@ -1,10 +0,0 @@ -const fs = require('fs'); - -(async () => { - fs.rmSync(__dirname + '/../packages/backend/built', { recursive: true, force: true }); - fs.rmSync(__dirname + '/../packages/backend/tsconfig.tsbuildinfo', { recursive: true, force: true }); - fs.rmSync(__dirname + '/../packages/client/built', { recursive: true, force: true }); - fs.rmSync(__dirname + '/../packages/foundkey-js/built', { recursive: true, force: true }); - fs.rmSync(__dirname + '/../packages/sw/built', { recursive: true, force: true }); - fs.rmSync(__dirname + '/../built', { recursive: true, force: true }); -})();