Skip to content

Commit

Permalink
optimize: 包管理工具,使用 pnpm 替换掉 lerna (#395)
Browse files Browse the repository at this point in the history
  • Loading branch information
starknt authored Nov 15, 2024
1 parent 8bb2d62 commit 1a3918b
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 80 deletions.
41 changes: 19 additions & 22 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,26 @@ jobs:
- ubuntu
- macos
node:
- 16
- 22
steps:
- name: 'Checkout'
uses: actions/[email protected]

- 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
Expand All @@ -41,44 +50,32 @@ 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";
echo "--------------------";
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: |
Expand Down
41 changes: 19 additions & 22 deletions .github/workflows/test-and-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,26 @@ jobs:
- ubuntu
- macos
node:
- 16
- 22
steps:
- name: 'Checkout'
uses: actions/[email protected]

- 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
Expand All @@ -46,44 +55,32 @@ 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";
echo "--------------------";
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: |
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
7 changes: 0 additions & 7 deletions _script/1、installEnv.bat

This file was deleted.

5 changes: 5 additions & 0 deletions _script/1、setupEnv.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cd ../

node -v

npm install -g pnpm --registry=https://registry.npmmirror.com
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ cd ../

node -v

lerna bootstrap
pnpm install
18 changes: 0 additions & 18 deletions lerna.json

This file was deleted.

8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"name": "dev-sidecar-parent",
"packageManager": "[email protected]",
"private": false,
"author": "Greper",
"license": "MPL-2.0",
"dependencies": {
},
"devDependencies": {
"lerna": "^6.6.2"
}
"license": "MPL-2.0"
}
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions packages/gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/gui/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
title: 'DevSidecar-给开发者的边车辅助工具',
},
},
lintOnSave: false,
configureWebpack: {
plugins: [
new webpack.DefinePlugin({ 'global.GENTLY': true }),
Expand Down

0 comments on commit 1a3918b

Please sign in to comment.