Skip to content

Commit a4417ac

Browse files
chore: fix .circleci ci (#625)
* chore: fix .circleci ci * pretteir all code * use node 12 * use node 12 * use node 12 * use node 12 * fix test * fix test * fix test * fix test * add more test * fix test * fix test
1 parent 6d3fc2d commit a4417ac

File tree

69 files changed

+1691
-280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1691
-280
lines changed

.circleci/config.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2.1
22
orbs:
33
cypress: cypress-io/[email protected]
4-
node: circleci/node@4.3.0
4+
node: circleci/node@4.5.0
55

66
jobs:
77
unit-test:
@@ -13,11 +13,6 @@ jobs:
1313
install-yarn: true
1414
install-npm: false
1515
- run: yarn install
16-
- run: yarn build
17-
- run:
18-
name: Run Test
19-
command: yarn test:coverage --forceExit --detectOpenHandles --maxWorkers=2
20-
no_output_timeout: 300m
2116

2217
workflows:
2318
run:

.fatherrc.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { join } from 'path';
55
// runtime must build before renderer-react
66
const headPkgs: string[] = [];
77
const tailPkgs = readdirSync(join(__dirname, 'packages')).filter(
8-
pkg => pkg.charAt(0) !== '.' && !headPkgs.includes(pkg),
8+
(pkg) => pkg.charAt(0) !== '.' && !headPkgs.includes(pkg),
99
);
1010

1111
export default {

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
with:
1919
node-version: ${{ matrix.node_version }}
2020
registry-url: 'https://registry.yarnpkg.com'
21-
- run: yarn --ignore-engines --frozen-lockfile --silent
21+
- run: yarn --ignore-engines
2222
- run: yarn build
2323
- run: yarn test --forceExit
2424
env:

cypress/integration/examples/index.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
describe('examples', () => {
44
it('home', () => {
55
cy.visit('http://localhost:8000/');
6-
cy.get('#root > div').should('have.text', 'Home');
6+
cy.get('#root .ant-pro-basicLayout-content').should('have.text', 'Home');
77
});
88

99
it('plugin-model', () => {

example/app.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const layout = {
5454
}
5555
return menus;
5656
},
57-
childrenRender: children => {
57+
childrenRender: (children) => {
5858
return (
5959
<>
6060
{children}

example/models/bar.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22

3-
export default function() {
3+
export default function () {
44
const [count, setCount] = React.useState(0);
55
return {
66
description: count,

example/package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"scripts": {
3-
"dev": "../node_modules/umi/bin/umi.js dev",
4-
"start": "../node_modules/umi/bin/umi.js dev",
5-
"build": "../node_modules/umi/bin/umi.js build"
3+
"dev": "node ../node_modules/umi/bin/umi.js dev",
4+
"start": "node ../node_modules/umi/bin/umi.js dev",
5+
"build": "node ../node_modules/umi/bin/umi.js build"
66
},
77
"dependencies": {}
8+
89
}
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
export default function renderRightContent(){return null}
1+
export default function renderRightContent() {
2+
return null;
3+
}

package.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"bootstrap": "node ./scripts/bootstrap.js",
99
"build": "father-build",
1010
"link": "yarn link umi && yarn link @umijs/test && yarn link @umijs/utils && yarn link @umijs/types",
11-
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
11+
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
1212
"release": "node ./scripts/release.js",
1313
"test": "umi-test",
1414
"test:coverage": "umi-test --coverage",
@@ -43,6 +43,7 @@
4343
"cypress-wait-until": "^1.7.1",
4444
"express": "^4.15.3",
4545
"father-build": "^1.19.1",
46+
"inquirer": "^8.0.0",
4647
"lerna": "^3.20.2",
4748
"lint-staged": "^10.0.8",
4849
"npm-run-all": "^4.1.5",
@@ -52,15 +53,12 @@
5253
"react": "^16.12.0",
5354
"react-dom": "^16.12.0",
5455
"react-test-renderer": "^16.9.0",
55-
"umi": "^3.3.2",
56+
"umi": "^3.4.24",
5657
"webpack": "^5.38.1",
5758
"yorkie": "^2.0.0"
5859
},
5960
"gitHooks": {
6061
"pre-commit": "lint-staged",
6162
"commit-msg": "node scripts/verifyCommit.js"
62-
},
63-
"dependencies": {
64-
"inquirer": "^8.0.0"
6563
}
6664
}

packages/plugin-access/src/utils/getAccessProviderContent.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { utils } from 'umi';
22
import { join } from 'path';
33

4-
export default function(util: typeof utils) {
4+
export default function (util: typeof utils) {
55
return `\
66
import React, { useMemo } from 'react';
77
import { IRoute } from 'umi';

packages/plugin-access/src/utils/getContextContent.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default function() {
1+
export default function () {
22
return `\
33
import React from 'react';
44
import accessFactory from '@/access';

packages/plugin-access/src/utils/getRootContainerContent.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default function() {
1+
export default function () {
22
return `\
33
import React from 'react';
44
import AccessProvider from './AccessProvider';

packages/plugin-access/src/utils/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export function checkIfHasDefaultExporting(filepath: string): boolean {
1717
}
1818

1919
const fileContent = fs.readFileSync(scriptPath, 'utf8');
20-
const validationRegExp = /(export\s*default)|(exports\.default)|(module.exports[\s\S]*default)|(module.exports[\s\n]*=)/m;
20+
const validationRegExp =
21+
/(export\s*default)|(exports\.default)|(module.exports[\s\S]*default)|(module.exports[\s\n]*=)/m;
2122

2223
return validationRegExp.test(fileContent);
2324
}

packages/plugin-access/tests/utils/index.test.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,14 @@ describe('Utils', () => {
1919

2020
describe('checkIfHasDefaultExporting', () => {
2121
it('should return true if file path has default exporting member', () => {
22-
const hasDefaultExporting: boolean = checkIfHasDefaultExporting(
23-
'path/to/access',
24-
);
22+
const hasDefaultExporting: boolean =
23+
checkIfHasDefaultExporting('path/to/access');
2524
expect(hasDefaultExporting).toBe(true);
2625
});
2726

2827
it('should return false if file path does not has default exporting member', () => {
29-
const hasDefaultExporting: boolean = checkIfHasDefaultExporting(
30-
'path/not/exist',
31-
);
28+
const hasDefaultExporting: boolean =
29+
checkIfHasDefaultExporting('path/not/exist');
3230
expect(hasDefaultExporting).toBe(false);
3331
});
3432
});

packages/plugin-analytics/src/index.test.ts

+10-42
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,15 @@ test('analytics', async () => {
2424
const html = readFileSync(join(cwd, 'dist', 'index.html'), 'utf-8');
2525
const $ = cheerio.load(html);
2626

27-
expect(
28-
removeSpace(
29-
$('head script')
30-
.eq(2)
31-
.html(),
32-
),
33-
).toContain(`var_hmt=_hmt||[];`);
27+
expect(removeSpace($('head script').eq(2).html())).toContain(
28+
`var_hmt=_hmt||[];`,
29+
);
3430

35-
expect(
36-
removeSpace(
37-
$('head script')
38-
.eq(3)
39-
.html(),
40-
),
41-
).toContain(
31+
expect(removeSpace($('head script').eq(3).html())).toContain(
4232
`(function(){varhm=document.createElement("script");hm.src="https://hm.baidu.com/hm.js?5a66cxxxxxxxxxx9e13";vars=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(hm,s);})();`,
4333
);
4434

45-
expect(
46-
removeSpace(
47-
$('body script')
48-
.eq(0)
49-
.html(),
50-
),
51-
).toContain(
35+
expect(removeSpace($('body script').eq(0).html())).toContain(
5236
`(function(){if(!location.port){(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;(i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments);}),(i[r].l=1*newDate());(a=s.createElement(o)),(m=s.getElementsByTagName(o)[0]);a.async=1;a.src=g;m.parentNode.insertBefore(a,m);})(window,document,"script","//www.google-analytics.com/analytics.js","ga");ga("create","googleanalyticscode","auto");ga("send","pageview");}})();`,
5337
);
5438
});
@@ -72,31 +56,15 @@ test('analytics', async () => {
7256
const html = readFileSync(join(cwd, 'dist', 'index.html'), 'utf-8');
7357
const $ = cheerio.load(html);
7458

75-
expect(
76-
removeSpace(
77-
$('head script')
78-
.eq(2)
79-
.html(),
80-
),
81-
).toContain(`var_hmt=_hmt||[];`);
59+
expect(removeSpace($('head script').eq(2).html())).toContain(
60+
`var_hmt=_hmt||[];`,
61+
);
8262

83-
expect(
84-
removeSpace(
85-
$('head script')
86-
.eq(3)
87-
.html(),
88-
),
89-
).toContain(
63+
expect(removeSpace($('head script').eq(3).html())).toContain(
9064
`(function(){varhm=document.createElement("script");hm.src="https://hm.baidu.com/hm.js?5a66cxxxxxxxxxx9e13";vars=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(hm,s);})();`,
9165
);
9266

93-
expect(
94-
removeSpace(
95-
$('body script')
96-
.eq(0)
97-
.html(),
98-
),
99-
).toContain(
67+
expect(removeSpace($('body script').eq(0).html())).toContain(
10068
`(function(){if(!location.port){(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;(i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments);}),(i[r].l=1*newDate());(a=s.createElement(o)),(m=s.getElementsByTagName(o)[0]);a.async=1;a.src=g;m.parentNode.insertBefore(a,m);})(window,document,"script","//www.google-analytics.com/analytics.js","ga");ga("create","googleanalyticscode","auto");ga("send","pageview");}})();`,
10169
);
10270
});

packages/plugin-ant-design-pro-block/example/pages/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import styles from './index.css';
33

4-
export default function() {
4+
export default function () {
55
return (
66
<div className={styles.normal}>
77
<h1>Page index</h1>

packages/plugin-ant-design-pro-block/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { join } from 'path';
44
import { existsSync } from 'fs';
55
import { IApi } from 'umi';
66

7-
export default function(api: IApi) {
7+
export default function (api: IApi) {
88
const { paths, logger } = api;
99

1010
if (!api.hasPlugins(['@umijs/plugin-blocks'])) {

packages/plugin-antd/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default (api: IApi) => {
2424
},
2525
});
2626

27-
api.modifyBabelPresetOpts(opts => {
27+
api.modifyBabelPresetOpts((opts) => {
2828
return {
2929
...opts,
3030
import: (opts.import || []).concat([
@@ -55,7 +55,7 @@ export default (api: IApi) => {
5555
if (opts?.dark || opts?.compact) {
5656
// support dark mode, user use antd 4 by default
5757
const { getThemeVariables } = require('antd/dist/theme');
58-
api.modifyDefaultConfig(config => {
58+
api.modifyDefaultConfig((config) => {
5959
config.theme = {
6060
...getThemeVariables(opts),
6161
...config.theme,

packages/plugin-block-devtool/src/index.ts

+11-9
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function getNameFromPkg(pkg: { name: string }) {
3232
return pkg.name.split('/').pop();
3333
}
3434

35-
module.exports = function(api: IApi) {
35+
module.exports = function (api: IApi) {
3636
const { paths, logger } = api;
3737
const cwd = paths.cwd || process.cwd();
3838
const blockPath = join(cwd, `${process.argv.slice(2)[1] || '.'}`);
@@ -53,8 +53,10 @@ module.exports = function(api: IApi) {
5353
},
5454
});
5555

56-
const blockConfig = require(join(paths.cwd || '', 'package.json'))
57-
.blockConfig;
56+
const blockConfig = require(join(
57+
paths.cwd || '',
58+
'package.json',
59+
)).blockConfig;
5860
const options = api.service.userConfig.blockDevtool || {};
5961

6062
let subBlocks: SubBlock[] = [];
@@ -102,7 +104,7 @@ export default (props) => {
102104
});
103105
});
104106

105-
api.modifyConfig(memo => {
107+
api.modifyConfig((memo) => {
106108
// 这个环境变量是为了截图的时候可以动态设置 layout
107109
// 所以会优先从 环境变量里面取
108110
const path = process.env.BLOCK_DEV_PATH || options.path || '/';
@@ -127,7 +129,7 @@ export default (props) => {
127129
});
128130

129131
// link locales 和 models
130-
['locales', 'models'].map(dirName => {
132+
['locales', 'models'].map((dirName) => {
131133
if (existsSync(join(cwd, dirName))) {
132134
rimraf.sync(join(cwd, dirName));
133135
}
@@ -138,7 +140,7 @@ export default (props) => {
138140

139141
if (existsSync(localesPath)) {
140142
// copy 每个文件
141-
readdirSync(localesPath).map(fileName => {
143+
readdirSync(localesPath).map((fileName) => {
142144
const copyFilePath = join(blockPath, 'src', 'locales', fileName);
143145
if (existsSync(copyFilePath)) {
144146
copyFileSync(copyFilePath, join(cwd, 'locales', fileName));
@@ -147,7 +149,7 @@ export default (props) => {
147149
}
148150

149151
// link models 文件
150-
['model.ts', 'service.ts', 'data.d.ts'].map(fileName => {
152+
['model.ts', 'service.ts', 'data.d.ts'].map((fileName) => {
151153
const copyFilePath = join(blockPath, 'src', fileName);
152154
if (existsSync(copyFilePath)) {
153155
copyFileSync(copyFilePath, join(cwd, 'models', fileName));
@@ -164,8 +166,8 @@ export default (props) => {
164166
},
165167
]);
166168

167-
api.chainWebpack(webpackConfig => {
168-
subBlocks.forEach(b => {
169+
api.chainWebpack((webpackConfig) => {
170+
subBlocks.forEach((b) => {
169171
webpackConfig.resolve.alias.set(`./${b.name}`, join(b.path, 'src'));
170172
});
171173

packages/plugin-crossorigin/CHANGELOG.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
# Change Log
22

3-
All notable changes to this project will be documented in this file.
4-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
3+
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
54

65
# [1.2.0](https://github.com/umijs/plugins/compare/@umijs/[email protected]...@umijs/[email protected]) (2020-10-26)
76

8-
97
### Features
108

11-
* support include args ([#416](https://github.com/umijs/plugins/issues/416)) ([ff8cd78](https://github.com/umijs/plugins/commit/ff8cd7866da0b1ecf46b54e5afb738c9fd3fe767))
12-
13-
14-
15-
9+
- support include args ([#416](https://github.com/umijs/plugins/issues/416)) ([ff8cd78](https://github.com/umijs/plugins/commit/ff8cd7866da0b1ecf46b54e5afb738c9fd3fe767))
1610

1711
## [1.1.1](https://github.com/umijs/plugins/compare/@umijs/[email protected]...@umijs/[email protected]) (2020-07-20)
1812

packages/plugin-crossorigin/src/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default (api: IApi) => {
2222
},
2323
});
2424

25-
api.chainWebpack(webpackConfig => {
25+
api.chainWebpack((webpackConfig) => {
2626
webpackConfig.output.crossOriginLoading('anonymous');
2727
return webpackConfig;
2828
});
@@ -32,7 +32,7 @@ export default (api: IApi) => {
3232

3333
// last exec
3434
api.modifyHTML({
35-
fn: $ => {
35+
fn: ($) => {
3636
$('script').each((i: number, elem) => {
3737
const el = $(elem);
3838
const scriptSrc = el.attr('src');
@@ -46,7 +46,7 @@ export default (api: IApi) => {
4646
el.attr('crossorigin', 'anonymous');
4747
}
4848

49-
if (include.some(reg => reg.test(scriptSrc))) {
49+
if (include.some((reg) => reg.test(scriptSrc))) {
5050
el.attr('crossorigin', 'anonymous');
5151
}
5252
});

0 commit comments

Comments
 (0)