Skip to content

Commit e67eee3

Browse files
authored
Merge pull request #1690 from NervJS/feat/pnpm-workspace
chore: yarn 升级到 pnpm workspace
2 parents ab51d9b + 4f48001 commit e67eee3

File tree

54 files changed

+21854
-53914
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+21854
-53914
lines changed

.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
"packages/**/*.js",
106106
"packages/**/*.jsx"
107107
],
108-
"parser": "babel-eslint",
108+
"parser": "@babel/eslint-parser",
109109
"parserOptions": {
110110
"ecmaVersion": 2017,
111111
"ecmaFeatures": {

.github/workflows/publish.yml

+23-12
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
node-version: [14.x]
21+
node-version: [16.x]
2222

2323
steps:
2424
# Setup
@@ -27,7 +27,7 @@ jobs:
2727
- name: Setup Node ${{ matrix.node_version }}
2828
uses: actions/setup-node@v1
2929
with:
30-
node-version: 14
30+
node-version: 16
3131
registry-url: 'https://registry.npmjs.org'
3232
- name: Git Identity
3333
run: |
@@ -77,15 +77,22 @@ jobs:
7777
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7878

7979
# Bootstrap project
80+
- name: Cache pnpm modules
81+
uses: actions/cache@v3
82+
with:
83+
path: ~/.pnpm-store
84+
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
85+
restore-keys: |
86+
${{ runner.os }}-
8087
- name: install
81-
if: startsWith( env.commitmsg , 'chore(release):' ) && steps.tag_check.outputs.exists_tag == 'false'
82-
run: yarn
83-
- name: bootstrap
84-
if: startsWith( env.commitmsg , 'chore(release):' ) && steps.tag_check.outputs.exists_tag == 'false'
85-
run: yarn run bootstrap
88+
uses: pnpm/[email protected]
89+
with:
90+
version: 8
91+
run_install: |
92+
- recursive: true
93+
args: [--frozen-lockfile]
8694
- name: build
87-
if: startsWith( env.commitmsg , 'chore(release):' ) && steps.tag_check.outputs.exists_tag == 'false'
88-
run: yarn build
95+
run: pnpm build
8996

9097
# Git stash
9198
- name: Drop current changes
@@ -106,9 +113,13 @@ jobs:
106113
git_tag_prefix: "v"
107114

108115
# Publish
109-
- name: npm publish
110-
if: steps.tag_check.outputs.exists_tag == 'false' && startsWith( env.commitmsg , 'chore(release):' )
111-
run: yarn lerna publish from-package --yes
116+
- name: Publish
117+
run: |
118+
if [ '${{ github.event_name }}' == 'pull_request' ] ; then
119+
pnpm publish --registry=https://registry.npmjs.org/ --publish-branch=${{ github.ref }} -r
120+
elif [ '${{ github.event_name }}' == 'push' ] ; then
121+
pnpm publish --registry=https://registry.npmjs.org/ --publish-branch=${{ github.ref_name }} -r ${{ env.PUBLISH_PARAMS }}
122+
fi
112123
env:
113124
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114125
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/rn-release.yml

+16-17
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,23 @@ jobs:
1616
path: ${{ github.workspace }}/node_modules
1717
key: ${{ runner.os }}-node_modules
1818
restore-keys: ${{ runner.os }}-node_modules
19-
- name: Get Yarn Cache Directory Path
20-
id: yarn-cache-dir-path
21-
run: echo "::set-output name=dir::$(yarn cache dir)"
22-
- name: Cache Yarn
23-
uses: actions/cache@v2
24-
env:
25-
cache-name: yarn-cache
19+
20+
- name: Cache pnpm modules
21+
uses: actions/cache@v3
2622
with:
27-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
28-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
23+
path: ~/.pnpm-store
24+
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
2925
restore-keys: |
30-
${{ runner.os }}-yarn-
31-
- name: Install Dependencies
32-
run: |
33-
yarn
34-
- name: Lerna Bootstrap
35-
run: |
36-
yarn bootstrap
26+
${{ runner.os }}-
27+
28+
- name: install
29+
uses: pnpm/[email protected]
30+
with:
31+
version: 8
32+
run_install: |
33+
- recursive: true
34+
args: [--frozen-lockfile]
35+
3736
- name: Release Taro React Native bundle
3837
uses: zhiqingchen/taro-react-native-release@v1
3938
with:
@@ -47,4 +46,4 @@ jobs:
4746
name: bundle-qr-code
4847
path: |
4948
packages/taro-ui-demo-rn/release/qrcode/ios.png
50-
packages/taro-ui-demo-rn/release/qrcode/android.png
49+
packages/taro-ui-demo-rn/release/qrcode/android.png

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package-lock.json
99
.temp
1010
.DS_Store
1111
.eslintcache
12+
.swc
1213

1314
# Editor and IDE files
1415
.vscode

.husky/commit-msg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
pnpm commitlint --edit $1 --config commitlint.config.js

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
pnpm lint-staged --allow-empty

lerna.json

-17
This file was deleted.

package.json

+38-40
Original file line numberDiff line numberDiff line change
@@ -9,58 +9,56 @@
99
"url": "[email protected]:nervjs/taro-ui.git"
1010
},
1111
"license": "MIT",
12-
"workspaces": {
13-
"packages": [
14-
"packages/taro-ui",
15-
"packages/taro-ui-demo",
16-
"packages/taro-ui-docs"
17-
]
18-
},
1912
"scripts": {
20-
"bootstrap": "lerna bootstrap",
21-
"build": "lerna run build",
22-
"build:component": "lerna run --scope taro-ui build",
23-
"clean": "lerna run clean",
24-
"clean:component": "lerna run --scope taro-ui clean",
25-
"publish": "lerna publish from-git --yes"
13+
"preinstall": "npx only-allow pnpm",
14+
"build": "pnpm -r run build",
15+
"clean": " rimraf **/dist && rimraf **/node_modules",
16+
"prepare": "husky install"
2617
},
2718
"devDependencies": {
28-
"@commitlint/cli": "^8.3.5",
29-
"@commitlint/config-conventional": "^8.3.4",
30-
"eslint-config-taro": "~3.0.2",
31-
"@typescript-eslint/eslint-plugin": "^5.20.0",
32-
"@typescript-eslint/parser": "^5.20.0",
33-
"conventional-changelog-cli": "^2.0.31",
34-
"cross-env": "^7.0.2",
35-
"eslint": "^8.12.0",
19+
"@babel/core": "^7.22.11",
20+
"@babel/plugin-proposal-class-properties": "^7.18.6",
21+
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
22+
"@babel/preset-env": "^7.22.10",
23+
"@babel/preset-react": "^7.22.5",
24+
"@commitlint/cli": "^17.7.1",
25+
"@commitlint/config-conventional": "^17.7.0",
26+
"@types/react": "^18.2.21",
27+
"@types/react-dom": "^18.2.7",
28+
"@typescript-eslint/eslint-plugin": "^5.62.0",
29+
"@typescript-eslint/parser": "^5.62.0",
30+
"autoprefixer": "9.8.8",
31+
"conventional-changelog-cli": "^2.2.2",
32+
"cross-env": "^7.0.3",
33+
"eslint": "^8.48.0",
3634
"eslint-config-o2team": "^0.1.7",
37-
"eslint-config-prettier": "^6.10.1",
38-
"eslint-import-resolver-custom-alias": "^1.2.0",
39-
"eslint-plugin-import": "^2.20.2",
40-
"eslint-plugin-prettier": "^3.1.2",
41-
"eslint-plugin-react": "^7.19.0",
42-
"eslint-plugin-react-hooks": "^3.0.0",
43-
"husky": "^4.2.3",
44-
"lerna": "^3.20.2",
45-
"lint-staged": "^10.1.2",
46-
"prettier": "^2.0.3",
35+
"eslint-config-prettier": "^6.15.0",
36+
"eslint-config-taro": "~3.6.15",
37+
"eslint-import-resolver-custom-alias": "^1.3.2",
38+
"eslint-plugin-import": "^2.28.1",
39+
"eslint-plugin-prettier": "^3.4.1",
40+
"eslint-plugin-react": "^7.33.2",
41+
"eslint-plugin-react-hooks": "^4.6.0",
42+
"husky": "^8.0.0",
43+
"lint-staged": "^10.5.4",
44+
"prettier": "^2.8.8",
45+
"react": "^18.2.0",
46+
"react-dom": "^18.2.0",
4747
"rimraf": "^3.0.2",
48-
"stylelint": "^15.10.1",
48+
"stylelint": "^15.10.3",
4949
"stylelint-config-standard": "^20.0.0",
50-
"stylelint-scss": "^3.16.0",
51-
"typescript": "~4.1.0"
50+
"stylelint-scss": "^3.21.0",
51+
"tslib": "2.5.0",
52+
"typescript": "~4.1.6"
5253
},
5354
"resolutions": {
5455
"sharp": "^0.28.3"
5556
},
56-
"husky": {
57-
"hooks": {
58-
"pre-commit": "lint-staged",
59-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
60-
}
61-
},
6257
"lint-staged": {
6358
"*.{js,jsx,ts,tsx}": "eslint --quiet --cache --fix",
6459
"src/**/*.scss": "stylelint --syntax scss --fix"
60+
},
61+
"dependencies": {
62+
"@babel/eslint-parser": "^7.22.15"
6563
}
6664
}

