-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
59 lines (47 loc) · 1.65 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
var fs = require('fs');
var colors = require('colors');
var argv = require('minimist')(process.argv.slice(2),{
string:['src','dist']
});
var destDir = argv.dist ||'activity';
var srcCLI = argv.src;
if(!srcCLI){
console.log('没有输入项目名称');
process.exit();
}
var name = srcCLI;
colors.setTheme({
info: 'cyan'
});
var filesPath = fs.readdirSync('./actSrc/',(err)=>{
if(err){
console.log(err);
}
});
console.log('====================================================='.rainbow);
console.log(`[info] `.info+`你当前监听发布环境是:`.green+`${destDir}`.bgWhite.red+`目录下的`+`${name}`.bgRed.white+'项目');
var part = new RegExp(name);
if(part.test(filesPath)){
console.log(`[info] `.info+`输入的项目匹配成功,监听${name}项目`.green);
console.log('====================================================='.rainbow);
}else{
console.log(`[info] `.info+`没有匹配到输入的项目,强制退出`.green);
console.log('====================================================='.rainbow);
process.exit();
}
module.exports = {
srcPath: {
html: `actSrc/${name}/**/*.html`,
sass: `actSrc/${name}/**/css/**/*.scss`,
js: `actSrc/${name}/**/js/**/*.js`,
jsmin: `actSrc/${name}/**/js/**/*.min.js`,
imageJpg: `actSrc/${name}/**/images/**/*.+(ico)`,
imagePng: `actSrc/${name}/**/images/**/*.+(png|jpg|jpeg)`,
css: `actSrc/${name}/**/css/**/*.css`,
map: `${destDir}/**/map`
},
destPath : `${destDir}/${name}/`,
mkey:'tinypng密钥',
destDir:destDir,
src:name
}