From 14374779f4d7c02087bdd3546a0b00c25e22d98d Mon Sep 17 00:00:00 2001 From: Jeffrey Lau Date: Thu, 24 Aug 2023 20:41:10 +0800 Subject: [PATCH] chore(npm): Implement 'dist:watch' to streamline development --- package.json | 11 +++++++++-- pnpm-lock.yaml | 26 +++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 97359447..32a38dfd 100644 --- a/package.json +++ b/package.json @@ -21,10 +21,16 @@ "diagnose": "tsc --diagnostics", "typecheck": "tsc -p tsconfig.build.json --noEmit", "build:decl": "tsc -p tsconfig.build.json --emitDeclarationOnly", - "tsc": "tsc -p tsconfig.build.json && cp package.json ${npm_package_dist_dir}/", - "build": "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:decl:watch": "pnpm run build:decl --watch", + "tsc": "tsc -p tsconfig.build.json", + "posttsc": "pnpm run postbuild", + "build": "swc ${npm_package_src_dir} --sync --ignore '*.test.*' --out-dir ${npm_package_dist_dir} --copy-files --extensions '.ts,.tsx,.js,.jsx,.json'", + "postbuild": "cp package.json ${npm_package_dist_dir}/", + "build:watch": "pnpm run build --watch", + "postbuild:watch": "pnpm run postbuild", "inject": "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}/", "dist": "concurrently npm:build npm:build:decl", + "dist:watch": "concurrently npm:build:watch npm:build:decl:watch", "build-inject": "pnpm run build && pnpm run inject", "build-typecheck": "concurrently npm:build npm:typecheck", "clean-build": "pnpm run clean; pnpm run build", @@ -85,6 +91,7 @@ "@types/webpack-env": "^1.18.0", "@typescript-eslint/eslint-plugin": "^5.59.6", "@typescript-eslint/parser": "^5.59.6", + "chokidar": "^3.5.3", "codeceptjs": "^3.4.1", "concurrently": "^8.0.1", "electron": "^24.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e67d571b..d8970f8c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,7 +53,7 @@ importers: version: 2.1.0(@riboseinc/isogit-lfs@0.2.0) '@swc/cli': specifier: ^0.1.62 - version: 0.1.62(@swc/core@1.3.68) + version: 0.1.62(@swc/core@1.3.68)(chokidar@3.5.3) '@swc/core': specifier: ^1.3.68 version: 1.3.68(@swc/helpers@0.5.1) @@ -81,6 +81,9 @@ importers: '@typescript-eslint/parser': specifier: ^5.59.6 version: 5.59.6(eslint@8.40.0)(typescript@5.1.6) + chokidar: + specifier: ^3.5.3 + version: 3.5.3 codeceptjs: specifier: ^3.4.1 version: 3.4.1 @@ -2167,6 +2170,27 @@ packages: source-map: 0.7.4 dev: true + /@swc/cli@0.1.62(@swc/core@1.3.68)(chokidar@3.5.3): + resolution: {integrity: sha512-kOFLjKY3XH1DWLfXL1/B5MizeNorHR8wHKEi92S/Zi9Md/AK17KSqR8MgyRJ6C1fhKHvbBCl8wboyKAFXStkYw==} + engines: {node: '>= 12.13'} + hasBin: true + peerDependencies: + '@swc/core': ^1.2.66 + chokidar: ^3.5.1 + peerDependenciesMeta: + chokidar: + optional: true + dependencies: + '@mole-inc/bin-wrapper': 8.0.1 + '@swc/core': 1.3.68(@swc/helpers@0.5.1) + chokidar: 3.5.3 + commander: 7.2.0 + fast-glob: 3.2.12 + semver: 7.3.8 + slash: 3.0.0 + source-map: 0.7.4 + dev: true + /@swc/core-darwin-arm64@1.3.58: resolution: {integrity: sha512-NwX9768gcM4HjBEE+2VCMB+h/5bwNDF4DngOTJa9w02l3AwGZXWE66X4ulJQ3Oxv8EAz1nzWb8lbi3XT+WCtmQ==} engines: {node: '>=10'}