Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade project #402

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
16 changes: 10 additions & 6 deletions .dumirc.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { defineConfig } from 'dumi';
import path from 'path';

const name = 'cascader'

const isProdSite =
// 不是预览模式 同时是生产环境
process.env.PREVIEW !== 'true' && process.env.NODE_ENV === 'production';

export default defineConfig({
alias: {
'rc-cascader$': path.resolve('src'),
'rc-cascader/es': path.resolve('src'),
},
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
themeConfig: {
name: 'Cascader',
name,
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
},
base: isProdSite ? `/${name}/` : '/',
outputPath: '.doc',
publicPath: isProdSite ? `/${name}/` : '/',
});
5 changes: 1 addition & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
const base = require('@umijs/fabric/dist/eslint');

module.exports = {
...base,
extends: [require.resolve('@umijs/fabric/dist/eslint')],
rules: {
...base.rules,
'no-template-curly-in-string': 0,
'prefer-promise-reject-errors': 0,
'react/no-array-index-key': 0,
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/site-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy website
on:
push:
tags:
- '*'
workflow_dispatch:

permissions:
contents: write

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3

- name: setup node
uses: actions/setup-node@v1
with:
node-version: 16

- name: create package-lock.json
run: npm i --package-lock-only --ignore-scripts

- name: Install dependencies
run: npm ci

- name: build Docs
run: npm run docs:build

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./.doc
force_orphan: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
4 changes: 2 additions & 2 deletions now.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
{
"src": "package.json",
"use": "@now/static-build",
"config": { "distDir": "dist" }
"config": { "distDir": ".doc" }
}
],
"routes": [
{ "src": "/(.*)", "dest": "/dist/$1" }
{ "src": "/(.*)", "dest": "/.doc/$1" }
]
}
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@
"module": "./es/index",
"scripts": {
"start": "dumi dev",
"build": "dumi build",
"deploy": "UMI_ENV=gh npm run build && gh-pages -d .doc",
"docs:build": "dumi build",
"docs:deploy": "gh-pages -d .doc",
"docs:preview": "PREVIEW=true npm run docs:build",
"compile": "father build",
"prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish",
"lint": "eslint src/ examples/ --ext .tsx,.ts,.jsx,.jsx",
"gh-pages": "npm run docs:build",
"prepublishOnly": "npm run compile && np --yolo --no-publish",
"postpublish": "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",
"now-build": "npm run build"
"coverage": "rc-test --coverage"
},
"devDependencies": {
"@rc-component/father-plugin": "^1.0.0",
Expand Down
12 changes: 3 additions & 9 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,9 @@
"skipLibCheck": true,
"esModuleInterop": true,
"paths": {
"@/*": [
"src/*"
],
"@@/*": [
"src/.umi/*"
],
"rc-cascader": [
"src/index.ts"
]
"@/*": ["src/*"],
"@@/*": [".dumi/tmp/*"],
"rc-cascader": ["src/index.ts"]
}
}
}