Skip to content

Commit

Permalink
chore: bump [email protected] (#42)
Browse files Browse the repository at this point in the history
* chore: bump [email protected]

* chore: fix father 4.x compile

* chore: use rc-test

* chore: vercel deploy

---------

Co-authored-by: liangjun.chen <[email protected]>
  • Loading branch information
DBSDs and liangjun.chen authored Dec 8, 2023
1 parent 0553047 commit cd93d80
Show file tree
Hide file tree
Showing 20 changed files with 128 additions and 74 deletions.
21 changes: 21 additions & 0 deletions .dumirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { defineConfig } from 'dumi';
const isGitPagesSite = process.env.GITHUB_ACTIONS;

export default defineConfig({
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
themeConfig: {
name: 'rc-overflow',
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
},
exportStatic: {},
outputPath: 'docs-dist',
base: isGitPagesSite ? `/rc-overflow/` : ``,
publicPath: isGitPagesSite ? `/rc-overflow/` : ``,
styles: [
`
.markdown table {
width: auto !important;
}
`,
],
});
9 changes: 0 additions & 9 deletions .fatherrc.js

This file was deleted.

5 changes: 5 additions & 0 deletions .fatherrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineConfig } from 'father';

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

- uses: actions/setup-node@v1
with:
node-version: '12'
node-version: '18'

- name: cache package-lock.json
uses: actions/cache@v2
Expand All @@ -24,7 +24,7 @@ jobs:
key: lock-${{ github.sha }}

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

- name: hack for singe file
run: |
Expand Down
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.storybook
*.iml
*.log
.idea/
Expand Down Expand Up @@ -29,5 +28,10 @@ yarn.lock
package-lock.json
coverage/
.doc
.umi
dist/
dist/

# dumi
.dumi/tmp
.dumi/tmp-test
.dumi/tmp-production
.env.local
21 changes: 0 additions & 21 deletions .umirc.ts

This file was deleted.

3 changes: 0 additions & 3 deletions docs/demo/base.md

This file was deleted.

8 changes: 8 additions & 0 deletions docs/demo/basic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: basic
nav:
title: Demo
path: /demo
---

<code src="../../examples/basic.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/blink.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## blink
---
title: blink
nav:
title: Demo
path: /demo
---

<code src="../../examples/blink.tsx">
<code src="../../examples/blink.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/fill-width.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## fill-width
---
title: fill-width
nav:
title: Demo
path: /demo
---

<code src="../../examples/fill-width.tsx">
<code src="../../examples/fill-width.tsx"></code>
9 changes: 7 additions & 2 deletions docs/demo/raw-render.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Raw Render
---
title: raw-render
nav:
title: Demo
path: /demo
---

<code src="../../examples/raw-render.tsx">
<code src="../../examples/raw-render.tsx"></code>
6 changes: 4 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: rc-overflow
hero:
title: rc-overflow
description: React Overflow Component
---

