mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 01:54:48 +00:00
Clear up warnings when running test cases.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user