Skip to content

Commit 4862326

Browse files
authored
refactor: 💡 turns to pnpm workspace (#487)
* refactor: 💡 turns to pnpm workspace
1 parent 62b83a4 commit 4862326

Some content is hidden

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

81 files changed

+8159
-10249
lines changed

.eslintignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
lib
22
node_modules
3-
tests
3+
tests
4+
__tests__
5+
website

.github/workflows/ci.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,28 @@ jobs:
1515
- uses: actions/checkout@v2
1616
- name: Set branch name
1717
run: echo >>$GITHUB_ENV BRANCH_NAME=${GITHUB_REF#refs/heads/}
18+
1819
- name: Echo branch name
1920
run: echo ${BRANCH_NAME}
21+
2022
- name: Use Node.js ${{ matrix.node-version }}
2123
uses: actions/setup-node@v1
2224
with:
2325
node-version: ${{ matrix.node-version }}
2426
registry-url: https://registry.npmjs.org/
25-
- run: npm run install:deps
26-
- run: npm run lint
27-
- run: npm run test
28-
- run: npm run coverage
27+
28+
- name: Install pnpm
29+
uses: pnpm/action-setup@v2
30+
with:
31+
version: 6
32+
33+
- run: pnpm run setup
34+
- run: pnpm run lint
35+
- run: pnpm run test
36+
- run: pnpm run coverage
2937
env:
3038
CI: true
31-
- run: npm run publish:packages
39+
- run: pnpm run publish:packages
3240
env:
3341
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
3442

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry=https://registry.npmmirror.com

jsconfig.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

lerna.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

package.json

Lines changed: 19 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
11
{
2-
"name": "@ice/stark",
2+
"name": "icestark-monorepo",
33
"version": "2.7.0",
4+
"private": true,
45
"description": "Icestark is a JavaScript library for multiple projects, Ice workbench solution.",
56
"scripts": {
6-
"install:deps": "rm -rf node_modules && rm -rf ./packages/*/node_modules && yarn install && lerna exec -- npm install",
7+
"preinstall": "npx only-allow pnpm",
8+
"setup": "rm -rf node_modules && rm -rf ./packages/*/node_modules && pnpm i && npm run build",
9+
"build": "run-s clean build-sandbox build-app build-module build-data build-icestark",
10+
"build-icestark": "cd packages/icestark && npm run build",
11+
"build-sandbox": "cd packages/sandbox && npm run build",
12+
"build-app": "cd packages/icestark-app && npm run build",
13+
"build-module": "cd packages/icestark-module && npm run build",
14+
"build-data": "cd packages/icestark-data && npm run build",
15+
"clean": "rimraf packages/*/lib",
716
"publish:packages": "ts-node ./scripts/publish.ts",
8-
"build": "rm -rf lib && tsc",
9-
"watch": "tsc -w",
10-
"prepublishOnly": "npm run lint && npm run test && npm run build",
11-
"lint": "eslint --cache --ext .ts,.tsx ./ && tsc --noEmit",
17+
"publish:beta": "ts-node ./scripts/beta.ts",
18+
"lint": "eslint --cache --ext .js,.jsx,.ts,.tsx ./",
1219
"test": "NODE_ENV=unittest jest",
1320
"coverage": "codecov"
1421
},
15-
"main": "lib/index.js",
16-
"module": "lib/index.js",
17-
"types": "lib/index.d.ts",
18-
"files": [
19-
"lib"
20-
],
2122
"license": "MIT",
22-
"keywords": [
23-
"ice",
24-
"react",
25-
"microfrontends"
26-
],
2723
"bugs": {
2824
"url": "https://github.com/alibaba/ice/issues"
2925
},
@@ -44,16 +40,6 @@
4440
"type": "git",
4541
"url": "git+https://github.com/ice-lab/icestark.git"
4642
},
47-
"peerDependencies": {
48-
"react": ">=15.0.0"
49-
},
50-
"dependencies": {
51-
"@ice/sandbox": "^1.0.4",
52-
"lodash.isempty": "^4.4.0",
53-
"lodash.isequal": "^4.5.0",
54-
"path-to-regexp": "^1.7.0",
55-
"url-parse": "^1.1.9"
56-
},
5743
"devDependencies": {
5844
"@commitlint/cli": "^7.5.2",
5945
"@commitlint/config-conventional": "^7.5.0",
@@ -62,33 +48,28 @@
6248
"@testing-library/react": "^9.3.2",
6349
"@types/jest": "^24.0.12",
6450
"@types/node": "^12.0.0",
65-
"@types/path-to-regexp": "^1.7.0",
66-
"@types/react": "^16.8.19",
67-
"@types/url-parse": "^1.4.3",
51+
"@types/fs-extra": "^9.0.13",
6852
"codecov": "^3.4.0",
6953
"eslint": "^7.31.0",
54+
"fs-extra": "^10.0.0",
7055
"husky": "^2.2.0",
7156
"jest": "^24.7.1",
7257
"jest-fetch-mock": "^2.1.2",
73-
"lerna": "^3.22.1",
7458
"lint-staged": "^10.5.3",
75-
"react": "^16.7.0",
76-
"react-dom": "^16.7.0",
59+
"npm-run-all": "^4.1.5",
60+
"rimraf": "^3.0.2",
7761
"stylelint": "^10.1.0",
7862
"ts-jest": "^24.0.2",
7963
"ts-node": "^10.2.1",
8064
"typescript": "^4.3.5",
81-
"urllib": "^2.36.1"
82-
},
83-
"resolutions": {
84-
"eslint-plugin-import": "2.20.2",
85-
"@types/testing-library__dom": "7.0.2"
65+
"urllib": "^2.38.0"
8666
},
8767
"jest": {
8868
"coverageDirectory": "./coverage/",
8969
"collectCoverage": true,
9070
"preset": "ts-jest",
9171
"automock": false,
72+
"testMatch": [ "**/__tests__/**/*.ts?(x)", "**/?(*.)+(spec|test).ts?(x)" ],
9273
"setupFiles": [
9374
"./setupJest.ts"
9475
]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
lib
2+
node_modules
3+
tests
4+
__tests__

packages/icestark-app/.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
module.exports = {
3+
extends: '../../.eslintrc.js',
4+
};

packages/icestark-app/package.json

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"scripts": {
66
"build": "rm -rf lib && tsc",
77
"watch": "tsc -w",
8-
"prepublishOnly": "npm run test && npm run build",
98
"test": "NODE_ENV=unittest jest",
10-
"coverage": "codecov"
9+
"lint": "eslint --ext .js,.jsx,.ts,.tsx ./",
10+
"prepublishOnly": "run-s lint test build"
1111
},
1212
"main": "lib/index.js",
1313
"types": "lib/index.d.ts",
@@ -25,32 +25,21 @@
2525
"url": "https://github.com/ice-lab/icestark/issues"
2626
},
2727
"homepage": "https://github.com/ice-lab/icestark",
28-
"husky": {
29-
"hooks": {
30-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
31-
}
32-
},
3328
"repository": {
3429
"type": "git",
3530
"url": "git+https://github.com/ice-lab/icestark.git"
3631
},
3732
"devDependencies": {
38-
"@commitlint/cli": "^7.5.2",
39-
"@commitlint/config-conventional": "^7.5.0",
40-
"@ice/spec": "^0.1.4",
41-
"@testing-library/jest-dom": "^4.2.3",
42-
"@types/jest": "^24.0.12",
43-
"@types/node": "^12.0.0",
44-
"codecov": "^3.4.0",
45-
"husky": "^2.2.0",
46-
"jest": "^24.7.1",
47-
"stylelint": "^10.1.0",
48-
"ts-jest": "^24.0.2",
4933
"typescript": "^3.4.4"
5034
},
5135
"jest": {
5236
"coverageDirectory": "./coverage/",
5337
"collectCoverage": true,
54-
"preset": "ts-jest"
38+
"preset": "ts-jest",
39+
"automock": false,
40+
"testMatch": [ "**/__tests__/**/*.ts?(x)", "**/?(*.)+(spec|test).ts?(x)" ],
41+
"setupFiles": [
42+
"../../setupJest.ts"
43+
]
5544
}
5645
}

0 commit comments

Comments
 (0)