typia 3.7.4-dev.20230410-7 → 3.7.4-dev.20230411
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 +1 -0
- package/lib/executable/setup/ArgumentParser.d.ts +4 -4
- package/lib/executable/setup/ArgumentParser.js +30 -75
- package/lib/executable/setup/ArgumentParser.js.map +1 -1
- package/lib/executable/setup/PluginConfigurator.js +8 -32
- package/lib/executable/setup/PluginConfigurator.js.map +1 -1
- package/lib/executable/typia.js +2 -6
- package/lib/executable/typia.js.map +1 -1
- package/package.json +1 -1
- package/src/executable/setup/ArgumentParser.ts +14 -27
- package/src/executable/setup/PluginConfigurator.ts +10 -10
- package/src/executable/typia.ts +2 -6
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import commander from "commander";
|
|
2
|
+
import inquirer from "inquirer";
|
|
3
3
|
import { PackageManager } from "./PackageManager";
|
|
4
4
|
export declare namespace ArgumentParser {
|
|
5
|
-
type Inquiry<T> = (pack: PackageManager, command:
|
|
6
|
-
const parse: (pack: PackageManager) => <T>(inquiry: (pack: PackageManager, command:
|
|
5
|
+
type Inquiry<T> = (pack: PackageManager, command: commander.Command, prompt: (opt?: inquirer.StreamOptions) => inquirer.PromptModule, action: (closure: (options: Partial<T>) => Promise<T>) => Promise<T>) => Promise<T>;
|
|
6
|
+
const parse: (pack: PackageManager) => <T>(inquiry: (pack: PackageManager, command: commander.Command, prompt: (opt?: inquirer.StreamOptions) => inquirer.PromptModule, action: (closure: (options: Partial<T>) => Promise<T>) => Promise<T>) => Promise<T>) => Promise<T>;
|
|
7
7
|
}
|
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -58,68 +35,46 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
58
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
36
|
}
|
|
60
37
|
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
61
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
42
|
exports.ArgumentParser = void 0;
|
|
43
|
+
var commander_1 = __importDefault(require("commander"));
|
|
44
|
+
var inquirer_1 = __importDefault(require("inquirer"));
|
|
63
45
|
var ArgumentParser;
|
|
64
46
|
(function (ArgumentParser) {
|
|
65
47
|
var _this = this;
|
|
66
48
|
ArgumentParser.parse = function (pack) {
|
|
67
49
|
return function (inquiry) { return __awaiter(_this, void 0, void 0, function () {
|
|
68
|
-
var
|
|
50
|
+
var action;
|
|
69
51
|
var _this = this;
|
|
70
52
|
return __generator(this, function (_a) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return [3, 3];
|
|
91
|
-
case 2:
|
|
92
|
-
exp_1 = _b.sent();
|
|
93
|
-
reject(exp_1);
|
|
94
|
-
return [3, 3];
|
|
95
|
-
case 3: return [2];
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}); });
|
|
99
|
-
command.parseAsync().catch(reject);
|
|
53
|
+
action = function (closure) {
|
|
54
|
+
return new Promise(function (resolve, reject) {
|
|
55
|
+
commander_1.default.program.action(function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
56
|
+
var _a, exp_1;
|
|
57
|
+
return __generator(this, function (_b) {
|
|
58
|
+
switch (_b.label) {
|
|
59
|
+
case 0:
|
|
60
|
+
_b.trys.push([0, 2, , 3]);
|
|
61
|
+
_a = resolve;
|
|
62
|
+
return [4, closure(options)];
|
|
63
|
+
case 1:
|
|
64
|
+
_a.apply(void 0, [_b.sent()]);
|
|
65
|
+
return [3, 3];
|
|
66
|
+
case 2:
|
|
67
|
+
exp_1 = _b.sent();
|
|
68
|
+
reject(exp_1);
|
|
69
|
+
return [3, 3];
|
|
70
|
+
case 3: return [2];
|
|
71
|
+
}
|
|
100
72
|
});
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
case 0:
|
|
107
|
-
_a.trys.push([0, 2, , 3]);
|
|
108
|
-
return [4, inquiry(pack, command, prompt, action)];
|
|
109
|
-
case 1: return [2, _a.sent()];
|
|
110
|
-
case 2:
|
|
111
|
-
error_1 = _a.sent();
|
|
112
|
-
return [2, error_1];
|
|
113
|
-
case 3: return [2];
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
}); })()];
|
|
117
|
-
case 3:
|
|
118
|
-
output = _a.sent();
|
|
119
|
-
if (output instanceof Error)
|
|
120
|
-
throw output;
|
|
121
|
-
return [2, output];
|
|
122
|
-
}
|
|
73
|
+
}); });
|
|
74
|
+
commander_1.default.program.parseAsync().catch(reject);
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
return [2, inquiry(pack, commander_1.default.program, inquirer_1.default.createPromptModule, action)];
|
|
123
78
|
});
|
|
124
79
|
}); };
|
|
125
80
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArgumentParser.js","sourceRoot":"","sources":["../../../src/executable/setup/ArgumentParser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ArgumentParser.js","sourceRoot":"","sources":["../../../src/executable/setup/ArgumentParser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAkC;AAClC,sDAAgC;AAIhC,IAAiB,cAAc,CAuC9B;AAvCD,WAAiB,cAAc;;IAQd,oBAAK,GACd,UAAC,IAAoB;QACrB,OAAA,UACI,OAOe;;;;gBAGT,MAAM,GAAG,UAAC,OAA4C;oBACxD,OAAA,IAAI,OAAO,CAAI,UAAC,OAAO,EAAE,MAAM;wBAC3B,mBAAS,CAAC,OAAO,CAAC,MAAM,CAAC,UAAO,OAAO;;;;;;wCAE/B,KAAA,OAAO,CAAA;wCAAC,WAAM,OAAO,CAAC,OAAO,CAAC,EAAA;;wCAA9B,kBAAQ,SAAsB,EAAC,CAAC;;;;wCAEhC,MAAM,CAAC,KAAG,CAAC,CAAC;;;;;6BAEnB,CAAC,CAAC;wBACH,mBAAS,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;oBACjD,CAAC,CAAC;gBATF,CASE,CAAC;gBACP,WAAO,OAAO,CACV,IAAI,EACJ,mBAAS,CAAC,OAAO,EACjB,kBAAQ,CAAC,kBAAkB,EAC3B,MAAM,CACT,EAAC;;aACL;IA5BD,CA4BC,CAAC;AACV,CAAC,EAvCgB,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAuC9B"}
|
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -63,20 +40,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
63
40
|
};
|
|
64
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
42
|
exports.PluginConfigurator = void 0;
|
|
43
|
+
var comment_json_1 = __importDefault(require("comment-json"));
|
|
66
44
|
var fs_1 = __importDefault(require("fs"));
|
|
67
45
|
var PluginConfigurator;
|
|
68
46
|
(function (PluginConfigurator) {
|
|
69
47
|
function configure(args) {
|
|
70
48
|
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
-
var
|
|
49
|
+
var config, _a, _b, compilerOptions, plugins, strict, oldbie;
|
|
72
50
|
return __generator(this, function (_c) {
|
|
73
51
|
switch (_c.label) {
|
|
74
|
-
case 0:
|
|
75
|
-
|
|
76
|
-
comments = _c.sent();
|
|
77
|
-
_b = (_a = comments).parse;
|
|
52
|
+
case 0:
|
|
53
|
+
_b = (_a = comment_json_1.default).parse;
|
|
78
54
|
return [4, fs_1.default.promises.readFile(args.project, "utf8")];
|
|
79
|
-
case
|
|
55
|
+
case 1:
|
|
80
56
|
config = _b.apply(_a, [_c.sent()]);
|
|
81
57
|
compilerOptions = config.compilerOptions;
|
|
82
58
|
if (compilerOptions === undefined)
|
|
@@ -99,9 +75,9 @@ var PluginConfigurator;
|
|
|
99
75
|
return [2];
|
|
100
76
|
compilerOptions.strict = true;
|
|
101
77
|
if (oldbie === undefined)
|
|
102
|
-
plugins.push(
|
|
103
|
-
return [4, fs_1.default.promises.writeFile(args.project,
|
|
104
|
-
case
|
|
78
|
+
plugins.push(comment_json_1.default.parse("\n {\n \"transform\": \"typia/lib/transform\"\n }"));
|
|
79
|
+
return [4, fs_1.default.promises.writeFile(args.project, comment_json_1.default.stringify(config, null, 2))];
|
|
80
|
+
case 2:
|
|
105
81
|
_c.sent();
|
|
106
82
|
return [2];
|
|
107
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginConfigurator.js","sourceRoot":"","sources":["../../../src/executable/setup/PluginConfigurator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PluginConfigurator.js","sourceRoot":"","sources":["../../../src/executable/setup/PluginConfigurator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAoC;AACpC,0CAAoB;AAIpB,IAAiB,kBAAkB,CAqDlC;AArDD,WAAiB,kBAAkB;IAC/B,SAAsB,SAAS,CAC3B,IAAiC;;;;;;wBAGM,KAAA,CAAA,KAAA,sBAAQ,CAAA,CAAC,KAAK,CAAA;wBACjD,WAAM,YAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAQ,EAAE,MAAM,CAAC,EAAA;;wBAD/C,MAAM,GAA2B,cACnC,SAAiD,EAC1B;wBACrB,eAAe,GAAG,MAAM,CAAC,eAEhB,CAAC;wBAChB,IAAI,eAAe,KAAK,SAAS;4BAC7B,MAAM,IAAI,KAAK,CACX,UAAG,IAAI,CAAC,OAAO,sDAAiD,CACnE,CAAC;wBAGA,OAAO,GAAkD,CAAC;4BAC5D,IAAM,OAAO,GAAG,eAAe,CAAC,OAEjB,CAAC;4BAChB,IAAI,OAAO,KAAK,SAAS;gCACrB,OAAO,CAAC,eAAe,CAAC,OAAO,GAAG,EAAS,CAAC,CAAC;iCAC5C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;gCAC5B,MAAM,IAAI,KAAK,CACX,kCAAyB,IAAI,CAAC,OAAO,yBAAsB,CAC9D,CAAC;4BACN,OAAO,OAAO,CAAC;wBACnB,CAAC,CAAC,EAAE,CAAC;wBAEC,MAAM,GAAY,eAAe,CAAC,MAAM,KAAK,IAAI,CAAC;wBAClD,MAAM,GAAuC,OAAO,CAAC,IAAI,CAC3D,UAAC,CAAC;4BACE,OAAA,OAAO,CAAC,KAAK,QAAQ;gCACrB,CAAC,KAAK,IAAI;gCACV,CAAC,CAAC,SAAS,KAAK,qBAAqB;wBAFrC,CAEqC,CAC5C,CAAC;wBACF,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS;4BAAE,WAAO;wBAGpD,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC;wBAC9B,IAAI,MAAM,KAAK,SAAS;4BACpB,OAAO,CAAC,IAAI,CACR,sBAAQ,CAAC,KAAK,CAAC,4HAGL,CAA2B,CACxC,CAAC;wBACN,WAAM,YAAE,CAAC,QAAQ,CAAC,SAAS,CACvB,IAAI,CAAC,OAAQ,EACb,sBAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CACtC,EAAA;;wBAHD,SAGC,CAAC;;;;;KACL;IAnDqB,4BAAS,YAmD9B,CAAA;AACL,CAAC,EArDgB,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAqDlC"}
|
package/lib/executable/typia.js
CHANGED
|
@@ -83,7 +83,7 @@ function main() {
|
|
|
83
83
|
return [3, 5];
|
|
84
84
|
case 4:
|
|
85
85
|
_a = _c.sent();
|
|
86
|
-
halt(
|
|
86
|
+
halt("typia has not been installed. Run \"npm i typia\" before.");
|
|
87
87
|
return [3, 5];
|
|
88
88
|
case 5:
|
|
89
89
|
type = process.argv[2];
|
|
@@ -106,11 +106,7 @@ function main() {
|
|
|
106
106
|
return [3, 12];
|
|
107
107
|
case 11:
|
|
108
108
|
_b = _c.sent();
|
|
109
|
-
halt(
|
|
110
|
-
"Please install typescript.",
|
|
111
|
-
"",
|
|
112
|
-
" - npm install --save-dev typescript",
|
|
113
|
-
].join("\n"));
|
|
109
|
+
halt("typescript has not been installed. Run \"npm i -D typescript\" before.");
|
|
114
110
|
return [3, 12];
|
|
115
111
|
case 12: return [4, Promise.resolve().then(function () { return __importStar(require("./TypiaGenerateWizard")); })];
|
|
116
112
|
case 13:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typia.js","sourceRoot":"","sources":["../../src/executable/typia.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAM,KAAK,GAAG,wfAiBb,CAAC;AAEF,SAAS,IAAI,CAAC,IAAY;IACtB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC;AAED,SAAe,IAAI;;;;;;;oBAEX,4EAAa,cAAc,QAAC;;oBAA5B,SAA4B,CAAC;oBAC7B,4EAAa,UAAU,QAAC;;oBAAxB,SAAwB,CAAC;oBACzB,4EAAa,WAAW,QAAC;;oBAAzB,SAAyB,CAAC;;;;oBAE1B,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"typia.js","sourceRoot":"","sources":["../../src/executable/typia.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAM,KAAK,GAAG,wfAiBb,CAAC;AAEF,SAAS,IAAI,CAAC,IAAY;IACtB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC;AAED,SAAe,IAAI;;;;;;;oBAEX,4EAAa,cAAc,QAAC;;oBAA5B,SAA4B,CAAC;oBAC7B,4EAAa,UAAU,QAAC;;oBAAxB,SAAwB,CAAC;oBACzB,4EAAa,WAAW,QAAC;;oBAAzB,SAAyB,CAAC;;;;oBAE1B,IAAI,CAAC,2DAAyD,CAAC,CAAC;;;oBAG9D,IAAI,GAAuB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;yBAC7C,CAAA,IAAI,KAAK,OAAO,CAAA,EAAhB,cAAgB;oBACa,4EAAa,oBAAoB,QAAC;;oBAAvD,gBAAgB,GAAK,CAAA,SAAkC,CAAA,iBAAvC;oBACxB,WAAM,gBAAgB,CAAC,KAAK,EAAE,EAAA;;oBAA9B,SAA8B,CAAC;;;yBACxB,CAAA,IAAI,KAAK,UAAU,CAAA,EAAnB,eAAmB;;;;oBAEtB,4EAAa,YAAY,QAAC;;oBAA1B,SAA0B,CAAC;;;;oBAE3B,IAAI,CACA,wEAAsE,CACzE,CAAC;;yBAE0B,4EAAa,uBAAuB,QAAC;;oBAA7D,mBAAmB,GAAK,CAAA,SAAqC,CAAA,oBAA1C;oBAC3B,WAAM,mBAAmB,CAAC,QAAQ,EAAE,EAAA;;oBAApC,SAAoC,CAAC;;;oBAClC,IAAI,CAAC,KAAK,CAAC,CAAC;;;;;;CACtB;AACD,IAAI,EAAE,CAAC,KAAK,CAAC,UAAC,GAAG;IACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import commander from "commander";
|
|
2
|
+
import inquirer from "inquirer";
|
|
3
3
|
|
|
4
4
|
import { PackageManager } from "./PackageManager";
|
|
5
5
|
|
|
6
6
|
export namespace ArgumentParser {
|
|
7
7
|
export type Inquiry<T> = (
|
|
8
8
|
pack: PackageManager,
|
|
9
|
-
command:
|
|
10
|
-
prompt: (
|
|
11
|
-
opt?: InquirerModule.StreamOptions,
|
|
12
|
-
) => InquirerModule.PromptModule,
|
|
9
|
+
command: commander.Command,
|
|
10
|
+
prompt: (opt?: inquirer.StreamOptions) => inquirer.PromptModule,
|
|
13
11
|
action: (closure: (options: Partial<T>) => Promise<T>) => Promise<T>,
|
|
14
12
|
) => Promise<T>;
|
|
15
13
|
|
|
@@ -18,41 +16,30 @@ export namespace ArgumentParser {
|
|
|
18
16
|
async <T>(
|
|
19
17
|
inquiry: (
|
|
20
18
|
pack: PackageManager,
|
|
21
|
-
command:
|
|
22
|
-
prompt: (
|
|
23
|
-
opt?: InquirerModule.StreamOptions,
|
|
24
|
-
) => InquirerModule.PromptModule,
|
|
19
|
+
command: commander.Command,
|
|
20
|
+
prompt: (opt?: inquirer.StreamOptions) => inquirer.PromptModule,
|
|
25
21
|
action: (
|
|
26
22
|
closure: (options: Partial<T>) => Promise<T>,
|
|
27
23
|
) => Promise<T>,
|
|
28
24
|
) => Promise<T>,
|
|
29
25
|
): Promise<T> => {
|
|
30
|
-
// LOAD INSTALLED MODULES
|
|
31
|
-
const { program: command } = await import("commander");
|
|
32
|
-
const { createPromptModule: prompt } = await import("inquirer");
|
|
33
|
-
|
|
34
26
|
// TAKE OPTIONS
|
|
35
27
|
const action = (closure: (options: Partial<T>) => Promise<T>) =>
|
|
36
28
|
new Promise<T>((resolve, reject) => {
|
|
37
|
-
|
|
29
|
+
commander.program.action(async (options) => {
|
|
38
30
|
try {
|
|
39
31
|
resolve(await closure(options));
|
|
40
32
|
} catch (exp) {
|
|
41
33
|
reject(exp);
|
|
42
34
|
}
|
|
43
35
|
});
|
|
44
|
-
|
|
36
|
+
commander.program.parseAsync().catch(reject);
|
|
45
37
|
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
})();
|
|
53
|
-
|
|
54
|
-
// RETURNS
|
|
55
|
-
if (output instanceof Error) throw output;
|
|
56
|
-
return output;
|
|
38
|
+
return inquiry(
|
|
39
|
+
pack,
|
|
40
|
+
commander.program,
|
|
41
|
+
inquirer.createPromptModule,
|
|
42
|
+
action,
|
|
43
|
+
);
|
|
57
44
|
};
|
|
58
45
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import comments from "comment-json";
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
|
|
4
4
|
import { TypiaSetupWizard } from "../TypiaSetupWizard";
|
|
@@ -8,21 +8,21 @@ export namespace PluginConfigurator {
|
|
|
8
8
|
args: TypiaSetupWizard.IArguments,
|
|
9
9
|
): Promise<void> {
|
|
10
10
|
// GET COMPILER-OPTIONS
|
|
11
|
-
const comments =
|
|
12
|
-
const config: CommentObject = comments.parse(
|
|
11
|
+
const config: comments.CommentObject = comments.parse(
|
|
13
12
|
await fs.promises.readFile(args.project!, "utf8"),
|
|
14
|
-
) as CommentObject;
|
|
15
|
-
const compilerOptions
|
|
16
|
-
|
|
13
|
+
) as comments.CommentObject;
|
|
14
|
+
const compilerOptions = config.compilerOptions as
|
|
15
|
+
| comments.CommentObject
|
|
16
|
+
| undefined;
|
|
17
17
|
if (compilerOptions === undefined)
|
|
18
18
|
throw new Error(
|
|
19
19
|
`${args.project} file does not have "compilerOptions" property.`,
|
|
20
20
|
);
|
|
21
21
|
|
|
22
22
|
// PREPARE PLUGINS
|
|
23
|
-
const plugins: CommentArray<CommentObject> = (() => {
|
|
23
|
+
const plugins: comments.CommentArray<comments.CommentObject> = (() => {
|
|
24
24
|
const plugins = compilerOptions.plugins as
|
|
25
|
-
| CommentArray<CommentObject>
|
|
25
|
+
| comments.CommentArray<comments.CommentObject>
|
|
26
26
|
| undefined;
|
|
27
27
|
if (plugins === undefined)
|
|
28
28
|
return (compilerOptions.plugins = [] as any);
|
|
@@ -34,7 +34,7 @@ export namespace PluginConfigurator {
|
|
|
34
34
|
})();
|
|
35
35
|
|
|
36
36
|
const strict: boolean = compilerOptions.strict === true;
|
|
37
|
-
const oldbie: CommentObject | undefined = plugins.find(
|
|
37
|
+
const oldbie: comments.CommentObject | undefined = plugins.find(
|
|
38
38
|
(p) =>
|
|
39
39
|
typeof p === "object" &&
|
|
40
40
|
p !== null &&
|
|
@@ -49,7 +49,7 @@ export namespace PluginConfigurator {
|
|
|
49
49
|
comments.parse(`
|
|
50
50
|
{
|
|
51
51
|
"transform": "typia/lib/transform"
|
|
52
|
-
}`) as CommentObject,
|
|
52
|
+
}`) as comments.CommentObject,
|
|
53
53
|
);
|
|
54
54
|
await fs.promises.writeFile(
|
|
55
55
|
args.project!,
|
package/src/executable/typia.ts
CHANGED
|
@@ -29,7 +29,7 @@ async function main(): Promise<void> {
|
|
|
29
29
|
await import("inquirer");
|
|
30
30
|
await import("commander");
|
|
31
31
|
} catch {
|
|
32
|
-
halt(
|
|
32
|
+
halt(`typia has not been installed. Run "npm i typia" before.`);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
const type: string | undefined = process.argv[2];
|
|
@@ -41,11 +41,7 @@ async function main(): Promise<void> {
|
|
|
41
41
|
await import("typescript");
|
|
42
42
|
} catch {
|
|
43
43
|
halt(
|
|
44
|
-
|
|
45
|
-
"Please install typescript.",
|
|
46
|
-
"",
|
|
47
|
-
" - npm install --save-dev typescript",
|
|
48
|
-
].join("\n"),
|
|
44
|
+
`typescript has not been installed. Run "npm i -D typescript" before.`,
|
|
49
45
|
);
|
|
50
46
|
}
|
|
51
47
|
const { TypiaGenerateWizard } = await import("./TypiaGenerateWizard");
|