From 697d4a798afc5249546617dc044c4a91399b6f29 Mon Sep 17 00:00:00 2001 From: Michael Fulton Date: Sat, 20 Apr 2024 13:17:27 -0700 Subject: [PATCH] Use SHX, a wrapper for shell commands, in package.json scripts to support cross-platform development (#134) --- README.md | 4 +-- extension/package-lock.json | 55 +++++++++++++++++++++++++++++++++++ extension/package.json | 3 +- webview/package-lock.json | 57 ++++++++++++++++++++++++++++++++++++- webview/package.json | 5 ++-- 5 files changed, 118 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a311b46..47245b0 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,9 @@ npm install # from the extension directory ### Run the extension -Use the `Debug: Start Debugging Command` to launch the extension in a new vscode window. +Use the `Debug: Start Debugging` command to launch the extension in a new vscode window. -To inspect/debug the webview, use the `Developer: Open Webview Developer tools command`. +To inspect/debug the webview, use the `Developer: Open Webview Developer Tools` command. ### Package the extension to a vsix archive diff --git a/extension/package-lock.json b/extension/package-lock.json index 93a1a8a..b5b0ac8 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -23,6 +23,7 @@ "eslint-config-prettier": "^8.5.0", "eslint-plugin-prettier": "^4.2.1", "prettier": "^2.7.1", + "shx": "^0.3.4", "ts-loader": "^9.4.1", "typescript": "^4.8.4", "webpack": "^5.74.0", @@ -3535,6 +3536,60 @@ "node": ">=8" } }, + "node_modules/shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "dev": true, + "dependencies": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "bin": { + "shjs": "bin/shjs" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/shelljs/node_modules/interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/shelljs/node_modules/rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "dev": true, + "dependencies": { + "resolve": "^1.1.6" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/shx": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.4.tgz", + "integrity": "sha512-N6A9MLVqjxZYcVn8hLmtneQWIJtp8IKzMP4eMnx+nqkvXoqinUPCbUFLp2UcWTEIUONhlk0ewxr/jaVGlc+J+g==", + "dev": true, + "dependencies": { + "minimist": "^1.2.3", + "shelljs": "^0.8.5" + }, + "bin": { + "shx": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", diff --git a/extension/package.json b/extension/package.json index 27c0ad9..bc00ac7 100644 --- a/extension/package.json +++ b/extension/package.json @@ -346,7 +346,7 @@ "vscode:prepublish": "npm run package", "package": "npm run build-webview && npm run copy-webview && webpack --mode production --devtool hidden-source-map", "build": "npm run build-webview && npm run copy-webview && webpack --mode development", - "copy-webview": "rm -rf public && cp -r ../webview/build public", + "copy-webview": "shx rm -rf public && shx cp -r ../webview/build public", "lint": "eslint --ext .ts src", "build-webview": "cd ../webview && npm run build", "start-webview": "cd ../webview && npm run start", @@ -368,6 +368,7 @@ "eslint-config-prettier": "^8.5.0", "eslint-plugin-prettier": "^4.2.1", "prettier": "^2.7.1", + "shx": "^0.3.4", "ts-loader": "^9.4.1", "typescript": "^4.8.4", "webpack": "^5.74.0", diff --git a/webview/package-lock.json b/webview/package-lock.json index ebbe6af..af7c658 100644 --- a/webview/package-lock.json +++ b/webview/package-lock.json @@ -24,7 +24,8 @@ "eslint-config-prettier": "^8.5.0", "eslint-plugin-prettier": "^4.2.1", "prettier": "^2.7.1", - "react-scripts": "5.0.1" + "react-scripts": "5.0.1", + "shx": "^0.3.4" } }, "node_modules/@ampproject/remapping": { @@ -8844,6 +8845,15 @@ "node": ">= 0.4" } }, + "node_modules/interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/ipaddr.js": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.0.1.tgz", @@ -13376,6 +13386,18 @@ "node": ">=8.10.0" } }, + "node_modules/rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "dev": true, + "dependencies": { + "resolve": "^1.1.6" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/recursive-readdir": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.3.tgz", @@ -14136,6 +14158,39 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "dev": true, + "dependencies": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "bin": { + "shjs": "bin/shjs" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/shx": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.4.tgz", + "integrity": "sha512-N6A9MLVqjxZYcVn8hLmtneQWIJtp8IKzMP4eMnx+nqkvXoqinUPCbUFLp2UcWTEIUONhlk0ewxr/jaVGlc+J+g==", + "dev": true, + "dependencies": { + "minimist": "^1.2.3", + "shelljs": "^0.8.5" + }, + "bin": { + "shx": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", diff --git a/webview/package.json b/webview/package.json index 629acea..1f7e06f 100644 --- a/webview/package.json +++ b/webview/package.json @@ -13,7 +13,7 @@ }, "scripts": { "start": "react-scripts start", - "refresh-assets": "rm -rf public/excalidraw-assets && cp -r node_modules/@excalidraw/excalidraw/dist/excalidraw-assets public/excalidraw-assets", + "refresh-assets": "shx rm -rf public/excalidraw-assets && shx cp -r node_modules/@excalidraw/excalidraw/dist/excalidraw-assets public/excalidraw-assets", "build": "npm run refresh-assets && react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject", @@ -35,6 +35,7 @@ "eslint-config-prettier": "^8.5.0", "eslint-plugin-prettier": "^4.2.1", "prettier": "^2.7.1", - "react-scripts": "5.0.1" + "react-scripts": "5.0.1", + "shx": "^0.3.4" } }