Skip to content

Commit

Permalink
ci: fix ci (ant-design#569)
Browse files Browse the repository at this point in the history
* ci: upgrade ts v4 for icon-svg

* ci: lock webpack-iconfont-plugin-nodejs version for icon-react-native

* fix: @types/react-native version

* feat: use father and remove rc-tools

* chore: clean

* fix: upgrade jest
  • Loading branch information
vagusX committed May 13, 2023
1 parent 9960401 commit 5c05aae
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 73 deletions.
14 changes: 14 additions & 0 deletions packages/icons-react-native/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
extends: [require.resolve('@umijs/fabric/dist/eslint')],
rules: {
'default-case': 0,
'import/no-extraneous-dependencies': 0,
'react-hooks/exhaustive-deps': 0,
'react/no-find-dom-node': 0,
'react/no-did-update-set-state': 0,
'react/no-unused-state': 1,
'react/sort-comp': 0,
'jsx-a11y/label-has-for': 0,
'jsx-a11y/label-has-associated-control': 0,
},
};
5 changes: 5 additions & 0 deletions packages/icons-react-native/.fatherrc.js
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'],
});
20 changes: 20 additions & 0 deletions packages/icons-react-native/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { createConfig } = require('@umijs/test');

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

/** @type {import('@umijs/test').Config} */
const config = {
...defaultConfig,
testMatch: [ '**/?(*.)+(spec|test).[jt]s?(x)' ],
setupFiles: [
...(defaultConfig.setupFiles || []),
'./test/setup.js'
],
setupFilesAfterEnv: [
...(defaultConfig.setupFilesAfterEnv || []),
],
};

module.exports = config;
40 changes: 11 additions & 29 deletions packages/icons-react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@
],
"license": "MIT",
"scripts": {
"start": "rc-tools run server",
"lint": "rc-tools run lint",
"lint": "eslint src/ --ext .tsx,.ts,.jsx,.js",
"prelint": "npm run generate",
"compile": "rc-tools run compile --babel-runtime",
"build": "rc-tools run build",
"dist": "rc-tools run dist",
"compile": "father build",
"test": "jest",
"generate": "node scripts/index.js",
"pregenerate": "npm run clean",
Expand All @@ -35,40 +32,25 @@
"react": ">=16.0.0"
},
"devDependencies": {
"@rc-component/father-plugin": "^1.0.1",
"@types/jest": "^24.0.17",
"@types/react": "^16.4.12",
"@types/react-dom": "^16.0.6",
"@types/react-native": "^0.57.13",
"@types/react-native": "^0.72.0",
"@types/react-test-renderer": "^16.0.1",
"@umijs/fabric": "^2.14.1",
"@umijs/test": "^4.0.68",
"cross-env": "^5.2.0",
"jest": "^25.4.0",
"father": "^4.1.9",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"patch-package": "^6.2.2",
"prettier": "^1.15.2",
"rc-tools": "^9.6.1-alpha.1",
"react": "^16.6.3",
"react-dom": "^16.4.2",
"react-test-renderer": "^16.4.2",
"rimraf": "^2.6.2",
"tslint": "^5.11.0",
"tslint-react": "^4.0.0",
"typescript": "^3.0.3",
"webpack-iconfont-plugin-nodejs": "^1.0.17"
},
"jest": {
"setupFiles": [
"<rootDir>/test/setup.js"
],
"transform": {
"\\.tsx?$": "./node_modules/rc-tools/scripts/jestPreprocessor.js"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
"typescript": "^4.0.0",
"webpack-iconfont-plugin-nodejs": "1.0.17"
}
}
7 changes: 4 additions & 3 deletions packages/icons-react-native/scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ export default class Icon${uppercaseName} extends React.PureComponent<Icon${uppe

// index.tsx
const contents = fonts.map((font) => {
return `export { default as Icon${upperName(font)}, Icon${upperName(
font
)}Props, ${upperName(font)}GlyphMapType } from './${font}';\n`;
return [
`export { default as Icon${upperName(font)} } from './${font}';\n`,
`export type { Icon${upperName(font)}Props, ${upperName(font)}GlyphMapType } from './${font}';\n`
].join('');
});

fs.writeFileSync("src/index.tsx", contents.join(""));
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
exports[`IconFill props exists 1`] = `
<
style={
Array [
Object {
[
{
"color": "black",
"fontFamily": "antfill",
"fontSize": 24,
Expand All @@ -22,8 +22,8 @@ exports[`IconFill props exists 1`] = `
exports[`IconFill should create Icon element. 1`] = `
<
style={
Array [
Object {
[
{
"color": "black",
"fontFamily": "antfill",
"fontSize": 14,
Expand All @@ -39,7 +39,7 @@ exports[`IconFill should create Icon element. 1`] = `
`;

exports[`IconFill should create fillGlyphMap 1`] = `
Object {
{
"account-book": 59905,
"alert": 59906,
"alipay-circle": 59907,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
exports[`IconOutline props exists 1`] = `
<
style={
Array [
Object {
[
{
"color": "red",
"fontFamily": "antoutline",
"fontSize": 24,
Expand All @@ -22,8 +22,8 @@ exports[`IconOutline props exists 1`] = `
exports[`IconOutline should create Icon element. 1`] = `
<
style={
Array [
Object {
[
{
"color": "black",
"fontFamily": "antoutline",
"fontSize": 14,
Expand All @@ -39,7 +39,7 @@ exports[`IconOutline should create Icon element. 1`] = `
`;

exports[`IconOutline should create outlineGlyphMap 1`] = `
Object {
{
"account-book": 59905,
"aim": 59906,
"alert": 59907,
Expand Down
30 changes: 0 additions & 30 deletions packages/icons-react-native/tslint.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/icons-svg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"svgo": "^1.3.2",
"through2": "^3.0.1",
"ts-node": "^8.6.2",
"typescript": "^3.8.3",
"typescript": "^4.0.0",
"vinyl": "^2.2.0"
},
"publishConfig": {
Expand Down

0 comments on commit 5c05aae

Please sign in to comment.