From 52f8f15f3e61f575a244f1797112e7f94c0a9f08 Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Tue, 20 Sep 2022 16:36:46 +0800 Subject: [PATCH 1/2] build: migrate to father4 --- .fatherrc.js | 11 ----------- .fatherrc.ts | 10 ++++++++++ .husky/pre-commit | 4 ++++ package.json | 20 ++++++++++++++++---- 4 files changed, 30 insertions(+), 15 deletions(-) delete mode 100644 .fatherrc.js create mode 100644 .fatherrc.ts create mode 100755 .husky/pre-commit diff --git a/.fatherrc.js b/.fatherrc.js deleted file mode 100644 index 0bcee6c..0000000 --- a/.fatherrc.js +++ /dev/null @@ -1,11 +0,0 @@ -export default { - entry: ['src/index.js'], - cjs: 'babel', - esm: { type: 'babel', importLibToEs: true }, - doc: { base: '/switch' }, - preCommit: { - eslint: true, - prettier: true, - }, - runtimeHelpers: true, -}; diff --git a/.fatherrc.ts b/.fatherrc.ts new file mode 100644 index 0000000..7414da0 --- /dev/null +++ b/.fatherrc.ts @@ -0,0 +1,10 @@ +import { defineConfig } from 'father'; + +export default defineConfig({ + platform: 'browser', + cjs: { output: 'lib' }, + esm: { + output: 'es', + alias: { 'rc-util/lib': 'rc-util/es' }, + }, +}); diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..7d0de5d --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +lint-staged diff --git a/package.json b/package.json index a8ea943..04cd659 100644 --- a/package.json +++ b/package.json @@ -31,9 +31,18 @@ "compile": "father build && lessc assets/index.less assets/index.css", "gh-pages": "npm run docs:build && npm run docs:deploy", "prepublishOnly": "npm run compile && np --yolo --no-publish", + "postpublish": "npm run gh-pages", "lint": "eslint .", - "test": "father test", - "coverage": "father test --coverage" + "lint-staged": "lint-staged", + "test": "umi-test", + "coverage": "father test --coverage", + "prepare": "husky install" + }, + "lint-staged": { + "**/*.{js,jsx,tsx,ts,md,json}": [ + "prettier --write", + "git add" + ] }, "devDependencies": { "@types/classnames": "^2.2.10", @@ -44,12 +53,15 @@ "enzyme-adapter-react-16": "^1.0.1", "enzyme-to-json": "^3.0.0", "eslint": "^7.0.0", - "father": "^2.13.4", + "father": "^4.0.0", + "husky": "^8.0.1", "less": "^3.11.1", + "lint-staged": "^13.0.3", "np": "^7.1.0", "react": "^16.0.0", "react-dom": "^16.0.0", - "react-test-renderer": "^16.0.0" + "react-test-renderer": "^16.0.0", + "umi-test": "^1.9.7" }, "peerDependencies": { "react": ">=16.9.0", From 6acd88d2adf067a3813527691d0e7dea4bac3571 Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Tue, 20 Sep 2022 16:45:48 +0800 Subject: [PATCH 2/2] test: add fabric --- .eslintignore | 5 ++++- package.json | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.eslintignore b/.eslintignore index 82a9a73..19ff8b1 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,4 @@ -.eslintrc.js \ No newline at end of file +.eslintrc.js +es/ +lib/ +.doc/ \ No newline at end of file diff --git a/package.json b/package.json index 04cd659..93ad755 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "devDependencies": { "@types/classnames": "^2.2.10", "@types/jest": "^26.0.4", + "@umijs/fabric": "^3.0.0", "coveralls": "^3.0.6", "dumi": "^1.1.0", "enzyme": "^3.0.0",