update antd tools

This commit is contained in:
yiminghe 2016-05-17 16:08:45 +08:00
parent d167738ddb
commit 1d5e84f15c
2 changed files with 22 additions and 18 deletions

View File

@ -72,7 +72,7 @@
"warning": "~2.1.0" "warning": "~2.1.0"
}, },
"devDependencies": { "devDependencies": {
"antd-tools": "^0.6.0", "antd-tools": "^0.7.0",
"babel-eslint": "^6.0.2", "babel-eslint": "^6.0.2",
"babel-jest": "^12.0.2", "babel-jest": "^12.0.2",
"babel-plugin-antd": "^0.4.0", "babel-plugin-antd": "^0.4.0",
@ -130,8 +130,8 @@
"test": "npm run lint && npm run jest && npm run dist", "test": "npm run lint && npm run jest && npm run dist",
"jest": "jest", "jest": "jest",
"pre-publish": "node ./scripts/prepub", "pre-publish": "node ./scripts/prepub",
"prepublish": "antd-tools run guard",
"pub": "antd-tools run update-self && antd-tools run pub", "pub": "antd-tools run update-self && antd-tools run pub",
"beta": "antd-tools run beta",
"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" "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": { "jest": {

View File

@ -3,25 +3,29 @@
/* eslint-disable */ /* eslint-disable */
'use strict'; 'use strict';
// Build a entry less file to dist/antd.less // Build a entry less file to dist/antd.less
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
console.log('Building a entry less file to dist/antd.less');
var componentsPath = path.join(process.cwd(), 'components'); if(fs.existsSync(path.join(__dirname,'../dist'))) {
var componentsLessContent = ''; console.log('Building a entry less file to dist/antd.less');
var componentsPath = path.join(process.cwd(), 'components');
var componentsLessContent = '';
// Build components in one file: lib/style/components.less // Build components in one file: lib/style/components.less
fs.readdir(componentsPath, function(err, files) { fs.readdir(componentsPath, function (err, files) {
files.forEach(function(file) { files.forEach(function (file) {
if (fs.existsSync(path.join(componentsPath, file, 'style', 'index.less'))) { if (fs.existsSync(path.join(componentsPath, file, 'style', 'index.less'))) {
componentsLessContent += `@import "../${path.join(file, 'style', 'index.less')}";\n` componentsLessContent += `@import "../${path.join(file, 'style', 'index.less')}";\n`
} }
}); });
fs.writeFileSync(path.join(process.cwd(), 'lib', 'style', 'components.less'), componentsLessContent); fs.writeFileSync(path.join(process.cwd(), 'lib', 'style', 'components.less'), componentsLessContent);
// Build less entry file: dist/antd.less // Build less entry file: dist/antd.less
fs.writeFileSync( fs.writeFileSync(
path.join(process.cwd(), 'dist', 'antd.less'), path.join(process.cwd(), 'dist', 'antd.less'),
'@import "../lib/style/index.less";\n@import "../lib/style/components.less";' '@import "../lib/style/index.less";\n@import "../lib/style/components.less";'
); );
}); });
}