Skip to content

Commit

Permalink
feat: 重构
Browse files Browse the repository at this point in the history
  • Loading branch information
fjc0k committed Nov 20, 2020
1 parent d3758b4 commit c085c08
Show file tree
Hide file tree
Showing 37 changed files with 273 additions and 321 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Thumbs.db
node_modules
*.tsbuildinfo
*.log*
/lib
/lib*
/dist
/coverage
/docs
31 changes: 31 additions & 0 deletions haoma-compile.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { getCompileConfig } from 'haoma'

export default [
getCompileConfig({
name: 'esm',
inputFiles: ['src/**/*.ts', '!**/*.test.*', '!**/_*'],
module: 'esm',
target: 'browser',
outDir: 'lib',
rollupDts: true,
rollupDtsFiles: ['**/index.d.ts'],
rollupDtsIncludedPackages: ['type-fest', 'ts-essentials'],
}),
getCompileConfig({
name: 'cjs',
inputFiles: ['lib/**/*.js'],
module: 'cjs',
target: 'browser',
outDir: 'lib/_cjs',
renameImport: [
{
original: 'yup/es(.*)$',
replacement: 'yup/lib$1',
},
{
original: 'date\\-fns/esm(.*)$',
replacement: 'date-fns$1',
},
],
}),
]
22 changes: 7 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,9 @@
"require": "./_cjs/react/index.js",
"import": "./react/index.js"
},
"./taro": {
"require": "./_cjs/taro/index.js",
"import": "./taro/index.js"
},
"./types": {
"require": "./_cjs/types/index.js",
"import": "./types/index.js"
"require": "./_cjs/types/index.d.ts",
"import": "./types/index.d.ts"
},
"./utils": {
"require": "./_cjs/utils/index.js",
Expand All @@ -61,9 +57,7 @@
"module": "utils/index.js",
"types": "utils/index.d.ts",
"scripts": {
"build": "shx rm -rf ./lib && npm run generate-index && npm run build-esm && npm run build-cjs && npm run generate-package && npm run generate-docs",
"build-cjs": "tsc -p tsconfig.build-cjs.json && haoma run ./scripts/fixCJSBuild.ts",
"build-esm": "tsc -p tsconfig.build-esm.json && haoma run ./scripts/fixTypesBuild.ts",
"build": "haoma compile && npm run generate-package && npm run generate-docs",
"generate-docs": "haoma run ./scripts/generateDocs.ts",
"generate-index": "vgis './src/**/index.ts'",
"generate-package": "haoma run ./scripts/generatePackage.ts",
Expand All @@ -75,7 +69,7 @@
"postrelease": "git push --follow-tags origin master",
"release-beta": "npm run release -- --release-as patch --prerelease beta",
"release-major": "npm run release -- --release-as major",
"release-major-beta": "npm run release -- --release-as major --prerelease beta",
"release-major-beta": "npm run release -- --release-as major --prerelease beta --dry-run",
"test": "npm run test-types && jest",
"test-types": "tsc --noEmit",
"test-update-snapshot": "jest --updateSnapshot",
Expand All @@ -98,13 +92,11 @@
]
},
"dependencies": {
"@types/lodash-es": "^4.17.3",
"@babel/runtime": "^7.12.5",
"date-fns": "^2.14.0",
"lodash": "^4.17.15",
"lodash-es": "^4.17.15",
"lodash-uni": "^1.1.0",
"miniprogram-api-typings": "^3.0.0",
"react-use": "^15.1.1",
"tslib": "^2.0.0",
"yup": "^0.29.1"
},
"devDependencies": {
Expand All @@ -124,7 +116,7 @@
"execa": "4.1.0",
"fs-extra": "9.0.1",
"globby": "11.0.1",
"haoma": "2.17.1",
"haoma": "2.19.0",
"husky": "4.3.0",
"jest": "26.6.3",
"lint-staged": "10.5.1",
Expand Down
Loading

0 comments on commit c085c08

Please sign in to comment.