Skip to content

Commit ba07b05

Browse files
windolepengjin
andauthored
chore: 更改多包管理工具和打包工具 (#50)
* chore: 将多包管理工具改为pnpm * fix: 修改lint报错 * chore: 更改配置文件 * chore: 修改workflows * chore: 打包方式更改为vite * feat: 更改为懒加载 * test: 测试流程更改 * chore: 更改jest配置文件 * chore: update workflow * chore: 更改site-mobile-demo获取不到的问题 * fix: 更改eslint报错 * fix: 修改打包报错 * fix: 修改eslint错误 * chore: 只允许pnpm安装 * chore: 将多包管理工具改为pnpm * fix: 修改lint报错 * chore: 更改配置文件 * chore: 修改workflows * chore: 打包方式更改为vite * feat: 更改为懒加载 * test: 测试流程更改 * chore: 更改jest配置文件 * chore: update workflow * chore: 更改site-mobile-demo获取不到的问题 * fix: 更改eslint报错 * fix: 修改打包报错 * fix: 修改eslint错误 * chore: 只允许pnpm安装 * feat: 添加port * fix: 解决测试代码覆盖率unknown * chore: 更改sit发布流程 Co-authored-by: pengjin <pengjin@vcredit.com>
1 parent 40c152d commit ba07b05

File tree

219 files changed

+13713
-2034
lines changed

Some content is hidden

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

219 files changed

+13713
-2034
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
2+
root: true,
23
extends: [require.resolve('@rancui/linter/dist/eslint')],
34
ignorePatterns: ['/.*'],
45
rules: {

.github/workflows/deploy-site.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,22 @@ jobs:
1414
- name: Checkout 🛎️
1515
uses: actions/checkout@v2
1616

17+
- name: Install pnpm
18+
run: npm i pnpm@7 -g
19+
20+
- uses: actions/setup-node@v2
21+
with:
22+
node-version: '16'
23+
cache: 'pnpm'
24+
1725
- name: Install dependencies
18-
run: yarn bootstrap
26+
run: pnpm install
1927

2028
- name: Build Site
21-
run: yarn build:site
29+
run: npm run build:site
2230

2331
- name: Deploy 🚀
2432
uses: JamesIves/github-pages-deploy-action@4.1.1
2533
with:
2634
branch: gh-pages
27-
folder: packages/rc-ui-lib/site
35+
folder: packages/rc-ui-lib/site-dist

.github/workflows/test.yml

Lines changed: 46 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ name: CI
44

55
# Controls when the workflow will run
66
on:
7-
# Triggers the workflow on push or pull request events but only for the master branch
87
push:
9-
branches: [main]
8+
branches:
9+
- '**'
1010

1111
pull_request:
12-
branches: [main, dev]
12+
branches:
13+
- main
14+
15+
workflow_dispatch:
1316

1417
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1518
jobs:
@@ -18,77 +21,66 @@ jobs:
1821
runs-on: ubuntu-latest
1922
steps:
2023
- name: Checkout code
21-
uses: actions/checkout@master
24+
uses: actions/checkout@v2
2225

23-
- name: Cache lerna
24-
id: cache
25-
uses: actions/cache@v2
26-
with:
27-
path: |
28-
node_modules
29-
*/*/node_modules
30-
key: ${{ runner.os }}-lerna-${{ hashFiles('**/yarn.lock') }}-2
31-
32-
- name: Install
33-
if: steps.cache.outputs.cache-hit != 'true'
34-
run: yarn bootstrap
35-
compile-cli:
36-
name: building cli
37-
runs-on: ubuntu-latest
38-
steps:
39-
- name: Checkout code
40-
uses: actions/checkout@master
26+
- name: Install pnpm
27+
run: npm i pnpm@7 -g
4128

42-
- name: Restore lerna
43-
uses: actions/cache@v2
29+
- uses: actions/setup-node@v2
4430
with:
45-
path: |
46-
node_modules
47-
*/*/node_modules
48-
key: ${{ runner.os }}-lerna-${{ hashFiles('**/yarn.lock') }}-2
31+
node-version: '16'
32+
cache: 'pnpm'
4933

50-
- name: Cache cli
51-
uses: actions/cache@v2
52-
with:
53-
path: packages/rc-cli/lib
54-
key: ${{ runner.os }}-cli-${{ github.sha }}
34+
- name: Install dependencies
35+
run: pnpm install --no-frozen-lockfile
5536

56-
- name: build
57-
run: yarn build:cli
37+
- name: Run linter
38+
run: npm run lint
5839

59-
needs: setup
6040
test:
6141
name: Testing and Coverage
6242
runs-on: ubuntu-latest
6343
steps:
6444
- name: Checkout code
65-
uses: actions/checkout@master
45+
uses: actions/checkout@v2
6646
with:
6747
# codecov.io requires a fetch depth > 1.
6848
fetch-depth: 2
6949

70-
- name: Restore lerna
71-
uses: actions/cache@v2
72-
with:
73-
path: |
74-
node_modules
75-
*/*/node_modules
76-
key: ${{ runner.os }}-lerna-${{ hashFiles('**/yarn.lock') }}-2
50+
- name: Install pnpm
51+
run: npm i pnpm@7 -g
7752

78-
- name: Restore cli
79-
uses: actions/cache@v2
80-
with:
81-
path: packages/rc-cli/lib
82-
key: ${{ runner.os }}-cli-${{ github.sha }}
53+
# - name: add chmod
54+
# run: chmod -R 777 ./*
8355

84-
- name: add chmod
85-
run: chmod -R 777 ./*
56+
- name: Install dependencies
57+
run: pnpm install --no-frozen-lockfile
8658

87-
- name: Test
88-
run: lerna exec --scope rc-ui-lib yarn test
59+
- name: Run test cases
60+
run: npm run test
8961

9062
- name: Upload coverage to Codecov
9163
uses: codecov/codecov-action@v2.1.0
9264
with:
9365
token: ${{ secrets.CODECOV_TOKEN }}
94-
needs: compile-cli
66+
67+
build:
68+
name: Build
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Checkout code
72+
uses: actions/checkout@v2
73+
74+
- name: Install pnpm
75+
run: npm i pnpm@7 -g
76+
77+
- uses: actions/setup-node@v2
78+
with:
79+
node-version: '16'
80+
cache: 'pnpm'
81+
82+
- name: Install dependencies
83+
run: pnpm install --no-frozen-lockfile
84+
85+
- name: Run build
86+
run: npm run build

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ yarn-error.json
1919
es
2020
lib
2121
dist
22-
packages/rc-ui-lib/site
22+
packages/rc-ui-lib/site-dist
2323
packages/rc-ui-lib/**/*.css
2424

2525
# log file

.npmrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
registry = https://registry.npmjs.org
22
# registry=https://registry.npmmirror.com
3+
4+
strict-peer-dependencies=false
5+
6+
shamefully-hoist=true

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,6 @@
9898
},
9999
"editor.codeActionsOnSave": {
100100
"source.fixAll.eslint": true
101-
}
101+
},
102+
"cSpell.words": ["esbuild", "pluginutils", "swipeable"]
102103
}

