From 651dc894042b3070c37cf58f055c6750dd67cd36 Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Thu, 26 Oct 2023 14:05:27 +0800 Subject: [PATCH 1/3] chore: bump father@4 --- .fatherrc.js | 14 +++++--------- .github/workflows/main.yml | 4 ++-- .husky/pre-commit | 4 ++++ package.json | 23 ++++++++++++++++------- tsconfig.json | 2 +- 5 files changed, 28 insertions(+), 19 deletions(-) create mode 100755 .husky/pre-commit diff --git a/.fatherrc.js b/.fatherrc.js index 912aa0aa..96268ae1 100644 --- a/.fatherrc.js +++ b/.fatherrc.js @@ -1,9 +1,5 @@ -export default { - cjs: 'babel', - esm: { type: 'babel', importLibToEs: true }, - preCommit: { - eslint: true, - prettier: true, - }, - runtimeHelpers: true, -}; +import { defineConfig } from 'father'; + +export default defineConfig({ + plugins: ['@rc-component/father-plugin'], +}); diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 656403a1..dbee7374 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/setup-node@v1 with: - node-version: '12' + node-version: '18' - name: cache package-lock.json uses: actions/cache@v2 @@ -24,7 +24,7 @@ jobs: key: lock-${{ github.sha }} - name: create package-lock.json - run: npm i --package-lock-only + run: npm i --package-lock-only --ignore-scripts - name: hack for singe file run: | diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..d24fdfc6 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npx lint-staged diff --git a/package.json b/package.json index 2b180c84..3b82df80 100644 --- a/package.json +++ b/package.json @@ -39,9 +39,10 @@ "lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md", "prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"", "pretty-quick": "pretty-quick", - "test": "father test", + "test": "rc-test", "coverage": "father test --coverage", - "now-build": "npm run docs:build" + "now-build": "npm run docs:build", + "prepare": "husky install" }, "dependencies": { "@babel/runtime": "^7.10.1", @@ -49,6 +50,7 @@ "rc-util": "^5.32.2" }, "devDependencies": { + "@rc-component/father-plugin": "^1.0.0", "@types/classnames": "^2.2.9", "@types/jest": "^29.2.2", "@types/keyv": "^3.1.4", @@ -59,20 +61,21 @@ "cross-env": "^7.0.0", "dumi": "^2.1.2", "enzyme": "^3.0.0", - "enzyme-adapter-react-16": "^1.0.1", + "enzyme-adapter-react-16": "^1.15.6", "enzyme-to-json": "^3.4.0", "eslint": "^7.0.0", - "father": "^2.13.4", + "father": "^4.0.0", "gh-pages": "^4.0.0", "glob": "^7.1.6", + "husky": "^8.0.3", "less": "^3.10.3", + "lint-staged": "^15.0.2", "np": "^7.0.0", "prettier": "^2.0.1", - "pretty-quick": "^3.0.0", "rc-select": "^14.1.2", + "rc-test": "^7.0.15", "react": "^16.0.0", - "react-dom": "^16.0.0", - "react-test-renderer": "^16.0.0" + "react-dom": "^16.0.0" }, "peerDependencies": { "react": ">=16.9.0", @@ -83,5 +86,11 @@ }, "tnpm": { "mode": "npm" + }, + "lint-staged": { + "**/*.{js,jsx,tsx,ts,md,json}": [ + "prettier --write", + "git add" + ] } } diff --git a/tsconfig.json b/tsconfig.json index ff1177a7..bd88b1a3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "target": "esnext", "moduleResolution": "node", "baseUrl": "./", - "jsx": "preserve", + "jsx": "react", "declaration": true, "skipLibCheck": true, "esModuleInterop": true, From 5fa9c5e247a94f885ef517a19f222863dfea6621 Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Thu, 26 Oct 2023 14:06:29 +0800 Subject: [PATCH 2/3] chore: code clean --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 3b82df80..c70a4810 100644 --- a/package.json +++ b/package.json @@ -38,9 +38,8 @@ "prepublishOnly": "npm run compile && np --yolo --no-publish && npm run gh-pages", "lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md", "prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"", - "pretty-quick": "pretty-quick", "test": "rc-test", - "coverage": "father test --coverage", + "coverage": "rc-test --coverage", "now-build": "npm run docs:build", "prepare": "husky install" }, From 84e5a10a48667732d0985c47ed060d262b0d835a Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Thu, 26 Oct 2023 14:13:52 +0800 Subject: [PATCH 3/3] chore: update test case --- tests/two-pagination.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/two-pagination.jsx b/tests/two-pagination.jsx index 14dca6bd..19094ad0 100644 --- a/tests/two-pagination.jsx +++ b/tests/two-pagination.jsx @@ -1,6 +1,6 @@ -import 'rc-select/assets/index.less'; -import React from 'react'; +// import 'rc-select/assets/index.less'; import Select from 'rc-select'; +import React from 'react'; import Pagination from '../src'; class Hello extends React.Component {