Skip to content

Commit ab18fa8

Browse files
authored
Merge pull request #28 from worldzhao/chore/update-deps
chore: update dumi version and lint tools version
2 parents 4f4d462 + a2ace10 commit ab18fa8

17 files changed

+10089
-5198
lines changed

.dumirc.ts

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { defineConfig } from 'dumi';
2+
import path from 'path';
3+
4+
let base: string | undefined;
5+
let publicPath: string | undefined;
6+
7+
// Github Pages 部署时需要更换为自己的仓库名
8+
if (process.env.NODE_ENV === 'production' && process.env.PREVIEW !== '1') {
9+
base = '/react-ui-library-tutorial';
10+
publicPath = '/react-ui-library-tutorial/';
11+
}
12+
13+
export default defineConfig({
14+
base,
15+
publicPath,
16+
title: 'Happy UI',
17+
outputPath: 'doc-site',
18+
resolve: {
19+
docDirs: ['docs'],
20+
atomDirs: [{ type: 'component', dir: 'src' }],
21+
},
22+
exportStatic: {},
23+
forkTSChecker: {},
24+
extraBabelPlugins: [
25+
[
26+
'import',
27+
{
28+
libraryName: '@zzzzw/happy-ui',
29+
libraryDirectory: '',
30+
customStyleName: (name) => path.resolve(__dirname, `src/${name}/style/index.ts`),
31+
},
32+
],
33+
],
34+
});

.eslintignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
template/
22
*.js
3-
**/demo/
43
**/__tests__/
4+
scripts/

.github/workflows/gh-pages.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ jobs:
1010
runs-on: ubuntu-18.04
1111
steps:
1212
- uses: actions/checkout@v2
13-
- run: yarn
14-
- run: yarn build:site
13+
- run: npm i pnpm -g
14+
- run: pnpm install
15+
- run: pnpm build:site
1516
- name: Deploy
1617
uses: peaceiris/actions-gh-pages@v3
1718
with:

.gitignore

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
/doc-site
2020
/types
2121

22-
# umi
22+
# dumi
23+
.dumi/tmp
24+
.dumi/tmp-test
25+
.dumi/tmp-production
2326
.umi
2427
.umi-production
2528
.env.local
2629

27-
2830
# misc
2931
.DS_Store
3032
.env.local

.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+
npx commitlint --edit $1

.husky/pre-commit

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

.prettierrc.js

+8
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,12 @@ const fabric = require('@umijs/fabric');
22

33
module.exports = {
44
...fabric.prettier,
5+
plugins: [
6+
require.resolve('prettier-plugin-packagejson'),
7+
require.resolve('@trivago/prettier-plugin-sort-imports'),
8+
],
9+
importOrder: ['^react', '<THIRD_PARTY_MODULES>', '^@.*', '^./(.*)', '^../(.*)'],
10+
importOrderSeparation: true,
11+
importOrderSortSpecifiers: true,
12+
importOrderCaseInsensitive: true,
513
};

.stylelintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
module.exports = {
22
extends: [require.resolve('@umijs/fabric/dist/stylelint')],
3+
rules: {},
34
};

.umirc.ts

-21
This file was deleted.

docs/help.md

-8
This file was deleted.

package.json

