Skip to content

Commit

Permalink
test: fix ci (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 authored Aug 13, 2024
1 parent 61fcf9d commit 6907846
Show file tree
Hide file tree
Showing 15 changed files with 25,468 additions and 633 deletions.
18 changes: 6 additions & 12 deletions .dumirc.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
// more config: https://d.umijs.org/config
import { defineConfig } from 'dumi';

const basePath = process.env.GH_PAGES ? '/footer/' : '/';
const publicPath = process.env.GH_PAGES ? '/footer/' : '/';

export default defineConfig({
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
themeConfig: {
name: 'rc-footer',
name: 'Footer',
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
},
outputPath: '.doc',
exportStatic: {},
base: '/footer/',
publicPath: '/footer/',
hash: true,
styles: [
`
.markdown table {
width: auto !important;
}
`,
],
base: basePath,
publicPath,
});
4 changes: 2 additions & 2 deletions .fatherrc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from "father";
import { defineConfig } from 'father';

export default defineConfig({
plugins: ["@rc-component/father-plugin"],
plugins: ['@rc-component/father-plugin'],
});
9 changes: 6 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: '20'
node-version: 20

- name: cache package-lock.json
uses: actions/cache@v4
Expand Down Expand Up @@ -59,7 +59,10 @@ jobs:
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

- name: lint
run: npm run lint
run: npm run lint && npm run type:check

- name: type check
run: npm run type:check

needs: setup

Expand Down Expand Up @@ -105,7 +108,7 @@ jobs:
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

- name: coverage
run: npm run coverage
run: npm test -- --coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down
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 pretty-quick --staged
4 changes: 2 additions & 2 deletions docs/examples/theme.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import '../../assets/index.less';
import React, { useState } from 'react';
import Footer from 'rc-footer';
import Footer, { type FooterProps } from 'rc-footer';

export default function App() {
const [theme, setTheme] = useState('light');
const [theme, setTheme] = useState<FooterProps['theme']>('light');
return (
<div>
<Footer
Expand Down
3 changes: 0 additions & 3 deletions jest.config.js

This file was deleted.

15 changes: 15 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { createConfig, type Config } from '@umijs/test';

const defaultConfig = createConfig({
target: 'browser',
});

const config: Config.InitialOptions = {
...defaultConfig,
setupFilesAfterEnv: [
...(defaultConfig.setupFilesAfterEnv || []),
'./tests/setupFilesAfterEnv.ts',
],
};

export default config;
64 changes: 31 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,51 +30,49 @@
"license": "MIT",
"scripts": {
"start": "dumi dev",
"type:check": "tsc --noEmit",
"docs:build": "dumi build",
"docs:deploy": "gh-pages -d .doc",
"compile": "father build && lessc assets/index.less assets/index.css",
"prepare": "husky install && dumi setup",
"gh-pages": "npm run docs:build && father doc deploy",
"gh-pages": "GH_PAGES=1 npm run docs:build && npm run docs:deploy",
"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": "rc-test --coverage"
"test": "jest",
"coverage": "jest --coverage",
"prepare": "husky install"
},
"dependencies": {
"@babel/runtime": "^7.11.1",
"classnames": "^2.2.1"
"@babel/runtime": "^7.25.0",
"classnames": "^2.5.1"
},
"devDependencies": {
"@rc-component/father-plugin": "^1.0.0",
"@types/classnames": "^2.2.9",
"@types/react": "^17.0.13",
"@types/react-dom": "^16.9.0",
"@umijs/fabric": "^2.0.8",
"coveralls": "^3.0.6",
"cross-env": "^7.0.2",
"dumi": "^2.0.0",
"enzyme": "^3.0.0",
"enzyme-adapter-react-16": "^1.15.6",
"enzyme-to-json": "^3.4.0",
"eslint": "^7.0.0",
"father": "^4.0.0",
"gh-pages": "^3.1.0",
"glob": "^10.0.0",
"@rc-component/father-plugin": "^1.0.3",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^14.3.1",
"@types/classnames": "^2.3.1",
"@types/jest": "^29.5.12",
"@types/node": "^22.2.0",
"@types/react": "^17.0.80",
"@types/react-dom": "^16.9.24",
"@umijs/fabric": "^4.0.0",
"@umijs/test": "^4.3.12",
"dumi": "^2.4.7",
"eslint": "^8.57.0",
"father": "^4.5.0",
"gh-pages": "^3.2.3",
"husky": "^8.0.3",
"less": "^3.10.3",
"np": "^7.0.0",
"prettier": "^2.0.5",
"pretty-quick": "^3.0.0",
"rc-test": "^7.0.15",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"typescript": "^5.0.0"
},
"peerDependencies": {
"react": ">=16.0.0",
"react-dom": ">=16.0.0"
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"less": "^4.2.0",
"np": "^7.7.0",
"prettier": "^3.3.3",
"pretty-quick": "^4.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
},
"husky": {
"hooks": {
Expand Down
Loading

0 comments on commit 6907846

Please sign in to comment.