<embed src="../README.md" />
<embed src="../README.md" ></embed>
1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = {
setupFiles: ['./tests/setup.js'],
snapshotSerializers: [require.resolve('enzyme-to-json/serializer')],
setupFilesAfterEnv: ['<rootDir>/tests/setupFilesAfterEnv.ts']
};
5 changes: 1 addition & 4 deletions now.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
"builds": [
{
"src": "package.json",
"use": "@now/static-build",
"use": "@vercel/static-build",
"config": { "distDir": "docs-dist" }
}
],
"routes": [
{ "src": "/(.*)", "dest": "/dist/$1" }
]
}
22 changes: 13 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@
"start": "dumi dev",
"docs:build": "dumi build",
"docs:deploy": "gh-pages -d docs-dist",
"compile": "father-build",
"compile": "father build",
"prepare": "dumi setup",
"deploy": "npm run docs:build && npm run docs:deploy",
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
"test": "father test",
"test:coverage": "umi-test --coverage",
"test": "rc-test",
"test:coverage": "rc-test --coverage",
"prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish",
"lint": "eslint src/ --ext .tsx,.ts",
"lint:tsc": "tsc -p tsconfig.json --noEmit",
Expand All @@ -49,28 +50,31 @@
"rc-util": "^5.37.0"
},
"devDependencies": {
"@rc-component/father-plugin": "^1.0.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^12.0.0",
"@types/classnames": "^2.2.9",
"@types/enzyme": "^3.10.8",
"@types/jest": "^26.0.23",
"@types/react": "^16.14.2",
"@types/react-dom": "^16.9.10",
"@umijs/fabric": "^2.0.8",
"@umijs/fabric": "^3.0.0",
"glob": "^10.0.0",
"cross-env": "^7.0.2",
"dumi": "^1.1.10",
"dumi": "^2.0.0",
"enzyme": "^3.0.0",
"enzyme-adapter-react-16": "^1.0.1",
"enzyme-to-json": "^3.4.0",
"eslint": "^7.0.0",
"father": "^2.13.4",
"father-build": "^1.19.1",
"father": "^4.0.0",
"less": "^3.10.3",
"np": "^7.0.0",
"prettier": "^2.0.5",
"rc-test": "^7.0",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"regenerator-runtime": "^0.13.7"
"regenerator-runtime": "^0.13.7",
"typescript": "^5.0.0"
},
"peerDependencies": {
"react": ">=16.9.0",
Expand All @@ -82,4 +86,4 @@
"tnpm": {
"mode": "npm"
}
}
}
34 changes: 34 additions & 0 deletions script/update-content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
用于 dumi 改造使用,
可用于将 examples 的文件批量修改为 demo 引入形式,
其他项目根据具体情况使用。
*/

const fs = require('fs');
const glob = require('glob');

const paths = glob.sync('./examples/*.tsx');

paths.forEach(path => {
const name = path.split('/').pop().split('.')[0];
fs.writeFile(
`./docs/demo/${name}.md`,
`---
title: ${name}
nav:
title: Demo
path: /demo
---
<code src="../../examples/${name}.tsx"></code>
`,
'utf8',
function(error) {
if(error){
console.log(error);
return false;
}
console.log(`${name} 更新成功~`);
}
)
});
18 changes: 8 additions & 10 deletions tests/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,20 @@ Enzyme.configure({ adapter: new Adapter() });

Object.assign(Enzyme.ReactWrapper.prototype, {
triggerResize(clientWidth) {
const target = this.find('ResizeObserver').first()
target.invoke('onResize')({}, { clientWidth })
act(() => {
this.find('ResizeObserver').first().props().onResize({}, { clientWidth });
jest.runAllTimers();
this.update();
});
})
this.update()
},
triggerItemResize(index, offsetWidth) {
const target = this.find('Item').at(index).find('ResizeObserver')
target.invoke('onResize')({ offsetWidth });
act(() => {
this.find('Item')
.at(index)
.find('ResizeObserver')
.props()
.onResize({ offsetWidth });
jest.runAllTimers();
this.update();
});
})
this.update()
},
initSize(width, itemWidth) {
this.triggerResize(width);
Expand Down
1 change: 0 additions & 1 deletion tests/setupFilesAfterEnv.ts

This file was deleted.

3 changes: 2 additions & 1 deletion tests/wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { mount as enzymeMount, ReactWrapper } from 'enzyme';
import type { ReactWrapper } from 'enzyme';
import { mount as enzymeMount } from 'enzyme';

export type MountParam = Parameters<typeof enzymeMount>;

Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"target": "esnext",
"moduleResolution": "node",
"baseUrl": "./",
"jsx": "preserve",
"jsx": "react",
"declaration": true,
"skipLibCheck": true,
"esModuleInterop": true,
"paths": {
"@/*": ["src/*"],
"@@/*": ["src/.umi/*"],
"@@/*": [".dumi/tmp/*"],
"rc-overflow": ["src/index.tsx"]
}
}
Expand Down

0 comments on commit cd93d80

Please sign in to comment.