+60-63
Original file line numberDiff line numberDiff line change
@@ -2,80 +2,63 @@
22
"name": "@zzzzw/happy-ui",
33
"version": "1.1.0",
44
"description": "A React UI Library.",
5+
"keywords": [],
56
"homepage": "https://github.com/worldzhao/react-ui-library-tutorial#readme",
6-
"publishConfig": {
7-
"access": "public",
8-
"registry": "https://registry.npmjs.org/"
7+
"bugs": {
8+
"url": "https://github.com/worldzhao/react-ui-library-tutorial/issues"
99
},
10-
"typings": "lib/index.d.ts",
10+
"repository": {
11+
"type": "git",
12+
"url": "git+https://github.com/worldzhao/react-ui-library-tutorial.git"
13+
},
14+
"license": "ISC",
1115
"main": "lib/index.js",
1216
"module": "esm/index.js",
13-
"authors": {
14-
"name": "worldzhao",
15-
"email": "[email protected]"
16-
},
17+
"typings": "lib/index.d.ts",
1718
"files": [
1819
"lib",
1920
"esm"
2021
],
2122
"scripts": {
22-
"dev": "dumi dev",
23-
"start": "npm run dev",
24-
"build:site": "rimraf doc-site && dumi build",
25-
"preview:site": "cross-env SITE_BUILD_ENV=PREVIEW npm run build:site && serve doc-site",
26-
"deploy:site": "npm run build:site && gh-pages -d doc-site",
27-
"clean": "rimraf lib esm dist",
28-
"build:types": "tsc -p tsconfig.build.json && cpr lib esm",
2923
"build": "npm run clean && npm run build:types && gulp",
24+
"build:site": "dumi build",
25+
"build:types": "tsc -p tsconfig.build.json && cpr lib esm",
26+
"clean": "rimraf lib esm dist .dumi doc-site",
27+
"commit": "cz",
28+
"deploy:site": "npm run build:site && gh-pages -d doc-site",
29+
"dev": "npm start",
30+
"new": "plop --plopfile ./scripts/plopfile.ts",
31+
"postnew": "prettier --write src/**/*{ts,tsx} --loglevel silent",
32+
"prepare": "husky install && dumi setup",
3033
"prepublishOnly": "npm run build",
34+
"preview": "cross-env PREVIEW=1 npm run build:site && cross-env PREVIEW=1 dumi preview",
3135
"release": "np --no-cleanup --no-tests --any-branch",
32-
"commit": "git-cz",
36+
"start": "dumi dev",
3337
"test": "jest",
34-
"test:watch": "jest --watch",
3538
"test:coverage": "jest --coverage",
3639
"test:update": "jest --updateSnapshot",
37-
"new": "plop --plopfile ./scripts/plopfile.ts",
38-
"postnew": "prettier --write src/**/*{ts,tsx} --loglevel silent"
39-
},
40-
"repository": {
41-
"type": "git",
42-
"url": "git+https://github.com/worldzhao/react-ui-library-tutorial.git"
43-
},
44-
"keywords": [],
45-
"license": "ISC",
46-
"bugs": {
47-
"url": "https://github.com/worldzhao/react-ui-library-tutorial/issues"
40+
"test:watch": "jest --watch"
4841
},
4942
"lint-staged": {
50-
"src/**/*.ts?(x)": [
43+
"*.ts?(x)": [
5144
"prettier --write",
5245
"eslint --fix",
53-
"jest --bail --findRelatedTests",
54-
"git add"
46+
"jest --bail --findRelatedTests"
47+
],
48+
"*.less": [
49+
"stylelint --syntax less --fix"
5550
],
56-
"src/**/*.less": [
57-
"stylelint --syntax less --fix",
58-
"git add"
51+
"*.{md,html,json}": [
52+
"prettier --write"
5953
]
6054
},
61-
"husky": {
62-
"hooks": {
63-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
64-
"pre-commit": "lint-staged"
65-
}
66-
},
6755
"config": {
6856
"commitizen": {
6957
"path": "cz-conventional-changelog"
7058
}
7159
},
72-
"peerDependencies": {
73-
"react": "^16.8.0",
74-
"react-dom": "^16.8.0"
75-
},
7660
"dependencies": {
77-
"@babel/runtime": "^7",
78-
"prop-types": "^15.7.2"
61+
"@babel/runtime": "^7"
7962
},
8063
"devDependencies": {
8164
"@babel/core": "^7.7.7",
@@ -85,46 +68,60 @@
8568
"@babel/preset-env": "^7.7.7",
8669
"@babel/preset-react": "^7.7.4",
8770
"@babel/preset-typescript": "^7.7.7",
88-
"@commitlint/cli": "^8.2.0",
89-
"@commitlint/config-conventional": "^8.2.0",
71+
"@commitlint/cli": "^17.3.0",
72+
"@commitlint/config-conventional": "^17.3.0",
9073
"@testing-library/jest-dom": "^5.16.4",
9174
"@testing-library/react": "^12.1.4",
9275
"@testing-library/user-event": "^13.5.0",
76+
"@trivago/prettier-plugin-sort-imports": "^3.2.0",
9377
"@types/jest": "^27.4.1",
9478
"@types/node": "^16.11.26",
95-
"@types/react-dom": "^16.8.0",
9679
"@types/react": "^16.8.0",
97-
"@typescript-eslint/parser": "^1.9.0",
98-
"@umijs/fabric": "^1.2.12",
80+
"@types/react-dom": "^16.8.0",
81+
"@umijs/fabric": "^3",
9982
"babel-plugin-import": "^1.13.3",
100-
"commitizen": "^4.0.3",
83+
"commitizen": "^4.2.5",
84+
"core-js": "^3.26.1",
10185
"cpr": "^3.0.1",
10286
"cross-env": "^7.0.3",
103-
"cz-conventional-changelog": "^3.0.2",
87+
"cz-conventional-changelog": "^3.3.0",
10488
"doctoc": "^1.4.0",
105-
"dumi": "^1.0.13",
89+
"dumi": "^2.0.6",
90+
"eslint": "^7",
10691
"gh-pages": "^3.2.3",
92+
"gulp": "^4.0.2",
10793
"gulp-autoprefixer": "^7.0.1",
10894
"gulp-babel": "^8.0.0",
10995
"gulp-cssnano": "^2.1.3",
11096
"gulp-less": "^4.0.1",
111-
"gulp": "^4.0.2",
112-
"husky": "^3.1.0",
97+
"husky": "^8",
11398
"identity-obj-proxy": "^3.0.0",
11499
"jest": "^24.9.0",
115100
"less": "^3.10.3",
116-
"lint-staged": "^9.5.0",
101+
"lint-staged": "^13",
117102
"np": "^7.5.0",
118-
"plop": "^2.6.0",
119-
"prettier": "^2",
120-
"react-dom": "^16.8.0",
103+
"plop": "^2",
104+
"prettier": "^2.8.0",
105+
"prettier-plugin-packagejson": "^2.3.0",
121106
"react": "^16.8.0",
107+
"react-dom": "^16.8.0",
122108
"rimraf": "^3.0.0",
123-
"serve": "^13",
124109
"snapshot-diff": "^0.6.1",
125110
"through2": "^3.0.1",
126111
"ts-jest": "^24.2.0",
127-
"ts-node": "^8.10.1",
128-
"typescript": "^4"
112+
"ts-node": "^10.9.1",
113+
"typescript": "^4.9.3"
114+
},
115+
"peerDependencies": {
116+
"react": ">=16.8.0",
117+
"react-dom": ">=16.8.0"
118+
},
119+
"publishConfig": {
120+
"access": "public",
121+
"registry": "https://registry.npmjs.org/"
122+
},
123+
"authors": {
124+
"name": "worldzhao",
125+
"email": "[email protected]"
129126
}
130127
}

0 commit comments

Comments
 (0)