simplify build config (#638)
This commit is contained in:
@@ -33,13 +33,11 @@ function compile(dir) {
|
||||
// 移除 vant-css
|
||||
if (file.indexOf('vant-css') !== -1) {
|
||||
fs.removeSync(absolutePath);
|
||||
}
|
||||
// 遍历文件夹
|
||||
else if (isDir(absolutePath)) {
|
||||
// 遍历文件夹
|
||||
} else if (isDir(absolutePath)) {
|
||||
return compile(absolutePath);
|
||||
}
|
||||
// 编译 .vue 文件
|
||||
else if (/\.vue$/.test(file)) {
|
||||
// 编译 .vue 文件
|
||||
} else if (/\.vue$/.test(file)) {
|
||||
const source = fs.readFileSync(absolutePath, 'utf-8');
|
||||
fs.removeSync(absolutePath);
|
||||
|
||||
@@ -49,9 +47,13 @@ function compile(dir) {
|
||||
|
||||
fs.outputFileSync(output, compiler(source, compilerOption).js);
|
||||
} else if (/\.js$/.test(file)) {
|
||||
babel.transformFile(absolutePath, compilerOption.babel, (err, { code }) => {
|
||||
fs.outputFileSync(absolutePath, code);
|
||||
});
|
||||
babel.transformFile(
|
||||
absolutePath,
|
||||
compilerOption.babel,
|
||||
(err, { code }) => {
|
||||
fs.outputFileSync(absolutePath, code);
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ const chalk = require('chalk');
|
||||
require('shelljs/global');
|
||||
|
||||
// 1. lint
|
||||
log('Starting', 'lint');
|
||||
exec('npm run lint --silent');
|
||||
log('Starting', 'lint');
|
||||
exec('npm run lint --silent');
|
||||
log('Finished', 'lint');
|
||||
|
||||
// 2. build entry
|
||||
@@ -32,7 +32,7 @@ log('Starting', 'build:vant-css');
|
||||
exec('npm run build:vant-css --silent');
|
||||
log('Finished', 'build:vant-css');
|
||||
|
||||
// 5. build vant.js
|
||||
// 5. build vant.js
|
||||
log('Starting', 'build:vant');
|
||||
exec('npm run build:vant --silent');
|
||||
log('Finished', 'build:vant');
|
||||
@@ -46,7 +46,7 @@ log('Finished', 'build:style-entries');
|
||||
function log(status, action, breakLine) {
|
||||
const now = new Date();
|
||||
const clock = `${breakLine ? '\n' : ''}[${padZero(now.getHours())}:${padZero(now.getMinutes())}:${padZero(now.getSeconds())}]`;
|
||||
console.log(`${chalk.gray(clock)} ${status} '${action ? chalk.cyan.bold(action ) : ''}'`);
|
||||
console.log(`${chalk.gray(clock)} ${status} '${action ? chalk.cyan.bold(action) : ''}'`);
|
||||
}
|
||||
|
||||
function padZero(num) {
|
||||
|
||||
@@ -6,7 +6,6 @@ const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const components = require('./get-components')();
|
||||
const dependencyTree = require('dependency-tree');
|
||||
|
||||
const SEP = path.sep;
|
||||
|
||||
components.forEach(componentName => {
|
||||
|
||||
@@ -4,5 +4,5 @@ const path = require('path');
|
||||
module.exports = function() {
|
||||
const dirs = fs.readdirSync(path.resolve(__dirname, '../../packages'));
|
||||
const excludes = ['index.js', 'vant-css', 'mixins', 'utils', '.DS_Store'];
|
||||
return dirs.filter(dirName => excludes.indexOf(dirName) === -1)
|
||||
}
|
||||
return dirs.filter(dirName => excludes.indexOf(dirName) === -1);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user