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

View File

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