Clear up warnings when running test cases.

This commit is contained in:
陈嘉涵
2017-08-16 23:06:28 +08:00
parent 7636f26c27
commit f27fa0122d
9 changed files with 26 additions and 35 deletions

View File

@@ -1,3 +1,6 @@
/**
* 编译 components 到 lib 目录
*/
const fs = require('fs-extra');
const path = require('path');
const compiler = require('vue-sfc-compiler');
@@ -5,9 +8,16 @@ const libDir = path.resolve(__dirname, '../../lib');
const srcDir = path.resolve(__dirname, '../../packages');
require('shelljs/global');
// 清空 lib 目录
fs.emptyDirSync(libDir);
// 复制 packages
fs.copySync(srcDir, libDir);
// 编译所有 .vue 文件到 .js
compileVueFiles(libDir);
// babel 编译
exec('cross-env BABEL_ENV=commonjs babel lib --out-dir lib');
function compileVueFiles(dir) {
@@ -16,11 +26,16 @@ function compileVueFiles(dir) {
files.forEach(file => {
const absolutePath = path.resolve(dir, file);
// 移除 vant-css
if (file.indexOf('vant-css') !== -1) {
fs.removeSync(absolutePath);
} else if (isDir(absolutePath)) {
}
// 遍历文件夹
else if (isDir(absolutePath)) {
return compileVueFiles(absolutePath);
} else if (/\.vue$/.test(file)) {
}
// 编译 .vue 文件
else if (/\.vue$/.test(file)) {
const source = fs.readFileSync(absolutePath, 'utf-8');
fs.removeSync(absolutePath);