packages/taro-ui-demo-rn/package.json

+24-25
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"css": "sass"
1717
},
1818
"scripts": {
19-
"build": "yarn run build:rn",
19+
"build": "pnpm run build:rn",
2020
"build:weapp": "taro build --type weapp",
2121
"build:swan": "taro build --type swan",
2222
"build:alipay": "taro build --type alipay",
@@ -25,14 +25,14 @@
2525
"build:rn": "taro build --type rn",
2626
"build:qq": "taro build --type qq",
2727
"build:quickapp": "taro build --type quickapp",
28-
"dev:weapp": "yarn run build:weapp --watch",
29-
"dev:swan": "yarn run build:swan --watch",
30-
"dev:alipay": "yarn run build:alipay --watch",
31-
"dev:tt": "yarn run build:tt --watch",
32-
"dev:h5": "yarn run build:h5 --watch",
33-
"dev:rn": "yarn run build:rn --watch",
34-
"dev:qq": "yarn run build:qq --watch",
35-
"dev:quickapp": "yarn run build:quickapp --watch",
28+
"dev:weapp": "pnpm run build:weapp --watch",
29+
"dev:swan": "pnpm run build:swan --watch",
30+
"dev:alipay": "pnpm run build:alipay --watch",
31+
"dev:tt": "pnpm run build:tt --watch",
32+
"dev:h5": "pnpm run build:h5 --watch",
33+
"dev:rn": "pnpm run build:rn --watch",
34+
"dev:qq": "pnpm run build:qq --watch",
35+
"dev:quickapp": "pnpm run build:quickapp --watch",
3636
"clean": "rimraf .temp dist"
3737
},
3838
"browserslist": [
@@ -41,32 +41,31 @@
4141
"ios >= 8"
4242
],
4343
"dependencies": {
44+
"classnames": "^2.2.6",
45+
"prop-types": "^15.7.2",
4446
"@babel/runtime": "^7.7.7",
45-
"@tarojs/components": "3.6.5-canary.1",
46-
"@tarojs/plugin-framework-react": "3.6.5-canary.1",
47-
"@tarojs/react": "3.6.5-canary.1",
48-
"@tarojs/rn-runner": "3.6.5-canary.1",
49-
"@tarojs/runtime": "3.6.5-canary.1",
50-
"@tarojs/taro": "3.6.5-canary.1",
51-
"@tarojs/taro-rn": "3.6.5-canary.1",
52-
"react": "^18.2.0",
53-
"react-dom": "^18.2.0",
47+
"@tarojs/components": "3.6.6",
48+
"@tarojs/plugin-framework-react": "3.6.6",
49+
"@tarojs/react": "3.6.6",
50+
"@tarojs/rn-runner": "3.6.6",
51+
"@tarojs/runtime": "3.6.6",
52+
"@tarojs/taro": "3.6.6",
53+
"@tarojs/taro-rn": "3.6.6",
5454
"react-native": "^0.71.6",
5555
"react-native-modal": "^13.0.0",
56-
"taro-ui": "3.1.0-beta.4"
56+
"taro-ui": "workspace:^"
5757
},
5858
"devDependencies": {
59-
"@babel/core": "^7.8.0",
6059
"@react-native-picker/picker": "^1.15.0",
61-
"@tarojs/cli": "3.6.5-canary.1",
62-
"@tarojs/mini-runner": "3.6.5-canary.1",
63-
"@tarojs/webpack-runner": "3.6.5-canary.1",
60+
"@tarojs/cli": "3.6.6",
61+
"@tarojs/mini-runner": "3.6.6",
62+
"@tarojs/webpack-runner": "3.6.6",
6463
"@types/react": "^18.2.0",
6564
"@types/webpack-env": "^1.13.6",
6665
"babel-plugin-transform-imports": "^2.0.0",
67-
"babel-preset-taro": "3.6.5-canary.1",
66+
"babel-preset-taro": "3.6.6",
6867
"escape-string-regexp": "^4.0.0",
69-
"eslint-config-taro": "3.6.5-canary.1",
68+
"eslint-config-taro": "3.6.6",
7069
"expo": "~48.0.0",
7170
"patch-package": "^6.4.7",
7271
"react-native-svg": "13.8.0",

0 commit comments

Comments
 (0)