@nestia/core 1.0.9 → 1.0.11
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 +34 -285
- package/lib/decorators/DynamicModule.d.ts +20 -1
- package/lib/decorators/DynamicModule.js +22 -3
- package/lib/decorators/DynamicModule.js.map +1 -1
- package/lib/decorators/EncryptedBody.d.ts +8 -7
- package/lib/decorators/EncryptedBody.js +8 -7
- package/lib/decorators/EncryptedBody.js.map +1 -1
- package/lib/decorators/EncryptedRoute.d.ts +7 -8
- package/lib/decorators/EncryptedRoute.js +9 -9
- package/lib/decorators/EncryptedRoute.js.map +1 -1
- package/lib/decorators/TypedBody.d.ts +8 -6
- package/lib/decorators/TypedBody.js +8 -6
- package/lib/decorators/TypedBody.js.map +1 -1
- package/lib/decorators/TypedParam.d.ts +5 -5
- package/lib/decorators/TypedParam.js +5 -5
- package/lib/decorators/TypedQuery.d.ts +14 -1
- package/lib/decorators/TypedQuery.js +18 -1
- package/lib/decorators/TypedQuery.js.map +1 -1
- package/lib/decorators/TypedRoute.d.ts +6 -5
- package/lib/decorators/TypedRoute.js +6 -5
- package/lib/decorators/TypedRoute.js.map +1 -1
- package/lib/decorators/internal/TransformError.d.ts +1 -0
- package/lib/decorators/internal/TransformError.js +11 -0
- package/lib/decorators/internal/TransformError.js.map +1 -0
- package/lib/decorators/internal/get_path_and_stringify.js +2 -1
- package/lib/decorators/internal/get_path_and_stringify.js.map +1 -1
- package/lib/decorators/internal/validate_request_body.js +2 -1
- package/lib/decorators/internal/validate_request_body.js.map +1 -1
- package/lib/executable/core.js +45 -23
- package/lib/executable/core.js.map +1 -1
- package/lib/executable/internal/ArgumentParser.d.ts +9 -0
- package/lib/executable/internal/ArgumentParser.js +269 -0
- package/lib/executable/internal/ArgumentParser.js.map +1 -0
- package/lib/executable/internal/CommandExecutor.d.ts +3 -0
- package/lib/executable/internal/CommandExecutor.js +17 -0
- package/lib/executable/internal/CommandExecutor.js.map +1 -0
- package/lib/executable/internal/PackageManager.d.ts +27 -0
- package/lib/executable/internal/PackageManager.js +140 -0
- package/lib/executable/internal/PackageManager.js.map +1 -0
- package/lib/executable/internal/PluginConfigurator.d.ts +5 -0
- package/lib/executable/internal/PluginConfigurator.js +168 -0
- package/lib/executable/internal/PluginConfigurator.js.map +1 -0
- package/package.json +8 -3
- package/src/decorators/DynamicModule.ts +21 -2
- package/src/decorators/EncryptedBody.ts +12 -8
- package/src/decorators/EncryptedRoute.ts +10 -11
- package/src/decorators/TypedBody.ts +9 -6
- package/src/decorators/TypedParam.ts +6 -6
- package/src/decorators/TypedQuery.ts +22 -3
- package/src/decorators/TypedRoute.ts +7 -5
- package/src/decorators/internal/TransformError.ts +8 -0
- package/src/decorators/internal/get_path_and_stringify.ts +3 -4
- package/src/decorators/internal/validate_request_body.ts +3 -4
- package/src/executable/core.ts +39 -18
- package/src/executable/internal/ArgumentParser.ts +144 -0
- package/src/executable/internal/CommandExecutor.ts +8 -0
- package/src/executable/internal/PackageManager.ts +99 -0
- package/src/executable/internal/PluginConfigurator.ts +128 -0
- package/lib/executable/internal/CommandParser.d.ts +0 -3
- package/lib/executable/internal/CommandParser.js +0 -21
- package/lib/executable/internal/CommandParser.js.map +0 -1
- package/lib/executable/internal/CoreSetupWizard.d.ts +0 -8
- package/lib/executable/internal/CoreSetupWizard.js +0 -271
- package/lib/executable/internal/CoreSetupWizard.js.map +0 -1
- package/src/executable/internal/CommandParser.ts +0 -15
- package/src/executable/internal/CoreSetupWizard.ts +0 -225
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* URL parameter decorator
|
|
2
|
+
* Type safe URL parameter decorator.
|
|
3
3
|
*
|
|
4
|
-
* `TypedParam` is a decorator function getting specific typed parameter from the
|
|
5
|
-
* request URL. It's almost same with the {@link nest.Param}, but `TypedParam`
|
|
6
|
-
* the parameter type manually. Beside, the {@link nest.Param} always
|
|
7
|
-
* parameters as string type.
|
|
4
|
+
* `TypedParam` is a decorator function getting specific typed parameter from the
|
|
5
|
+
* HTTP request URL. It's almost same with the {@link nest.Param}, but `TypedParam`
|
|
6
|
+
* can specify the parameter type manually. Beside, the {@link nest.Param} always
|
|
7
|
+
* parses all of the parameters as string type.
|
|
8
8
|
*
|
|
9
9
|
* ```typescript
|
|
10
10
|
* \@TypedRoute.Get("shopping/sales/:section/:id/:paused")
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TypedParam = void 0;
|
|
4
4
|
var common_1 = require("@nestjs/common");
|
|
5
5
|
/**
|
|
6
|
-
* URL parameter decorator
|
|
6
|
+
* Type safe URL parameter decorator.
|
|
7
7
|
*
|
|
8
|
-
* `TypedParam` is a decorator function getting specific typed parameter from the
|
|
9
|
-
* request URL. It's almost same with the {@link nest.Param}, but `TypedParam`
|
|
10
|
-
* the parameter type manually. Beside, the {@link nest.Param} always
|
|
11
|
-
* parameters as string type.
|
|
8
|
+
* `TypedParam` is a decorator function getting specific typed parameter from the
|
|
9
|
+
* HTTP request URL. It's almost same with the {@link nest.Param}, but `TypedParam`
|
|
10
|
+
* can specify the parameter type manually. Beside, the {@link nest.Param} always
|
|
11
|
+
* parses all of the parameters as string type.
|
|
12
12
|
*
|
|
13
13
|
* ```typescript
|
|
14
14
|
* \@TypedRoute.Get("shopping/sales/:section/:id/:paused")
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Type safe URL query decorator.
|
|
3
|
+
*
|
|
4
|
+
* `TypedQuery` is a decorator function that can parse URL query string. It is almost
|
|
5
|
+
* same with {@link nest.Query}, but it can automatically cast property type following
|
|
6
|
+
* its DTO definition. Also, `TypedQuery` performs type validation.
|
|
7
|
+
*
|
|
8
|
+
* For referecen, when URL query parameters are different with their promised
|
|
9
|
+
* type `T`, `BadRequestException` error (status code: 400) would be thrown.
|
|
10
|
+
*
|
|
11
|
+
* @returns Parameter decorator
|
|
12
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
13
|
+
*/
|
|
14
|
+
export declare function TypedQuery<T>(decoder?: (params: URLSearchParams) => T): ParameterDecorator;
|
|
@@ -39,9 +39,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.TypedQuery = void 0;
|
|
40
40
|
var common_1 = require("@nestjs/common");
|
|
41
41
|
var typia_1 = require("typia");
|
|
42
|
+
var TransformError_1 = require("./internal/TransformError");
|
|
43
|
+
/**
|
|
44
|
+
* Type safe URL query decorator.
|
|
45
|
+
*
|
|
46
|
+
* `TypedQuery` is a decorator function that can parse URL query string. It is almost
|
|
47
|
+
* same with {@link nest.Query}, but it can automatically cast property type following
|
|
48
|
+
* its DTO definition. Also, `TypedQuery` performs type validation.
|
|
49
|
+
*
|
|
50
|
+
* For referecen, when URL query parameters are different with their promised
|
|
51
|
+
* type `T`, `BadRequestException` error (status code: 400) would be thrown.
|
|
52
|
+
*
|
|
53
|
+
* @returns Parameter decorator
|
|
54
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
55
|
+
*/
|
|
42
56
|
function TypedQuery(decoder) {
|
|
43
57
|
if (decoder === undefined)
|
|
44
|
-
throw
|
|
58
|
+
throw (0, TransformError_1.TransformError)("TypedQuery");
|
|
45
59
|
return (0, common_1.createParamDecorator)(function TypedQuery(_unknown, ctx) {
|
|
46
60
|
return __awaiter(this, void 0, void 0, function () {
|
|
47
61
|
var request, params;
|
|
@@ -76,6 +90,9 @@ exports.TypedQuery = TypedQuery;
|
|
|
76
90
|
TypedQuery.string = string;
|
|
77
91
|
})(TypedQuery = exports.TypedQuery || (exports.TypedQuery = {}));
|
|
78
92
|
Object.assign(TypedQuery, typia_1.assert);
|
|
93
|
+
/**
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
79
96
|
function tail(url) {
|
|
80
97
|
var index = url.indexOf("?");
|
|
81
98
|
return index === -1 ? "" : url.substring(index + 1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypedQuery.js","sourceRoot":"","sources":["../../src/decorators/TypedQuery.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAwE;AAGxE,+BAA+B;AAE/B,SAAgB,UAAU,
|
|
1
|
+
{"version":3,"file":"TypedQuery.js","sourceRoot":"","sources":["../../src/decorators/TypedQuery.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAwE;AAGxE,+BAA+B;AAE/B,4DAA2D;AAE3D;;;;;;;;;;;;GAYG;AACH,SAAgB,UAAU,CACtB,OAAwC;IAExC,IAAI,OAAO,KAAK,SAAS;QAAE,MAAM,IAAA,+BAAc,EAAC,YAAY,CAAC,CAAC;IAE9D,OAAO,IAAA,6BAAoB,EAAC,SAAe,UAAU,CACjD,QAAa,EACb,GAAqB;;;;gBAEf,OAAO,GAAoB,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;gBAC3D,MAAM,GAAoB,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;gBACvE,sBAAO,OAAO,CAAC,MAAM,CAAC,EAAC;;;KAC1B,CAAC,EAAE,CAAC;AACT,CAAC;AAbD,gCAaC;AAED;;GAEG;AACH,WAAiB,UAAU;IACvB,SAAgB,OAAO,CAAC,GAAkB;QACtC,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACnD,CAAC;IAFe,kBAAO,UAEtB,CAAA;IACD,SAAgB,MAAM,CAAC,GAAkB;QACrC,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAClD,CAAC;IAFe,iBAAM,SAErB,CAAA;IACD,SAAgB,MAAM,CAAC,GAAkB;QACrC,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAClD,CAAC;IAFe,iBAAM,SAErB,CAAA;IACD,SAAgB,MAAM,CAAC,GAAkB;QACrC,OAAO,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,SAAS,CAAC;IAC5B,CAAC;IAFe,iBAAM,SAErB,CAAA;AACL,CAAC,EAbgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAa1B;AACD,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,cAAM,CAAC,CAAC;AAElC;;GAEG;AACH,SAAS,IAAI,CAAC,GAAW;IACrB,IAAM,KAAK,GAAW,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACvC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { IResponseBodyStringifier } from "../options/IResponseBodyStringifier";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Type safe router decorator functions.
|
|
4
4
|
*
|
|
5
5
|
* `TypedRoute` is a module containing router decorator functions which can boost up
|
|
6
|
-
* JSON string conversion speed about
|
|
7
|
-
*
|
|
6
|
+
* JSON string conversion speed about 50x times faster than `class-transformer`.
|
|
7
|
+
* Furthermore, such JSON string conversion is even type safe through
|
|
8
|
+
* [typia](https://github.com/samchon/typia).
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
* regular {@link nest.HttpException} class automatically, through
|
|
10
|
+
* For reference, router functions of `TypedRoute` can convert custom error classes to
|
|
11
|
+
* the regular {@link nest.HttpException} class automatically, through
|
|
11
12
|
* {@link ExceptionManager}.
|
|
12
13
|
*
|
|
13
14
|
* @author Jeongho Nam - https://github.com/samchon
|
|
@@ -44,14 +44,15 @@ var typia_1 = require("typia");
|
|
|
44
44
|
var get_path_and_stringify_1 = require("./internal/get_path_and_stringify");
|
|
45
45
|
var route_error_1 = require("./internal/route_error");
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Type safe router decorator functions.
|
|
48
48
|
*
|
|
49
49
|
* `TypedRoute` is a module containing router decorator functions which can boost up
|
|
50
|
-
* JSON string conversion speed about
|
|
51
|
-
*
|
|
50
|
+
* JSON string conversion speed about 50x times faster than `class-transformer`.
|
|
51
|
+
* Furthermore, such JSON string conversion is even type safe through
|
|
52
|
+
* [typia](https://github.com/samchon/typia).
|
|
52
53
|
*
|
|
53
|
-
*
|
|
54
|
-
* regular {@link nest.HttpException} class automatically, through
|
|
54
|
+
* For reference, router functions of `TypedRoute` can convert custom error classes to
|
|
55
|
+
* the regular {@link nest.HttpException} class automatically, through
|
|
55
56
|
* {@link ExceptionManager}.
|
|
56
57
|
*
|
|
57
58
|
* @author Jeongho Nam - https://github.com/samchon
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypedRoute.js","sourceRoot":"","sources":["../../src/decorators/TypedRoute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAWwB;AAGxB,6BAAmD;
|
|
1
|
+
{"version":3,"file":"TypedRoute.js","sourceRoot":"","sources":["../../src/decorators/TypedRoute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAWwB;AAGxB,6BAAmD;AAEnD,+BAKe;AAGf,4EAA2E;AAC3E,sDAAqD;AAErD;;;;;;;;;;;;;GAaG;AACH,IAAiB,UAAU,CAiE1B;AAjED,WAAiB,UAAU;IACvB;;;;;OAKG;IACU,cAAG,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAEpC;;;;;OAKG;IACU,eAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAEtC;;;;;OAKG;IACU,gBAAK,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;;;aAAA;;;;;;;;;KAAA;;;;;;;;;AAEvC;;GAEG;AACH;IACI,+BAAoC,SAAiC;QAAjC,cAAS,GAAT,SAAS,CAAwB;IAAG,CAAC;IAElE,yCAAS,GAAhB,UACI,OAAyB,EACzB,IAAiB;QAFrB,iBAYC;QARG,IAAM,IAAI,GAAsB,OAAO,CAAC,YAAY,EAAE,CAAC;QACvD,IAAM,QAAQ,GAAqB,IAAI,CAAC,WAAW,EAAE,CAAC;QACtD,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QAEpD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CACrB,IAAA,UAAG,EAAC,UAAC,KAAK,IAAK,OAAA,KAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAArB,CAAqB,CAAC,EACrC,IAAA,iBAAU,EAAC,UAAC,GAAG,IAAK,OAAA,IAAA,yBAAW,EAAC,IAAI,CAAC,UAAU,EAAE,EAAE,GAAG,CAAC,EAAnC,CAAmC,CAAC,CAC3D,CAAC;IACN,CAAC;IACL,4BAAC;AAAD,CAAC,AAhBD,IAgBC;AAED;;GAEG;AACH,IAAM,OAAO,GAAG;IACZ,GAAG,cAAA;IACH,IAAI,eAAA;IACJ,KAAK,gBAAA;IACL,GAAG,cAAA;IACH,MAAM,iBAAA;CACT,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransformError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
function TransformError(method) {
|
|
8
|
+
return new Error("Error on nestia.core.".concat(method, "(): no transform has been configured. Configure \"tsconfig.json\" file following [Guide Documents](https://github.com/samchon/nestia/wiki/Setup#tsconfigjson)."));
|
|
9
|
+
}
|
|
10
|
+
exports.TransformError = TransformError;
|
|
11
|
+
//# sourceMappingURL=TransformError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransformError.js","sourceRoot":"","sources":["../../../src/decorators/internal/TransformError.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,SAAgB,cAAc,CAAC,MAAc;IACzC,OAAO,IAAI,KAAK,CACZ,+BAAwB,MAAM,mKAA8J,CAC/L,CAAC;AACN,CAAC;AAJD,wCAIC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.get_path_and_stringify = void 0;
|
|
4
4
|
var common_1 = require("@nestjs/common");
|
|
5
5
|
var typia_1 = require("typia");
|
|
6
|
+
var TransformError_1 = require("./TransformError");
|
|
6
7
|
var get_path_and_stringify = function (method) {
|
|
7
8
|
return function () {
|
|
8
9
|
var args = [];
|
|
@@ -22,7 +23,7 @@ exports.get_path_and_stringify = get_path_and_stringify;
|
|
|
22
23
|
var take = function (method) {
|
|
23
24
|
return function (functor) {
|
|
24
25
|
if (functor === undefined)
|
|
25
|
-
throw
|
|
26
|
+
throw (0, TransformError_1.TransformError)(method);
|
|
26
27
|
else if (functor === null)
|
|
27
28
|
return JSON.stringify;
|
|
28
29
|
else if (functor.type === "stringify")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_path_and_stringify.js","sourceRoot":"","sources":["../../../src/decorators/internal/get_path_and_stringify.ts"],"names":[],"mappings":";;;AAAA,yCAA8D;
|
|
1
|
+
{"version":3,"file":"get_path_and_stringify.js","sourceRoot":"","sources":["../../../src/decorators/internal/get_path_and_stringify.ts"],"names":[],"mappings":";;;AAAA,yCAA8D;AAE9D,+BAAoD;AAGpD,mDAAkD;AAE3C,IAAM,sBAAsB,GAC/B,UAAC,MAAc;IACf,OAAA;QACI,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QAEd,IAAM,IAAI,GACN,IAAI,CAAC,CAAC,CAAC,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IAAO;QACJ,IAAI;YACA,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;SACxB;QAAC,OAAO,GAAG,EAAE;YACV,IAAI,GAAG,YAAY,sBAAc,EAAE;gBAC/B,MAAM,IAAI,qCAA4B,CAAC;oBACnC,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,MAAM,EAAE,GAAG,CAAC,OAAO;oBACnB,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,KAAK,EAAE,GAAG,CAAC,KAAK;oBAChB,OAAO,EAAE,OAAO;iBACnB,CAAC,CAAC;aACN;YACD,MAAM,GAAG,CAAC;SACb;IACL,CAAC;AAfD,CAeC,CAAC;AAEN,IAAM,EAAE,GACJ,UAAI,OAAmC;IACvC,OAAA,UAAC,IAAO;QACJ,IAAM,MAAM,GAAkB,OAAO,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,MAAM,KAAK,IAAI;YAAE,MAAM,IAAI,qCAA4B,CAAC,OAAO,CAAC,CAAC;QACrE,OAAO,MAAM,CAAC;IAClB,CAAC;AAJD,CAIC,CAAC;AAEN,IAAM,QAAQ,GACV,UAAI,OAAyC;IAC7C,OAAA,UAAC,IAAO;QACJ,IAAM,MAAM,GAAwB,OAAO,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK;YACxB,MAAM,IAAI,qCAA4B,CAAC;gBACnC,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,OAAO,EAAE,OAAO;aACnB,CAAC,CAAC;QACP,OAAO,MAAM,CAAC,IAAI,CAAC;IACvB,CAAC;AARD,CAQC,CAAC;AAEN,IAAM,OAAO,GAAG,wDAAwD,CAAC"}
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.validate_request_body = void 0;
|
|
4
4
|
var common_1 = require("@nestjs/common");
|
|
5
5
|
var typia_1 = require("typia");
|
|
6
|
+
var TransformError_1 = require("./TransformError");
|
|
6
7
|
var validate_request_body = function (method) {
|
|
7
8
|
return function (validator) {
|
|
8
9
|
if (!validator)
|
|
9
|
-
throw
|
|
10
|
+
throw (0, TransformError_1.TransformError)(method);
|
|
10
11
|
else if (validator.type === "assert")
|
|
11
12
|
return assert(validator.assert);
|
|
12
13
|
else if (validator.type === "is")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate_request_body.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_body.ts"],"names":[],"mappings":";;;AAAA,yCAAqD;
|
|
1
|
+
{"version":3,"file":"validate_request_body.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_body.ts"],"names":[],"mappings":";;;AAAA,yCAAqD;AAErD,+BAAoD;AAGpD,mDAAkD;AAE3C,IAAM,qBAAqB,GAC9B,UAAC,MAAc;IACf,OAAA,UAAI,SAAoC;QACpC,IAAI,CAAC,SAAS;YAAE,MAAM,IAAA,+BAAc,EAAC,MAAM,CAAC,CAAC;aACxC,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;aACjE,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;aACrD,IAAI,SAAS,CAAC,IAAI,KAAK,UAAU;YAClC,OAAO,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,IAAI,KAAK,CACX,+BAAwB,MAAM,iCAA8B,CAC/D,CAAC;IACN,CAAC;AATD,CASC,CAAC;AAXO,QAAA,qBAAqB,yBAW5B;AAEN,IAAM,MAAM,GACR,UAAI,OAAuB;IAC3B,OAAA,UAAC,IAAO;QACJ,IAAI;YACA,OAAO,CAAC,IAAI,CAAC,CAAC;SACjB;QAAC,OAAO,GAAG,EAAE;YACV,IAAI,GAAG,YAAY,sBAAc,EAAE;gBAC/B,MAAM,IAAI,4BAAmB,CAAC;oBAC1B,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,MAAM,EAAE,GAAG,CAAC,OAAO;oBACnB,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,KAAK,EAAE,GAAG,CAAC,KAAK;oBAChB,OAAO,EAAE,OAAO;iBACnB,CAAC,CAAC;aACN;YACD,MAAM,GAAG,CAAC;SACb;IACL,CAAC;AAfD,CAeC,CAAC;AAEN,IAAM,EAAE,GACJ,UAAI,OAA6B;IACjC,OAAA,UAAC,IAAO;QACJ,IAAM,OAAO,GAAY,OAAO,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,OAAO,KAAK,KAAK;YAAE,MAAM,IAAI,4BAAmB,CAAC,OAAO,CAAC,CAAC;IAClE,CAAC;AAHD,CAGC,CAAC;AAEN,IAAM,QAAQ,GACV,UAAI,OAAoC;IACxC,OAAA,UAAC,IAAO;QACJ,IAAM,MAAM,GAAmB,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK;YACxB,MAAM,IAAI,4BAAmB,CAAC;gBAC1B,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,OAAO,EAAE,OAAO;aACnB,CAAC,CAAC;IACX,CAAC;AAPD,CAOC,CAAC;AAEN,IAAM,OAAO,GAAG,uDAAuD,CAAC"}
|
package/lib/executable/core.js
CHANGED
|
@@ -37,40 +37,62 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
var
|
|
41
|
-
var
|
|
40
|
+
var ArgumentParser_1 = require("./internal/ArgumentParser");
|
|
41
|
+
var CommandExecutor_1 = require("./internal/CommandExecutor");
|
|
42
|
+
var PackageManager_1 = require("./internal/PackageManager");
|
|
43
|
+
var PluginConfigurator_1 = require("./internal/PluginConfigurator");
|
|
42
44
|
var USAGE = "Wrong command has been detected. Use like below:\n\n npx @nestia/core setup \\\n --compiler (ttypescript|ts-patch) \\\n --manager (npm|pnpm|yarn) \\\n --project {tsconfig.json file path}\n\n - npx @nestia/core setup\n - npx @nestia/core setup --compiler ts-patch\n - npx @nestia/core setup --manager pnpm\n - npx @nestia/core setup --project tsconfig.test.json";
|
|
43
45
|
function halt(desc) {
|
|
44
46
|
console.error(desc);
|
|
45
47
|
process.exit(-1);
|
|
46
48
|
}
|
|
47
49
|
function setup() {
|
|
48
|
-
var _a
|
|
50
|
+
var _a;
|
|
49
51
|
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
-
var
|
|
51
|
-
return __generator(this, function (
|
|
52
|
-
switch (
|
|
52
|
+
var pack, args;
|
|
53
|
+
return __generator(this, function (_b) {
|
|
54
|
+
switch (_b.label) {
|
|
53
55
|
case 0:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
console.log(options);
|
|
59
|
-
if (!((compiler !== "ttypescript" && compiler !== "ts-patch") ||
|
|
60
|
-
(manager !== "npm" && manager !== "pnpm" && manager !== "yarn"))) return [3 /*break*/, 1];
|
|
61
|
-
halt(USAGE);
|
|
62
|
-
return [3 /*break*/, 5];
|
|
56
|
+
console.log("----------------------------------------");
|
|
57
|
+
console.log(" Nestia Setup Wizard");
|
|
58
|
+
console.log("----------------------------------------");
|
|
59
|
+
return [4 /*yield*/, PackageManager_1.PackageManager.mount()];
|
|
63
60
|
case 1:
|
|
64
|
-
|
|
65
|
-
return [4 /*yield*/,
|
|
61
|
+
pack = _b.sent();
|
|
62
|
+
return [4 /*yield*/, ArgumentParser_1.ArgumentParser.parse(pack)];
|
|
66
63
|
case 2:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
args = _b.sent();
|
|
65
|
+
// INSTALL TYPESCRIPT
|
|
66
|
+
pack.install({ dev: true, modulo: "typescript" });
|
|
67
|
+
(_a = args.project) !== null && _a !== void 0 ? _a : (args.project = (function () {
|
|
68
|
+
CommandExecutor_1.CommandExecutor.run("npx tsc --init", false);
|
|
69
|
+
return (args.project = "tsconfig.json");
|
|
70
|
+
})());
|
|
71
|
+
pack.install({ dev: true, modulo: "ts-node" });
|
|
72
|
+
// INSTALL COMPILER
|
|
73
|
+
pack.install({ dev: true, modulo: args.compiler });
|
|
74
|
+
if (!(args.compiler === "ts-patch")) return [3 /*break*/, 4];
|
|
75
|
+
return [4 /*yield*/, pack.save(function (data) {
|
|
76
|
+
var _a;
|
|
77
|
+
(_a = data.scripts) !== null && _a !== void 0 ? _a : (data.scripts = {});
|
|
78
|
+
if (typeof data.scripts.prepare === "string")
|
|
79
|
+
data.scripts.prepare =
|
|
80
|
+
"ts-patch install && " + data.scripts.prepare;
|
|
81
|
+
else
|
|
82
|
+
data.scripts.prepare = "ts-patch install";
|
|
83
|
+
})];
|
|
84
|
+
case 3:
|
|
85
|
+
_b.sent();
|
|
86
|
+
CommandExecutor_1.CommandExecutor.run("npm run prepare", false);
|
|
87
|
+
_b.label = 4;
|
|
70
88
|
case 4:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
89
|
+
// INSTALL AND CONFIGURE TYPIA
|
|
90
|
+
pack.install({ dev: false, modulo: "typia" });
|
|
91
|
+
pack.install({ dev: false, modulo: "@nestia/core" });
|
|
92
|
+
return [4 /*yield*/, PluginConfigurator_1.PluginConfigurator.configure(pack, args)];
|
|
93
|
+
case 5:
|
|
94
|
+
_b.sent();
|
|
95
|
+
return [2 /*return*/];
|
|
74
96
|
}
|
|
75
97
|
});
|
|
76
98
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/executable/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/executable/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4DAA2D;AAC3D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|
+
export declare namespace ArgumentParser {
|
|
3
|
+
interface IArguments {
|
|
4
|
+
compiler: "ts-patch" | "ttypescript";
|
|
5
|
+
manager: "npm" | "pnpm" | "yarn";
|
|
6
|
+
project: string | null;
|
|
7
|
+
}
|
|
8
|
+
function parse(pack: PackageManager): Promise<IArguments>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,269 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
|
+
};
|
|
64
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
+
exports.ArgumentParser = void 0;
|
|
66
|
+
var fs_1 = __importDefault(require("fs"));
|
|
67
|
+
var path_1 = __importDefault(require("path"));
|
|
68
|
+
var ArgumentParser;
|
|
69
|
+
(function (ArgumentParser) {
|
|
70
|
+
function parse(pack) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
+
var newbie, output;
|
|
73
|
+
var _this = this;
|
|
74
|
+
return __generator(this, function (_a) {
|
|
75
|
+
switch (_a.label) {
|
|
76
|
+
case 0:
|
|
77
|
+
newbie = {
|
|
78
|
+
commander: pack.install({
|
|
79
|
+
dev: true,
|
|
80
|
+
modulo: "commander",
|
|
81
|
+
version: "10.0.0",
|
|
82
|
+
silent: true,
|
|
83
|
+
}),
|
|
84
|
+
inquirer: pack.install({
|
|
85
|
+
dev: true,
|
|
86
|
+
modulo: "inquirer",
|
|
87
|
+
version: "8.2.5",
|
|
88
|
+
silent: true,
|
|
89
|
+
}),
|
|
90
|
+
};
|
|
91
|
+
return [4 /*yield*/, (function () { return __awaiter(_this, void 0, void 0, function () {
|
|
92
|
+
var error_1;
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
switch (_a.label) {
|
|
95
|
+
case 0:
|
|
96
|
+
_a.trys.push([0, 2, , 3]);
|
|
97
|
+
return [4 /*yield*/, _Parse(pack)];
|
|
98
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
99
|
+
case 2:
|
|
100
|
+
error_1 = _a.sent();
|
|
101
|
+
return [2 /*return*/, error_1];
|
|
102
|
+
case 3: return [2 /*return*/];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}); })()];
|
|
106
|
+
case 1:
|
|
107
|
+
output = _a.sent();
|
|
108
|
+
// REMOVE TEMPORARY PACKAGES
|
|
109
|
+
if (newbie.commander)
|
|
110
|
+
pack.erase({ modulo: "commander", silent: true });
|
|
111
|
+
if (newbie.inquirer)
|
|
112
|
+
pack.erase({ modulo: "inquirer", silent: true });
|
|
113
|
+
// RETURNS
|
|
114
|
+
if (output instanceof Error)
|
|
115
|
+
throw output;
|
|
116
|
+
return [2 /*return*/, output];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
ArgumentParser.parse = parse;
|
|
122
|
+
function _Parse(pack) {
|
|
123
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124
|
+
var createPromptModule, program, questioned, action, select, configure;
|
|
125
|
+
var _this = this;
|
|
126
|
+
return __generator(this, function (_a) {
|
|
127
|
+
var _b, _c;
|
|
128
|
+
switch (_a.label) {
|
|
129
|
+
case 0: return [4 /*yield*/, (_b = path_1.default.join(pack.directory, "node_modules", "inquirer"), Promise.resolve().then(function () { return __importStar(require(_b)); }))];
|
|
130
|
+
case 1:
|
|
131
|
+
createPromptModule = (_a.sent()).createPromptModule;
|
|
132
|
+
return [4 /*yield*/, (_c = path_1.default.join(pack.directory, "node_modules", "commander"), Promise.resolve().then(function () { return __importStar(require(_c)); }))];
|
|
133
|
+
case 2:
|
|
134
|
+
program = (_a.sent()).program;
|
|
135
|
+
program.option("--compiler [compiler]", "compiler type");
|
|
136
|
+
program.option("--manager [manager", "package manager");
|
|
137
|
+
program.option("--project [project]", "tsconfig.json file location");
|
|
138
|
+
questioned = { value: false };
|
|
139
|
+
action = function (closure) {
|
|
140
|
+
return new Promise(function (resolve, reject) {
|
|
141
|
+
program.action(function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
142
|
+
var _a, exp_1;
|
|
143
|
+
return __generator(this, function (_b) {
|
|
144
|
+
switch (_b.label) {
|
|
145
|
+
case 0:
|
|
146
|
+
_b.trys.push([0, 2, , 3]);
|
|
147
|
+
_a = resolve;
|
|
148
|
+
return [4 /*yield*/, closure(options)];
|
|
149
|
+
case 1:
|
|
150
|
+
_a.apply(void 0, [_b.sent()]);
|
|
151
|
+
return [3 /*break*/, 3];
|
|
152
|
+
case 2:
|
|
153
|
+
exp_1 = _b.sent();
|
|
154
|
+
reject(exp_1);
|
|
155
|
+
return [3 /*break*/, 3];
|
|
156
|
+
case 3: return [2 /*return*/];
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}); });
|
|
160
|
+
program.parseAsync().catch(reject);
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
select = function (name) {
|
|
164
|
+
return function (message) {
|
|
165
|
+
return function (choices) { return __awaiter(_this, void 0, void 0, function () {
|
|
166
|
+
return __generator(this, function (_a) {
|
|
167
|
+
switch (_a.label) {
|
|
168
|
+
case 0:
|
|
169
|
+
questioned.value = true;
|
|
170
|
+
return [4 /*yield*/, createPromptModule()({
|
|
171
|
+
type: "list",
|
|
172
|
+
name: name,
|
|
173
|
+
message: message,
|
|
174
|
+
choices: choices,
|
|
175
|
+
})];
|
|
176
|
+
case 1: return [2 /*return*/, (_a.sent())[name]];
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}); };
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
configure = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
183
|
+
var fileList;
|
|
184
|
+
return __generator(this, function (_a) {
|
|
185
|
+
switch (_a.label) {
|
|
186
|
+
case 0: return [4 /*yield*/, fs_1.default.promises.readdir(process.cwd())];
|
|
187
|
+
case 1: return [4 /*yield*/, (_a.sent()).filter(function (str) {
|
|
188
|
+
return str.substring(0, 8) === "tsconfig" &&
|
|
189
|
+
str.substring(str.length - 5) === ".json";
|
|
190
|
+
})];
|
|
191
|
+
case 2:
|
|
192
|
+
fileList = _a.sent();
|
|
193
|
+
if (fileList.length === 0) {
|
|
194
|
+
if (process.cwd() !== pack.directory)
|
|
195
|
+
throw new Error("Unable to find \"tsconfig.json\" file.");
|
|
196
|
+
return [2 /*return*/, null];
|
|
197
|
+
}
|
|
198
|
+
else if (fileList.length === 1)
|
|
199
|
+
return [2 /*return*/, fileList[0]];
|
|
200
|
+
return [2 /*return*/, select("tsconfig")("TS Config File")(fileList)];
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}); };
|
|
204
|
+
// DO CONSTRUCT
|
|
205
|
+
return [2 /*return*/, action(function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
206
|
+
var _a, _b, _c, _d, _e;
|
|
207
|
+
var _f, _g, _h;
|
|
208
|
+
return __generator(this, function (_j) {
|
|
209
|
+
switch (_j.label) {
|
|
210
|
+
case 0:
|
|
211
|
+
if (!(options.compiler === undefined)) return [3 /*break*/, 2];
|
|
212
|
+
console.log(COMPILER_DESCRIPTION);
|
|
213
|
+
_a = options;
|
|
214
|
+
return [4 /*yield*/, select("compiler")("Compiler")(((_f = pack.data.scripts) === null || _f === void 0 ? void 0 : _f.build) === "nest build"
|
|
215
|
+
? ["ts-patch", "ttypescript"]
|
|
216
|
+
: ["ttypescript", "ts-patch"])];
|
|
217
|
+
case 1:
|
|
218
|
+
_a.compiler = _j.sent();
|
|
219
|
+
_j.label = 2;
|
|
220
|
+
case 2:
|
|
221
|
+
if (!((_g = options.manager) !== null && _g !== void 0)) return [3 /*break*/, 3];
|
|
222
|
+
_b = _g;
|
|
223
|
+
return [3 /*break*/, 5];
|
|
224
|
+
case 3:
|
|
225
|
+
_c = options;
|
|
226
|
+
return [4 /*yield*/, select("manager")("Package Manager")([
|
|
227
|
+
"npm",
|
|
228
|
+
"pnpm",
|
|
229
|
+
"yarn",
|
|
230
|
+
])];
|
|
231
|
+
case 4:
|
|
232
|
+
_b = (_c.manager = _j.sent());
|
|
233
|
+
_j.label = 5;
|
|
234
|
+
case 5:
|
|
235
|
+
_b;
|
|
236
|
+
pack.manager = options.manager;
|
|
237
|
+
if (!((_h = options.project) !== null && _h !== void 0)) return [3 /*break*/, 6];
|
|
238
|
+
_d = _h;
|
|
239
|
+
return [3 /*break*/, 8];
|
|
240
|
+
case 6:
|
|
241
|
+
_e = options;
|
|
242
|
+
return [4 /*yield*/, configure()];
|
|
243
|
+
case 7:
|
|
244
|
+
_d = (_e.project = _j.sent());
|
|
245
|
+
_j.label = 8;
|
|
246
|
+
case 8:
|
|
247
|
+
_d;
|
|
248
|
+
if (questioned.value)
|
|
249
|
+
console.log("");
|
|
250
|
+
return [2 /*return*/, options];
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}); })];
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
})(ArgumentParser = exports.ArgumentParser || (exports.ArgumentParser = {}));
|
|
259
|
+
var COMPILER_DESCRIPTION = [
|
|
260
|
+
"About compiler, if you adapt \"ttypescript\", you should use \"ttsc\" instead.",
|
|
261
|
+
"",
|
|
262
|
+
"Otherwise, you choose \"ts-patch\", you can use the original \"tsc\" command.",
|
|
263
|
+
"However, the \"ts-patch\" hacks \"node_modules/typescript\" source code.",
|
|
264
|
+
"Also, whenever update \"typescript\", you've to run \"npm run prepare\" command.",
|
|
265
|
+
"",
|
|
266
|
+
"By the way, when using \"@nest/cli\", you must just choose \"ts-patch\".",
|
|
267
|
+
"",
|
|
268
|
+
].join("\n");
|
|
269
|
+
//# sourceMappingURL=ArgumentParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArgumentParser.js","sourceRoot":"","sources":["../../../src/executable/internal/ArgumentParser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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