-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathinit.js
30 lines (22 loc) · 882 Bytes
/
init.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
"use strict";
var fs = require('fs');
var path = require('path');
var Log = require('../Log');
var KAIZEN_CONFIG_FILE = "kaizen.json";
exports.description = 'initialize kaizen environment';
exports.yargs = function (yargs) {
yargs.example('kaizen init');
};
exports.argv = function (argv) {
var targetPath = path.resolve('./', KAIZEN_CONFIG_FILE);
if (fs.existsSync(targetPath) === false) {
console.error('[ERROR]: please use kaizen new to create new project first.');
return;
}
var sourcePath = path.resolve(__dirname, '../../../config/', KAIZEN_CONFIG_FILE);
var sourceConfig = JSON.parse(fs.readFileSync(sourcePath));
var targetConfig = JSON.parse(fs.readFileSync(targetPath));
var newConfig = Object.assign({}, targetConfig, sourceConfig);
fs.writeFileSync(targetPath, JSON.stringify(newConfig));
Log.SuccessLog("complete initialization");
};