UNPKG

594 BJavaScriptView Raw
1const _ = require('lodash');
2const config = require('../ccreator.config.json');
3
4class Config {
5 constructor() {
6 this.config = config;
7 this.mergeConfigs();
8 }
9
10 get all() {
11 return this.config;
12 }
13
14 set set(param) {
15
16 }
17
18 get(path, defaultValue) {
19 return _.get(this.config, path, defaultValue);
20 }
21
22 mergeConfigs() {
23 try {
24 const userConfig = require(`${process.cwd()}/ccreator.config.json`);
25 this.config = { ...config, ...userConfig };
26 } catch (e) {
27 console.log(e);
28 }
29 }
30}
31
32const configure = new Config();
33
34module.exports = configure;