From 1a3918b4021226f333d06624b55595e98a3645b7 Mon Sep 17 00:00:00 2001 From: star knight <64941905+starknt@users.noreply.github.com> Date: Fri, 15 Nov 2024 23:37:00 +0800 Subject: [PATCH] =?UTF-8?q?optimize:=20=E5=8C=85=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=EF=BC=8C=E4=BD=BF=E7=94=A8=20`pnpm`=20?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E6=8E=89=20`lerna`=20(#395)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-and-release.yml | 41 +++++++++---------- .github/workflows/test-and-upload.yml | 41 +++++++++---------- .npmrc | 1 + _script/1、installEnv.bat | 7 ---- _script/1、setupEnv.bat | 5 +++ ...llBootstrap.bat => 2、installProject.bat} | 2 +- lerna.json | 18 -------- package.json | 8 +--- packages/core/package.json | 2 +- packages/gui/package.json | 6 +-- packages/gui/vue.config.js | 1 + 11 files changed, 52 insertions(+), 80 deletions(-) create mode 100644 .npmrc delete mode 100644 _script/1、installEnv.bat create mode 100644 _script/1、setupEnv.bat rename _script/{2、installBootstrap.bat => 2、installProject.bat} (51%) delete mode 100644 lerna.json diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 21b7b6f..5735db8 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -17,17 +17,26 @@ jobs: - ubuntu - macos node: - - 16 + - 22 steps: - name: 'Checkout' uses: actions/checkout@v4.1.7 - - name: 'Setup Node.js environment' + - name: 'Setup Node.js "${{ matrix.node }}.x" environment' uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} registry-url: https://npm.pkg.github.com/ + - name: 'Setup pnpm' + uses: pnpm/action-setup@v4 + + - name: 'Setup Python environment (Mac) Because of electron-builder install-app-deps requires Python setup tools' + if: matrix.os == 'macos' + uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: 'Get package info' id: package-info uses: luizfelipelaviola/get-package-info@v1 @@ -41,19 +50,7 @@ jobs: echo "github.ref = ${{ github.ref }}"; echo "github.ref_name = ${{ github.ref_name }}"; - - name: 'npm install -g lerna@6/yarn' - run: | - echo "======================================================================"; - echo "npm install -g lerna@6"; - echo "--------------------"; - npm install -g lerna@6; - - echo "======================================================================"; - echo "npm install -g yarn"; - echo "--------------------"; - npm install -g yarn; - - - name: 'npm -v | yarn -v | lerna -v' + - name: 'npm -v | pnpm -v | python --version' run: | echo "======================================================================"; echo "npm -v"; @@ -61,24 +58,24 @@ jobs: npm -v; echo "======================================================================"; - echo "yarn -v"; + echo "pnpm -v"; echo "--------------------"; - yarn -v; + pnpm -v; echo "======================================================================"; - echo "lerna -v"; + echo "python --version"; echo "--------------------"; - lerna -v; + python --version; - - name: 'lerna bootstrap' + - name: 'pnpm install' run: | echo "======================================================================"; dir || ls -lah; echo "======================================================================"; - echo "lerna bootstrap --npm-client=yarn"; + echo "pnpm install"; echo "--------------------"; - lerna bootstrap --npm-client=yarn; + pnpm install; - name: 'npm run electron:build' run: | diff --git a/.github/workflows/test-and-upload.yml b/.github/workflows/test-and-upload.yml index d05e749..932a795 100644 --- a/.github/workflows/test-and-upload.yml +++ b/.github/workflows/test-and-upload.yml @@ -22,17 +22,26 @@ jobs: - ubuntu - macos node: - - 16 + - 22 steps: - name: 'Checkout' uses: actions/checkout@v4.1.7 - - name: 'Setup Node.js environment' + - name: 'Setup Node.js "${{ matrix.node }}.x" environment' uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} registry-url: https://npm.pkg.github.com/ + - name: 'Setup pnpm' + uses: pnpm/action-setup@v4 + + - name: 'Setup Python environment (Mac) Because of electron-builder install-app-deps requires Python setup tools' + if: matrix.os == 'macos' + uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: 'Get package info' id: package-info uses: luizfelipelaviola/get-package-info@v1 @@ -46,19 +55,7 @@ jobs: echo "github.ref = ${{ github.ref }}"; echo "github.ref_name = ${{ github.ref_name }}"; - - name: 'npm install -g lerna@6/yarn' - run: | - echo "======================================================================"; - echo "npm install -g lerna@6"; - echo "--------------------"; - npm install -g lerna@6; - - echo "======================================================================"; - echo "npm install -g yarn"; - echo "--------------------"; - npm install -g yarn; - - - name: 'npm -v | yarn -v | lerna -v' + - name: 'npm -v | pnpm -v | python --version' run: | echo "======================================================================"; echo "npm -v"; @@ -66,24 +63,24 @@ jobs: npm -v; echo "======================================================================"; - echo "yarn -v"; + echo "pnpm -v"; echo "--------------------"; - yarn -v; + pnpm -v; echo "======================================================================"; - echo "lerna -v"; + echo "python --version"; echo "--------------------"; - lerna -v; + python --version; - - name: 'lerna bootstrap' + - name: 'pnpm install' run: | echo "======================================================================"; dir || ls -lah; echo "======================================================================"; - echo "lerna bootstrap --npm-client=yarn"; + echo "pnpm install"; echo "--------------------"; - lerna bootstrap --npm-client=yarn; + pnpm install; - name: 'npm run electron:build' run: | diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..bf2e764 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +shamefully-hoist=true diff --git a/_script/1、installEnv.bat b/_script/1、installEnv.bat deleted file mode 100644 index d395bf8..0000000 --- a/_script/1、installEnv.bat +++ /dev/null @@ -1,7 +0,0 @@ -cd ../ - -node -v - -npm install -g cnpm --registry=https://registry.npmmirror.com - -cnpm install -g lerna@6 diff --git a/_script/1、setupEnv.bat b/_script/1、setupEnv.bat new file mode 100644 index 0000000..59c2ba2 --- /dev/null +++ b/_script/1、setupEnv.bat @@ -0,0 +1,5 @@ +cd ../ + +node -v + +npm install -g pnpm --registry=https://registry.npmmirror.com diff --git a/_script/2、installBootstrap.bat b/_script/2、installProject.bat similarity index 51% rename from _script/2、installBootstrap.bat rename to _script/2、installProject.bat index 73d4d58..976629a 100644 --- a/_script/2、installBootstrap.bat +++ b/_script/2、installProject.bat @@ -2,4 +2,4 @@ cd ../ node -v -lerna bootstrap +pnpm install diff --git a/lerna.json b/lerna.json deleted file mode 100644 index cf1a86b..0000000 --- a/lerna.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "packages": [ - "packages/*" - ], - "command": { - "publish": { - "ignoreChanges": [ - "*.md", - "config", - "doc" - ] - }, - "bootstrap": { - "ignore": [] - } - }, - "version": "1.8.9" -} diff --git a/package.json b/package.json index 52a91eb..dbf8815 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,7 @@ { "name": "dev-sidecar-parent", + "packageManager": "pnpm@9.13.2", "private": false, "author": "Greper", - "license": "MPL-2.0", - "dependencies": { - }, - "devDependencies": { - "lerna": "^6.6.2" - } + "license": "MPL-2.0" } diff --git a/packages/core/package.json b/packages/core/package.json index 267071a..587e942 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -17,7 +17,7 @@ "test": "mocha" }, "dependencies": { - "@docmirror/mitmproxy": "^1.8.9", + "@docmirror/mitmproxy": "workspace:*", "agentkeepalive": "^2.1.1", "babel-preset-es2020": "^1.0.2", "charset": "^1.0.0", diff --git a/packages/gui/package.json b/packages/gui/package.json index c897fca..145f67d 100644 --- a/packages/gui/package.json +++ b/packages/gui/package.json @@ -21,8 +21,8 @@ "electron:icons-black": "electron-icon-builder --input=./public/logo/win-black.png --output=build/black --flatten" }, "dependencies": { - "@docmirror/dev-sidecar": "^1.8.9", - "@docmirror/mitmproxy": "^1.8.9", + "@docmirror/dev-sidecar": "workspace:*", + "@docmirror/mitmproxy": "workspace:*", "@mihomo-party/sysproxy": "^2.0.4", "@natmri/platform-napi": "^0.0.7", "adm-zip": "^0.5.5", @@ -54,7 +54,7 @@ "@vue/eslint-config-standard": "^5.1.2", "babel-eslint": "^10.1.0", "electron": "^17.4.11", - "electron-builder": "^23.0.3", + "electron-builder": "^25.0.6", "electron-devtools-installer": "^3.1.0", "electron-icon-builder": "^2.0.1", "eslint": "^6.7.2", diff --git a/packages/gui/vue.config.js b/packages/gui/vue.config.js index 846cb50..df53d2c 100644 --- a/packages/gui/vue.config.js +++ b/packages/gui/vue.config.js @@ -15,6 +15,7 @@ module.exports = { title: 'DevSidecar-给开发者的边车辅助工具', }, }, + lintOnSave: false, configureWebpack: { plugins: [ new webpack.DefinePlugin({ 'global.GENTLY': true }),