From 9000bfb8da33eac39ab09efa68dd37f8411181bd Mon Sep 17 00:00:00 2001 From: Jeffrey Lau Date: Fri, 19 May 2023 16:52:35 +0800 Subject: [PATCH] chore(package.json): DRY up src and dist by using ${npm_package_{src,dist}_dir} --- packages/legacy/package.json | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/legacy/package.json b/packages/legacy/package.json index cc220824..3f3fd0be 100644 --- a/packages/legacy/package.json +++ b/packages/legacy/package.json @@ -14,6 +14,7 @@ "featured": true, "requiredHostAppVersion": "^1.0.0-beta18" }, + "src_dir": "src", "dist_dir": "dist", "scripts": { "preinstall": "npx only-allow pnpm", @@ -21,8 +22,8 @@ "typecheck": "tsc -p tsconfig.build.json --noEmit", "build:decl": "tsc -p tsconfig.build.json --emitDeclarationOnly", "build": "run-script-os", - "build:default": "swc src --sync --ignore '*.test.*' --out-dir ${npm_package_dist_dir} --copy-files --extensions '.ts,.tsx,.js,.jsx,.json' && cp package.json ${npm_package_dist_dir}/", - "build:win32": "mkdirp %npm_package_dist_dir% && swc src --sync --out-dir %npm_package_dist_dir% --copy-files --extensions '.ts,.tsx,.js,.jsx,.json' && copy package.json %npm_package_dist_dir%", + "build:default": "swc ${npm_package_src_dir} --sync --ignore '*.test.*' --out-dir ${npm_package_dist_dir} --copy-files --extensions '.ts,.tsx,.js,.jsx,.json' && cp package.json ${npm_package_dist_dir}/", + "build:win32": "mkdirp %npm_package_dist_dir% && swc %npm_package_src_dir% --sync --out-dir %npm_package_dist_dir% --copy-files --extensions '.ts,.tsx,.js,.jsx,.json' && copy package.json %npm_package_dist_dir%", "inject": "run-script-os", "inject:mac": "mkdirp $HOME/'Library/Application Support'/Paneron/plugins/${npm_package_name}; rsync -a ${npm_package_dist_dir}/ $HOME/'Library/Application Support'/Paneron/plugins/${npm_package_name}/", "inject:win32": "mkdirp \"%appdata%\\Paneron\\plugins\\@paneron\\extension-hls\" && xcopy /e /y %npm_package_dist_dir% \"%appdata%\\Paneron\\plugins\\@paneron\\extension-hls\" > nul", @@ -33,8 +34,12 @@ "clean-build-typecheck": "pnpm run clean; pnpm run build-typecheck", "clean-build-inject": "pnpm run clean; pnpm run build-inject", "clean-build-typecheck-inject": "pnpm run clean-build-typecheck && pnpm run inject", - "lint": "eslint src/ --ext .ts,.tsx", - "clean": "rimraf dist/* *.tsbuildinfo", + "lint": "run-script-os", + "lint:default": "eslint ${npm_package_src_dir}/ --ext .ts,.tsx", + "lint:win32": "eslint %npm_package_src_dir%/ --ext .ts,.tsx", + "clean": "run-script-os", + "clean:default": "rimraf ${npm_package_dist_dir}/* *.tsbuildinfo", + "clean:win32": "rimraf %npm_package_dist_dir%/* *.tsbuildinfo", "test:e2e": "codeceptjs run", "test:e2e:def": "codeceptjs def", "test:unit": "jest",