mushroom-cli 1.2.0-alpha.11 → 1.2.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +233 -223
- package/dist/check-update.js +5 -0
- package/dist/common.js +260 -0
- package/dist/config.js +394 -0
- package/{docs → dist/docs}/doc-mt.js +471 -523
- package/dist/docs/docs.v2.js +1758 -0
- package/{docs → dist/docs}/mt-dom-1.0.js +1025 -1268
- package/{docs → dist/docs}/mt.extension.js +142 -174
- package/dist/gen/gen-api-docs-v1.js +106 -0
- package/dist/gen/gen-api-docs.js +292 -0
- package/{gen → dist/gen}/gen-csharp.js +1265 -1399
- package/{gen → dist/gen}/gen-db-docs.js +204 -222
- package/{gen → dist/gen}/gen-js-driver-tarball.js +81 -101
- package/{gen → dist/gen}/gen-js-driver.js +116 -133
- package/{gen → dist/gen}/gen-ts-driver.js +427 -467
- package/{gen.js → dist/gen.js} +109 -124
- package/{help.js → dist/help.js} +53 -55
- package/dist/init/init-json.js +91 -0
- package/dist/init/init-netcore.js +30 -0
- package/dist/init.js +23 -0
- package/dist/master-file/master-file.js +185 -0
- package/dist/merge.js +70 -0
- package/dist/mr.js +75 -0
- package/dist/types.js +1 -0
- package/dist/update/tsCode.js +82 -0
- package/dist/update.js +20 -0
- package/package.json +54 -29
- package/check-update.js +0 -9
- package/common.js +0 -283
- package/config.js +0 -445
- package/docs/docs.html +0 -5190
- package/docs/docs.v2.html +0 -5095
- package/docs/docs.v2.js +0 -1633
- package/gen/gen-api-docs-v1.js +0 -125
- package/gen/gen-api-docs.js +0 -298
- package/init/init-json.js +0 -106
- package/init/init-netcore.js +0 -32
- package/init.js +0 -28
- package/master-file/master-file.js +0 -234
- package/merge.js +0 -84
- package/mr.js +0 -82
- package/update/tsCode.js +0 -20
- package/update.js +0 -24
package/{gen.js → dist/gen.js}
RENAMED
|
@@ -1,124 +1,109 @@
|
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
source =
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
case
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
csharp.genCSharpDriver(args, projectName, project, alias, source);
|
|
111
|
-
break;
|
|
112
|
-
case "":
|
|
113
|
-
case undefined:
|
|
114
|
-
case "help":
|
|
115
|
-
case "man":
|
|
116
|
-
help(args);
|
|
117
|
-
break;
|
|
118
|
-
default:
|
|
119
|
-
help(args, true);
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
module.exports = gen;
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import JSON5 from 'json5';
|
|
4
|
+
import help from './help.js';
|
|
5
|
+
import * as common from './common.js';
|
|
6
|
+
import * as masterFile from './master-file/master-file.js';
|
|
7
|
+
import genApiDocs from './gen/gen-api-docs.js';
|
|
8
|
+
import genApiDocsV1 from './gen/gen-api-docs-v1.js';
|
|
9
|
+
import genDatabaseDocs from './gen/gen-db-docs.js';
|
|
10
|
+
import * as javascriptDriverGenerator from './gen/gen-js-driver.js';
|
|
11
|
+
import genJavascriptDriverTarball from './gen/gen-js-driver-tarball.js';
|
|
12
|
+
import * as typescriptDriverGenerator from './gen/gen-ts-driver.js';
|
|
13
|
+
import * as csharp from './gen/gen-csharp.js';
|
|
14
|
+
export default async function gen(args) {
|
|
15
|
+
let projectName = args[1];
|
|
16
|
+
let alias = 'default';
|
|
17
|
+
if (!projectName) {
|
|
18
|
+
help(args);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const atIndex = projectName.indexOf('@');
|
|
22
|
+
if (atIndex !== -1) {
|
|
23
|
+
alias = projectName.substring(atIndex + 1);
|
|
24
|
+
projectName = projectName.substring(0, atIndex);
|
|
25
|
+
if (!projectName) {
|
|
26
|
+
help(args);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (!alias)
|
|
30
|
+
alias = 'default';
|
|
31
|
+
}
|
|
32
|
+
let mushroomConfig;
|
|
33
|
+
try {
|
|
34
|
+
const mushroomConfigContent = fs.readFileSync('./mushroom-config.json').toString();
|
|
35
|
+
mushroomConfig = JSON.parse(mushroomConfigContent);
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
common.logError('mushroom-config.json not found or unable to parse');
|
|
39
|
+
throw e;
|
|
40
|
+
}
|
|
41
|
+
if (!mushroomConfig || typeof mushroomConfig !== 'object')
|
|
42
|
+
throw new Error(`Invalid configuration. Please re-check file mushroom-config.json`);
|
|
43
|
+
if (!mushroomConfig || !mushroomConfig.projects || !mushroomConfig.projects[projectName])
|
|
44
|
+
throw new Error(`Project not found (${projectName})`);
|
|
45
|
+
const project = mushroomConfig.projects[projectName];
|
|
46
|
+
if (!project.src)
|
|
47
|
+
throw new Error('Project source (src) not found');
|
|
48
|
+
let master;
|
|
49
|
+
try {
|
|
50
|
+
const sourceContent = fs.readFileSync(project.src).toString();
|
|
51
|
+
master = JSON5.parse(sourceContent);
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
common.logError(project.src, 'not found or unable to parse');
|
|
55
|
+
throw e;
|
|
56
|
+
}
|
|
57
|
+
if (!master || typeof master !== 'object')
|
|
58
|
+
throw new Error(`Invalid api project configuration. Please re-check file ${project.src}`);
|
|
59
|
+
let source = null;
|
|
60
|
+
if (Array.isArray(master.fragments)) {
|
|
61
|
+
common.logInfo('Process master file', project.src);
|
|
62
|
+
source = masterFile.processMasterFile(path.dirname(project.src), master);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
source = master;
|
|
66
|
+
}
|
|
67
|
+
if (!source || typeof source !== 'object') {
|
|
68
|
+
throw new Error(`Invalid api project configuration. Please re-check file ${project.src}`);
|
|
69
|
+
}
|
|
70
|
+
if (source.name !== projectName) {
|
|
71
|
+
throw new Error(`Project name is mismatched (${projectName} & ${source.name})`);
|
|
72
|
+
}
|
|
73
|
+
const type = args[2];
|
|
74
|
+
switch (type) {
|
|
75
|
+
case 'docs':
|
|
76
|
+
if (args.includes('v1'))
|
|
77
|
+
await genApiDocsV1(args.filter((p) => p != 'v1'), projectName, project, alias, source);
|
|
78
|
+
else
|
|
79
|
+
await genApiDocs(args, projectName, project, alias, source);
|
|
80
|
+
break;
|
|
81
|
+
case 'db-docs':
|
|
82
|
+
genDatabaseDocs(args, projectName, project, alias, source);
|
|
83
|
+
break;
|
|
84
|
+
case 'js-driver':
|
|
85
|
+
javascriptDriverGenerator.genJavascriptDriver(args, projectName, project, alias, source);
|
|
86
|
+
break;
|
|
87
|
+
case 'js-driver-tarball':
|
|
88
|
+
await genJavascriptDriverTarball(args, projectName, project, alias, source);
|
|
89
|
+
break;
|
|
90
|
+
case 'ts-driver':
|
|
91
|
+
typescriptDriverGenerator.genTypescriptDriver(args, projectName, project, alias, source);
|
|
92
|
+
break;
|
|
93
|
+
case 'c#-mongo':
|
|
94
|
+
csharp.genCSharpMongoDbClasses(args, projectName, project, alias, source);
|
|
95
|
+
break;
|
|
96
|
+
case 'c#-driver':
|
|
97
|
+
csharp.genCSharpDriver(args, projectName, project, alias, source);
|
|
98
|
+
break;
|
|
99
|
+
case '':
|
|
100
|
+
case undefined:
|
|
101
|
+
case 'help':
|
|
102
|
+
case 'man':
|
|
103
|
+
help(args);
|
|
104
|
+
break;
|
|
105
|
+
default:
|
|
106
|
+
help(args, true);
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
package/{help.js → dist/help.js}
RENAMED
|
@@ -1,55 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (key){
|
|
6
|
-
if (wrong)
|
|
7
|
-
|
|
8
|
-
else
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
else
|
|
12
|
-
|
|
13
|
-
npx mushroom-cli init json ./api/SampleProject.json [silent]
|
|
14
|
-
|
|
15
|
-
Init a dotnet core project which pre-install Mushroom Server
|
|
16
|
-
npx mushroom-cli init netcore
|
|
17
|
-
|
|
18
|
-
Add the mushroom json file into mushroom-config.json
|
|
19
|
-
npx mushroom-cli config add ./api/yourProjectName.json
|
|
20
|
-
|
|
21
|
-
Config gen docs api
|
|
22
|
-
npx mushroom-cli config gen projectName docs ./wwwroot/docs.html [alias aliasName] [features file,auth,mail,driver] [roles Admin,User-Contributor]
|
|
23
|
-
|
|
24
|
-
Generate docs api (html format)
|
|
25
|
-
npx mushroom-cli gen projectName[@aliasName] docs [tmp]
|
|
26
|
-
|
|
27
|
-
Config gen database docs
|
|
28
|
-
npx mushroom-cli config gen projectName db-docs ./wwwroot/db-docs.html [alias aliasName] [features file,auth,mail]
|
|
29
|
-
|
|
30
|
-
Generate database docs (html format)
|
|
31
|
-
npx mushroom-cli gen projectName[@aliasName] db-docs [tmp]
|
|
32
|
-
|
|
33
|
-
Config gen javascript driver
|
|
34
|
-
npx mushroom-cli config gen projectName js-driver ./src/api/mushroom.api.js [alias aliasName] [roles Admin,User-Contributor] [tarball tarballName]
|
|
35
|
-
|
|
36
|
-
Generate javascript driver
|
|
37
|
-
npx mushroom-cli gen projectName[@aliasName] js-driver
|
|
38
|
-
|
|
39
|
-
Config gen entities for Mushroom project in CSharp and using MongoDb
|
|
40
|
-
npx mushroom-cli config gen projectName c#-mongo ./API/Generated.cs [alias aliasName]
|
|
41
|
-
|
|
42
|
-
Generate entities for Mushroom project in CSharp and using MongoDb
|
|
43
|
-
npx mushroom-cli gen projectName[@aliasName] c#-mongo
|
|
44
|
-
|
|
45
|
-
Config gen entities for CSharp project which calls Mushroom API
|
|
46
|
-
npx mushroom-cli config gen projectName c#-driver ./API/Generated.cs [roles Admin,User-Contributor] [alias aliasName]
|
|
47
|
-
|
|
48
|
-
Generate entities for CSharp project which calls Mushroom API
|
|
49
|
-
npx mushroom-cli gen projectName[@aliasName] c#-driver
|
|
50
|
-
|
|
51
|
-
Disable checking for update:
|
|
52
|
-
npx mushroom-cli parameters --no-check-update`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
module.exports = help;
|
|
1
|
+
import * as common from './common.js';
|
|
2
|
+
export default function help(key, wrong) {
|
|
3
|
+
if (Array.isArray(key))
|
|
4
|
+
key = key.join(' ');
|
|
5
|
+
if (key) {
|
|
6
|
+
if (wrong)
|
|
7
|
+
common.logInfo(`Invalid command '${key}'`);
|
|
8
|
+
else
|
|
9
|
+
common.logInfo(`Document for '${key}' is comming soon`);
|
|
10
|
+
}
|
|
11
|
+
else
|
|
12
|
+
common.logInfo(`Init a mushroom json file
|
|
13
|
+
npx mushroom-cli init json ./api/SampleProject.json [silent]
|
|
14
|
+
|
|
15
|
+
Init a dotnet core project which pre-install Mushroom Server
|
|
16
|
+
npx mushroom-cli init netcore
|
|
17
|
+
|
|
18
|
+
Add the mushroom json file into mushroom-config.json
|
|
19
|
+
npx mushroom-cli config add ./api/yourProjectName.json
|
|
20
|
+
|
|
21
|
+
Config gen docs api
|
|
22
|
+
npx mushroom-cli config gen projectName docs ./wwwroot/docs.html [alias aliasName] [features file,auth,mail,driver] [roles Admin,User-Contributor]
|
|
23
|
+
|
|
24
|
+
Generate docs api (html format)
|
|
25
|
+
npx mushroom-cli gen projectName[@aliasName] docs [tmp]
|
|
26
|
+
|
|
27
|
+
Config gen database docs
|
|
28
|
+
npx mushroom-cli config gen projectName db-docs ./wwwroot/db-docs.html [alias aliasName] [features file,auth,mail]
|
|
29
|
+
|
|
30
|
+
Generate database docs (html format)
|
|
31
|
+
npx mushroom-cli gen projectName[@aliasName] db-docs [tmp]
|
|
32
|
+
|
|
33
|
+
Config gen javascript driver
|
|
34
|
+
npx mushroom-cli config gen projectName js-driver ./src/api/mushroom.api.js [alias aliasName] [roles Admin,User-Contributor] [tarball tarballName]
|
|
35
|
+
|
|
36
|
+
Generate javascript driver
|
|
37
|
+
npx mushroom-cli gen projectName[@aliasName] js-driver
|
|
38
|
+
|
|
39
|
+
Config gen entities for Mushroom project in CSharp and using MongoDb
|
|
40
|
+
npx mushroom-cli config gen projectName c#-mongo ./API/Generated.cs [alias aliasName]
|
|
41
|
+
|
|
42
|
+
Generate entities for Mushroom project in CSharp and using MongoDb
|
|
43
|
+
npx mushroom-cli gen projectName[@aliasName] c#-mongo
|
|
44
|
+
|
|
45
|
+
Config gen entities for CSharp project which calls Mushroom API
|
|
46
|
+
npx mushroom-cli config gen projectName c#-driver ./API/Generated.cs [roles Admin,User-Contributor] [alias aliasName]
|
|
47
|
+
|
|
48
|
+
Generate entities for CSharp project which calls Mushroom API
|
|
49
|
+
npx mushroom-cli gen projectName[@aliasName] c#-driver
|
|
50
|
+
|
|
51
|
+
Disable checking for update:
|
|
52
|
+
npx mushroom-cli parameters --no-check-update`);
|
|
53
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import fetch from 'node-fetch';
|
|
3
|
+
import readlineSync from 'readline-sync';
|
|
4
|
+
import help from '../help.js';
|
|
5
|
+
import * as common from '../common.js';
|
|
6
|
+
export default function initJson(args) {
|
|
7
|
+
const path = args[2];
|
|
8
|
+
if (!path) {
|
|
9
|
+
help(args);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (fs.existsSync(path)) {
|
|
13
|
+
common.logError('File', path, 'is already existed');
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (args[3] === 'silent') {
|
|
17
|
+
common.logInfo('Fetch https://api.siten.vn/gen/template/default.json');
|
|
18
|
+
fetch('https://api.siten.vn/gen/template/default.json')
|
|
19
|
+
.then((res) => res.text())
|
|
20
|
+
.then((text) => {
|
|
21
|
+
common.ensureFolder(path);
|
|
22
|
+
fs.writeFile(path, text, (err) => {
|
|
23
|
+
if (err)
|
|
24
|
+
throw err;
|
|
25
|
+
common.logInfo('Initialized json at', path);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
common.logInfo('Fetch https://api.siten.vn/gen/template/template-def.json');
|
|
31
|
+
fetch('https://api.siten.vn/gen/template/template-def.json')
|
|
32
|
+
.then((res) => res.json())
|
|
33
|
+
.then((templateConfig) => {
|
|
34
|
+
const info = {};
|
|
35
|
+
templateConfig.fields.forEach((field) => {
|
|
36
|
+
while (true) {
|
|
37
|
+
let question = `${field.required ? '[Required] ' : ''}${field.label || field.name}`;
|
|
38
|
+
if (Array.isArray(field.list)) {
|
|
39
|
+
question += '\n';
|
|
40
|
+
let i = 1;
|
|
41
|
+
field.list.forEach((item) => {
|
|
42
|
+
question += '\t' + i++ + '. ' + item + '\n';
|
|
43
|
+
});
|
|
44
|
+
question += 'Please choose';
|
|
45
|
+
}
|
|
46
|
+
if (field.defaultValue !== undefined) {
|
|
47
|
+
question += ` (default: '${field.defaultValue}')`;
|
|
48
|
+
}
|
|
49
|
+
question += ': ';
|
|
50
|
+
let input = readlineSync.question(question);
|
|
51
|
+
if (Array.isArray(field.list)) {
|
|
52
|
+
const index = parseInt(input);
|
|
53
|
+
if (input !== '' && isNaN(index)) {
|
|
54
|
+
common.logWarning('Invalid input');
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
input = input ? field.list[index - 1] : (field.defaultValue ?? '');
|
|
58
|
+
}
|
|
59
|
+
else if (input === '') {
|
|
60
|
+
input = field.defaultValue ?? '';
|
|
61
|
+
}
|
|
62
|
+
if (!input && field.required) {
|
|
63
|
+
common.logWarning('Required input value');
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (input !== '' && field.pattern) {
|
|
67
|
+
const re = new RegExp(field.pattern, field.patternFlags);
|
|
68
|
+
if (!re.test(input)) {
|
|
69
|
+
common.logWarning("Input doesn't match with pattern", field.pattern);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
info[field.name] = input;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
common.logInfo('Fetch', templateConfig.templateUrl);
|
|
78
|
+
fetch(templateConfig.templateUrl)
|
|
79
|
+
.then((res) => res.text())
|
|
80
|
+
.then((json) => {
|
|
81
|
+
json = json.replace(/"\$\{([\w]+)\}"/g, (s0, s1) => JSON.stringify(info[s1]));
|
|
82
|
+
json = json.replace(/\$\{([\w]+)\}/g, (s0, s1) => JSON.stringify(info[s1]).replace(/^"|"$/g, ''));
|
|
83
|
+
common.ensureFolder(path);
|
|
84
|
+
fs.writeFile(path, json, (err) => {
|
|
85
|
+
if (err)
|
|
86
|
+
throw err;
|
|
87
|
+
common.logInfo('Initialized json at', path);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
import * as common from '../common.js';
|
|
3
|
+
function fetchFromGit() {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
const git = spawn('git', [
|
|
6
|
+
'clone',
|
|
7
|
+
'https://tfs.siten.vn/tfs/Siten/CodeBase/_git/Mushroom',
|
|
8
|
+
'-b',
|
|
9
|
+
'full_extensions',
|
|
10
|
+
'--single-branch',
|
|
11
|
+
]);
|
|
12
|
+
git.stdout.on('data', (data) => {
|
|
13
|
+
common.logInfo('GIT:', data);
|
|
14
|
+
});
|
|
15
|
+
git.stderr.on('data', (data) => {
|
|
16
|
+
common.logError('GIT:', data);
|
|
17
|
+
});
|
|
18
|
+
git.on('close', (code) => {
|
|
19
|
+
if (code) {
|
|
20
|
+
reject(new Error(`GIT exited with code ${code}`));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
resolve();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export default async function initNetCore(args) {
|
|
28
|
+
await fetchFromGit();
|
|
29
|
+
common.processTemplate('Mushroom', 'mushroom-template.json');
|
|
30
|
+
}
|
package/dist/init.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import help from './help.js';
|
|
2
|
+
import initJson from './init/init-json.js';
|
|
3
|
+
import initNetCore from './init/init-netcore.js';
|
|
4
|
+
export default async function init(args) {
|
|
5
|
+
const configCommand = args[1];
|
|
6
|
+
switch (configCommand) {
|
|
7
|
+
case 'json':
|
|
8
|
+
initJson(args);
|
|
9
|
+
break;
|
|
10
|
+
case 'netcore':
|
|
11
|
+
await initNetCore(args);
|
|
12
|
+
break;
|
|
13
|
+
case '':
|
|
14
|
+
case undefined:
|
|
15
|
+
case 'help':
|
|
16
|
+
case 'man':
|
|
17
|
+
help('init');
|
|
18
|
+
break;
|
|
19
|
+
default:
|
|
20
|
+
help(args, true);
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}
|