Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .dumirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { defineConfig } from 'dumi';
import path from 'path';

let base: string | undefined;
let publicPath: string | undefined;

// Github Pages 部署时需要更换为自己的仓库名
if (process.env.NODE_ENV === 'production' && process.env.PREVIEW !== '1') {
base = '/react-ui-library-tutorial';
publicPath = '/react-ui-library-tutorial/';
}

export default defineConfig({
base,
publicPath,
title: 'Happy UI',
outputPath: 'doc-site',
resolve: {
docDirs: ['docs'],
atomDirs: [{ type: 'component', dir: 'src' }],
},
exportStatic: {},
forkTSChecker: {},
extraBabelPlugins: [
[
'import',
{
libraryName: '@zzzzw/happy-ui',
libraryDirectory: '',
customStyleName: (name) => path.resolve(__dirname, `src/${name}/style/index.ts`),
},
],
],
});
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
template/
*.js
**/demo/
**/__tests__/
scripts/
5 changes: 3 additions & 2 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ jobs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- run: yarn
- run: yarn build:site
- run: npm i pnpm -g
- run: pnpm install
- run: pnpm build:site
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
/doc-site
/types

# umi
# dumi
.dumi/tmp
.dumi/tmp-test
.dumi/tmp-production
.umi
.umi-production
.env.local


# misc
.DS_Store
.env.local
Expand Down
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
8 changes: 8 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@ const fabric = require('@umijs/fabric');

module.exports = {
...fabric.prettier,
plugins: [
require.resolve('prettier-plugin-packagejson'),
require.resolve('@trivago/prettier-plugin-sort-imports'),
],
importOrder: ['^react', '<THIRD_PARTY_MODULES>', '^@.*', '^./(.*)', '^../(.*)'],
importOrderSeparation: true,
importOrderSortSpecifiers: true,
importOrderCaseInsensitive: true,
};
1 change: 1 addition & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
extends: [require.resolve('@umijs/fabric/dist/stylelint')],
rules: {},
};
21 changes: 0 additions & 21 deletions .umirc.ts

This file was deleted.

8 changes: 0 additions & 8 deletions docs/help.md

This file was deleted.

