-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulp-config.js
34 lines (32 loc) · 1.01 KB
/
gulp-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
"use strict";
const fs = require("fs"),
log = require("fancy-log"),
path = require("path"),
argv = require("yargs")
.alias("r", "root")
.argv;
module.exports = function () {
const printUsage = function () {
log("Configuration input from command line:");
log("-------------------------------------------");
log("\t-r | --root sets instance root folder, ex. c:\\websites\mysite");
log("-------------------------------------------");
}
const defaultConfig = {
root: path.resolve("."),
websiteRoot: function () {
return this.root + "\\Website";
},
};
var config = {}
const setConfig = function () {
const userConfig = fs.existsSync("./gulp-config.js.user") ? require("./gulp-config.js.user") : {};
config = Object.assign(config, defaultConfig, userConfig, argv);
};
printUsage();
setConfig();
log("\nCurrent config:");
log(config);
log("-------------------------------------------\n");
return config;
}();