Merge pull request #3818 from ant-design/chore-check-files

chore: check whether compiled files are valid
This commit is contained in:
偏右 2016-11-15 15:29:33 +08:00 committed by GitHub
commit e1e8003e54
3 changed files with 57 additions and 11 deletions

View File

@ -89,6 +89,7 @@
"bisheng-plugin-react": "^0.2.0",
"bisheng-plugin-toc": "^0.3.0",
"css-split-webpack-plugin": "^0.2.1",
"dekko": "^0.2.0",
"dora-plugin-upload": "^0.3.1",
"enquire.js": "^2.1.1",
"enzyme": "^2.6.0",
@ -131,23 +132,27 @@
"values.js": "^1.0.3"
},
"scripts": {
"dist": "antd-tools run dist",
"compile": "antd-tools run compile",
"clean": "antd-tools run clean",
"start": "bisheng start -c ./site/bisheng.config.js --no-livereload",
"site": "bisheng build -c ./site/bisheng.config.js",
"deploy": "npm run clean && bisheng gh-pages -c ./site/bisheng.config.js",
"lint": "npm run tslint && npm run srclint && npm run demolint && npm run lesshint",
"srclint": "RUN_ENV=SRC eslint test site scripts ./.eslintrc.js ./webpack.config.js --ext '.js,.jsx,.tsx' --ignore-pattern '!.eslintrc.js'",
"test": "npm run lint && npm run dist && npm run jest",
"lint": "npm run tslint && npm run eslint && npm run demolint && npm run lesshint",
"tslint": "antd-tools run ts-lint && npm run compile && rm -rf lib",
"eslint": "eslint test site scripts ./.eslintrc.js ./webpack.config.js --ext '.js,.jsx,.tsx' --ignore-pattern '!.eslintrc.js'",
"demolint": "RUN_ENV=DEMO eslint components/*/demo/*.md --ext '.md'",
"lesshint": "lesshint components -r scripts/lesshint-report.js",
"eslint-fix": "eslint --fix test site scripts ./.eslintrc.js ./webpack.config.js --ext '.js,.jsx,.tsx' --ignore-pattern '!.eslintrc.js' && eslint-tinker ./components/*/demo/*.md",
"test": "npm run lint && npm run dist && npm run jest",
"jest": "jest --no-cache",
"pre-publish": "node ./scripts/prepub",
"prepublish": "antd-tools run guard",
"clean": "antd-tools run clean",
"dist": "antd-tools run dist && node ./tests/dekko/dist.test.js",
"compile": "antd-tools run compile && node ./tests/dekko/lib.test.js",
"start": "bisheng start -c ./site/bisheng.config.js --no-livereload",
"site": "bisheng build -c ./site/bisheng.config.js",
"deploy": "npm run clean && bisheng gh-pages -c ./site/bisheng.config.js",
"pub": "antd-tools run update-self && antd-tools run pub",
"prepublish": "antd-tools run guard",
"pre-publish": "node ./scripts/prepub",
"authors": "git log --format='%aN <%aE>' | sort -u | grep -v 'users.noreply.github.com' | grep -v 'gitter.im' | grep -v '.local>' | grep -v 'alibaba-inc.com' | grep -v 'alipay.com' | grep -v 'taobao.com' > AUTHORS.txt"
},
"jest": {
@ -162,6 +167,7 @@
"/_site/"
],
"testPathIgnorePatterns": [
"dekko",
"/node_modules/"
],
"transform": {

12
tests/dekko/dist.test.js Normal file
View File

@ -0,0 +1,12 @@
'use strict';
const $ = require('dekko');
$('dist')
.isDirectory()
.hasFile('antd.css')
.hasFile('antd.min.css')
.hasFile('antd.js')
.hasFile('antd.min.js');
console.log('`dist` directory is valid.');

28
tests/dekko/lib.test.js Normal file
View File

@ -0,0 +1,28 @@
'use strict';
const $ = require('dekko');
$('lib')
.isDirectory()
.hasFile('index.js')
.hasFile('index.d.ts');
$('lib/*')
.filter((filename) => {
return !filename.endsWith('index.js') &&
!filename.endsWith('index.d.ts');
})
.isDirectory()
.filter((filename) => {
return !filename.endsWith('style') &&
!filename.endsWith('_util');
})
.hasFile('index.js')
.hasFile('index.d.ts')
.hasDirectory('style');
$('lib/*/style')
.hasFile('css.js')
.hasFile('index.js');
console.log('`lib` directory is valid.');