mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
perf: check prop only from metadata of demo (#18332)
* perf: check prop from metadata of demo * fix: indent
This commit is contained in:
parent
1ccebe7618
commit
a707050c05
@ -66,6 +66,9 @@ references:
|
||||
- test_node_15:
|
||||
requires:
|
||||
- setup
|
||||
- check_metadata:
|
||||
requires:
|
||||
- setup
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
@ -223,6 +226,13 @@ jobs:
|
||||
- *install_react
|
||||
- run: npm run test-node -- -w 1 -u
|
||||
|
||||
check_metadata:
|
||||
<<: *container_config
|
||||
steps:
|
||||
- checkout
|
||||
- *attach_workspace
|
||||
- run: node ./scripts/check-demo.js
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build_test:
|
||||
|
@ -136,6 +136,7 @@
|
||||
"eslint-plugin-react": "^7.14.2",
|
||||
"eslint-tinker": "^0.5.0",
|
||||
"fetch-jsonp": "^1.1.3",
|
||||
"fs-extra": "^8.1.0",
|
||||
"full-icu": "^1.3.0",
|
||||
"glob": "^7.1.4",
|
||||
"husky": "^3.0.2",
|
||||
@ -186,7 +187,8 @@
|
||||
"stylelint-order": "^3.0.0",
|
||||
"typescript": "~3.5.1",
|
||||
"xhr-mock": "^2.4.1",
|
||||
"xhr2": "^0.2.0"
|
||||
"xhr2": "^0.2.0",
|
||||
"yaml-front-matter": "^4.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest --config .jest.js --no-cache",
|
||||
|
14
scripts/check-demo.js
Normal file
14
scripts/check-demo.js
Normal file
@ -0,0 +1,14 @@
|
||||
const path = require('path');
|
||||
const yfm = require('yaml-front-matter');
|
||||
const glob = require('glob');
|
||||
const fs = require('fs-extra');
|
||||
|
||||
const demoFiles = glob.sync(path.join(process.cwd(), 'components/**/demo/*.md'));
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const url of demoFiles) {
|
||||
const demoContent = fs.readFileSync(url);
|
||||
const meta = yfm.loadFront(demoContent);
|
||||
if (meta.only) {
|
||||
throw Error(`there is a 'only': ${url}`);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user