From 167ed4e114807008369969c6e4881622099cb0cd Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Tue, 31 Aug 2021 17:43:49 +0800 Subject: [PATCH] chore: add plugin install --- web/package.json | 2 ++ web/plugins/com.msgbyte.webview/yarn.lock | 4 ++++ web/plugins/install.js | 22 ++++++++++++++++++++++ yarn.lock | 15 +++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 web/plugins/com.msgbyte.webview/yarn.lock create mode 100644 web/plugins/install.js diff --git a/web/package.json b/web/package.json index 19ff70a7..e3f43810 100644 --- a/web/package.json +++ b/web/package.json @@ -10,6 +10,7 @@ "build": "yarn plugins:all && cross-env TS_NODE_PROJECT='tsconfig.node.json' webpack", "dev": "cross-env TS_NODE_PROJECT='tsconfig.node.json' NODE_ENV=development webpack serve", "serve": "npx http-server ./dist", + "postinstall": "node plugins/install.js", "plugins:all": "ministar buildPlugin all", "plugins:watch": "ministar watchPlugin all" }, @@ -58,6 +59,7 @@ "css-loader": "^5.2.6", "dotenv": "^10.0.0", "esbuild-loader": "^2.13.1", + "execa": "^5.1.1", "file-loader": "^6.2.0", "html-webpack-plugin": "^5.3.2", "less": "^4.1.1", diff --git a/web/plugins/com.msgbyte.webview/yarn.lock b/web/plugins/com.msgbyte.webview/yarn.lock new file mode 100644 index 00000000..fb57ccd1 --- /dev/null +++ b/web/plugins/com.msgbyte.webview/yarn.lock @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + diff --git a/web/plugins/install.js b/web/plugins/install.js new file mode 100644 index 00000000..4d8d0794 --- /dev/null +++ b/web/plugins/install.js @@ -0,0 +1,22 @@ +const fs = require('fs-extra'); +const glob = require('glob'); +const path = require('path'); +const execa = require('execa'); + +const pluginDirs = glob.sync(path.join(__dirname, './com.msgbyte.*')); + +Promise.all( + pluginDirs.map((dir) => { + execa('yarn', { + cwd: dir, + stdout: 'inherit', + stderr: 'inherit', + }); + }) +) + .then(() => { + console.log('插件依赖安装完毕'); + }) + .catch((err) => { + console.error('插件依赖安装失败:', err); + }); diff --git a/yarn.lock b/yarn.lock index 9f4f6ac8..5c41914b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4106,6 +4106,21 @@ execa@^5.0.0: signal-exit "^3.0.3" strip-final-newline "^2.0.0" +execa@^5.1.1: + version "5.1.1" + resolved "https://registry.nlark.com/execa/download/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" + integrity sha1-+ArZy/Qpj3vR1MlVXCHpN0HEEd0= + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.0" + human-signals "^2.1.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.1" + onetime "^5.1.2" + signal-exit "^3.0.3" + strip-final-newline "^2.0.0" + exit@^0.1.2: version "0.1.2" resolved "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c"