123 changes: 60 additions & 63 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,80 +2,63 @@
"name": "@zzzzw/happy-ui",
"version": "1.1.0",
"description": "A React UI Library.",
"keywords": [],
"homepage": "https://github.com/worldzhao/react-ui-library-tutorial#readme",
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
"bugs": {
"url": "https://github.com/worldzhao/react-ui-library-tutorial/issues"
},
"typings": "lib/index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/worldzhao/react-ui-library-tutorial.git"
},
"license": "ISC",
"main": "lib/index.js",
"module": "esm/index.js",
"authors": {
"name": "worldzhao",
"email": "1007326924@qq.com"
},
"typings": "lib/index.d.ts",
"files": [
"lib",
"esm"
],
"scripts": {
"dev": "dumi dev",
"start": "npm run dev",
"build:site": "rimraf doc-site && dumi build",
"preview:site": "cross-env SITE_BUILD_ENV=PREVIEW npm run build:site && serve doc-site",
"deploy:site": "npm run build:site && gh-pages -d doc-site",
"clean": "rimraf lib esm dist",
"build:types": "tsc -p tsconfig.build.json && cpr lib esm",
"build": "npm run clean && npm run build:types && gulp",
"build:site": "dumi build",
"build:types": "tsc -p tsconfig.build.json && cpr lib esm",
"clean": "rimraf lib esm dist .dumi doc-site",
"commit": "cz",
"deploy:site": "npm run build:site && gh-pages -d doc-site",
"dev": "npm start",
"new": "plop --plopfile ./scripts/plopfile.ts",
"postnew": "prettier --write src/**/*{ts,tsx} --loglevel silent",
"prepare": "husky install && dumi setup",
"prepublishOnly": "npm run build",
"preview": "cross-env PREVIEW=1 npm run build:site && cross-env PREVIEW=1 dumi preview",
"release": "np --no-cleanup --no-tests --any-branch",
"commit": "git-cz",
"start": "dumi dev",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"test:update": "jest --updateSnapshot",
"new": "plop --plopfile ./scripts/plopfile.ts",
"postnew": "prettier --write src/**/*{ts,tsx} --loglevel silent"
},
"repository": {
"type": "git",
"url": "git+https://github.com/worldzhao/react-ui-library-tutorial.git"
},
"keywords": [],
"license": "ISC",
"bugs": {
"url": "https://github.com/worldzhao/react-ui-library-tutorial/issues"
"test:watch": "jest --watch"
},
"lint-staged": {
"src/**/*.ts?(x)": [
"*.ts?(x)": [
"prettier --write",
"eslint --fix",
"jest --bail --findRelatedTests",
"git add"
"jest --bail --findRelatedTests"
],
"*.less": [
"stylelint --syntax less --fix"
],
"src/**/*.less": [
"stylelint --syntax less --fix",
"git add"
"*.{md,html,json}": [
"prettier --write"
]
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "lint-staged"
}
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"peerDependencies": {
"react": "^16.8.0",
"react-dom": "^16.8.0"
},
"dependencies": {
"@babel/runtime": "^7",
"prop-types": "^15.7.2"
"@babel/runtime": "^7"
},
"devDependencies": {
"@babel/core": "^7.7.7",
Expand All @@ -85,46 +68,60 @@
"@babel/preset-env": "^7.7.7",
"@babel/preset-react": "^7.7.4",
"@babel/preset-typescript": "^7.7.7",
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@commitlint/cli": "^17.3.0",
"@commitlint/config-conventional": "^17.3.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^12.1.4",
"@testing-library/user-event": "^13.5.0",
"@trivago/prettier-plugin-sort-imports": "^3.2.0",
"@types/jest": "^27.4.1",
"@types/node": "^16.11.26",
"@types/react-dom": "^16.8.0",
"@types/react": "^16.8.0",
"@typescript-eslint/parser": "^1.9.0",
"@umijs/fabric": "^1.2.12",
"@types/react-dom": "^16.8.0",
"@umijs/fabric": "^3",
"babel-plugin-import": "^1.13.3",
"commitizen": "^4.0.3",
"commitizen": "^4.2.5",
"core-js": "^3.26.1",
"cpr": "^3.0.1",
"cross-env": "^7.0.3",
"cz-conventional-changelog": "^3.0.2",
"cz-conventional-changelog": "^3.3.0",
"doctoc": "^1.4.0",
"dumi": "^1.0.13",
"dumi": "^2.0.6",
"eslint": "^7",
"gh-pages": "^3.2.3",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^7.0.1",
"gulp-babel": "^8.0.0",
"gulp-cssnano": "^2.1.3",
"gulp-less": "^4.0.1",
"gulp": "^4.0.2",
"husky": "^3.1.0",
"husky": "^8",
"identity-obj-proxy": "^3.0.0",
"jest": "^24.9.0",
"less": "^3.10.3",
"lint-staged": "^9.5.0",
"lint-staged": "^13",
"np": "^7.5.0",
"plop": "^2.6.0",
"prettier": "^2",
"react-dom": "^16.8.0",
"plop": "^2",
"prettier": "^2.8.0",
"prettier-plugin-packagejson": "^2.3.0",
"react": "^16.8.0",
"react-dom": "^16.8.0",
"rimraf": "^3.0.0",
"serve": "^13",
"snapshot-diff": "^0.6.1",
"through2": "^3.0.1",
"ts-jest": "^24.2.0",
"ts-node": "^8.10.1",
"typescript": "^4"
"ts-node": "^10.9.1",
"typescript": "^4.9.3"
},
"peerDependencies": {
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"authors": {
"name": "worldzhao",
"email": "1007326924@qq.com"
}
}
Loading