lerna.json

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

package.json

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,33 @@
11
{
22
"private": true,
3-
"workspaces": [
4-
"packages/*"
5-
],
63
"scripts": {
7-
"prepare": "yarn build:cli && yarn build:linter",
8-
"bootstrap": "lerna bootstrap",
9-
"start": "lerna exec --scope rc-ui-lib yarn start",
10-
"build": "lerna exec --scope rc-ui-lib yarn build",
11-
"build:cli": "lerna exec --scope @rancui/cli yarn build",
12-
"build:linter": "lerna exec --scope @rancui/linter yarn build",
13-
"build:site": "lerna exec --scope rc-ui-lib yarn build:site",
14-
"release:site": "lerna exec --scope rc-ui-lib yarn release:site",
15-
"release": "lerna exec --scope rc-ui-lib yarn release",
16-
"changelog": "lerna exec --scope rc-ui-lib yarn changelog",
17-
"test": "lerna exec --scope rc-ui-lib yarn test",
18-
"clean": "lerna clean -y",
19-
"clearCache": "lerna exec --scope rc-ui-lib yarn test:clearCache",
20-
"publish": "lerna publish",
4+
"preinstall": "npx only-allow pnpm",
5+
"prepare": "husky install",
6+
"start": "pnpm -r --filter ./packages/rc-ui-lib start",
7+
"build": "pnpm -r --filter ./packages/rc-ui-lib build",
8+
"build:cli": "pnpm -r --filter ./packages/rc-cli build",
9+
"build:linter": "pnpm -r --filter ./packages/rc-linter build",
10+
"build:site": "pnpm -r --filter ./packages/rc-ui-lib build:site",
11+
"release:site": "pnpm -r --filter ./packages/rc-ui-lib release:site",
12+
"release": "pnpm -r --filter ./packages/rc-ui-lib release",
13+
"changelog": "pnpm -r --filter ./packages/rc-ui-lib changelog",
14+
"test": "pnpm -r --filter ./packages/rc-ui-lib test",
15+
"lint": "pnpm -r --filter ./packages/rc-ui-lib lint",
2116
"lint:prettier": "prettier --write \"packages/rc-ui-lib/src/**/*.{js,json,ts,tsx,css,less,md}\""
2217
},
2318
"repository": {
2419
"type": "git",
2520
"url": "git+https://github.com/rancui/rc-ui-lib.git"
2621
},
2722
"devDependencies": {
28-
"@rancui/linter": "^1.0.0",
29-
"eslint": "^7.32.0",
30-
"husky": "4",
31-
"lerna": "^4.0.0",
32-
"lerna-changelog": "^2.1.0",
33-
"lint-staged": "^11.1.2",
34-
"prettier": "^2.4.0",
23+
"@rancui/cli": "workspace:*",
24+
"@rancui/linter": "workspace:*",
25+
"eslint": "^8.2.0",
26+
"husky": "^7.0.4",
27+
"lint-staged": "^12.1.2",
28+
"prettier": "^2.5.0",
3529
"pretty-quick": "^3.1.1",
30+
"rimraf": "^3.0.2",
3631
"stylelint": "^13.13.1"
3732
},
3833
"husky": {
@@ -42,12 +37,19 @@
4237
}
4338
},
4439
"lint-staged": {
40+
"*.md": "prettier --write",
4541
"*.{ts,tsx,js,less}": "prettier --write",
4642
"*.{ts,tsx,js}": "eslint --fix",
4743
"*.{css,less}": "stylelint --fix"
4844
},
49-
"dependencies": {
50-
"@rancui/cli": "^1.0.2"
45+
"version": "1.0.14",
46+
"engines": {
47+
"pnpm": ">= 7.0.0"
5148
},
52-
"version": "1.0.14"
53-
}
49+
"packageManager": "pnpm@7.17.1",
50+
"pnpm": {
51+
"overrides": {
52+
"esbuild": "^0.14"
53+
}
54+
}
55+
}

packages/rc-cli/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
2+
root: true,
23
ignorePatterns: ['/.*'],
34
rules: {
45
'@typescript-eslint/no-explicit-any': 0,

packages/rc-cli/bin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/usr/bin/env node
2-
require('./lib/bin');
2+
import './lib/bin.js';

0 commit comments

Comments
 (0)