nestia 4.0.13 → 4.1.0-dev.20230427
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 +31 -195
- package/bin/NestiaSetupWizard.js +38 -23
- package/bin/NestiaSetupWizard.js.map +1 -1
- package/bin/index.d.ts +1 -1
- package/bin/index.js +3 -5
- package/bin/index.js.map +1 -1
- package/bin/internal/ArgumentParser.d.ts +0 -1
- package/bin/internal/ArgumentParser.js +3 -20
- package/bin/internal/ArgumentParser.js.map +1 -1
- package/package.json +6 -4
- package/src/NestiaSetupWizard.ts +34 -24
- package/src/index.ts +3 -5
- package/src/internal/ArgumentParser.ts +0 -21
package/README.md
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
# Nestia
|
|
2
|
+

|
|
3
|
+
|
|
2
4
|
[](https://github.com/samchon/nestia/blob/master/LICENSE)
|
|
3
|
-
[](https://www.npmjs.com/package/@nestia/core)
|
|
6
|
+
[](https://www.npmjs.com/package/nestia)
|
|
7
|
+
[](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)
|
|
8
|
+
[](https://nestia.io/docs/)
|
|
5
9
|
|
|
6
10
|
Nestia is a set of helper libraries for NestJS, supporting below features:
|
|
7
11
|
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
- **200x faster** JSON serialization
|
|
11
|
-
- [`@nestia/sdk`](#nestiasdk): evolved **SDK** and **Swagger** generators
|
|
12
|
-
- SDK (Software Development Kit)
|
|
13
|
-
- interaction library for client developers
|
|
14
|
-
- almost same with [tRPC](https://github.com/trpc/trpc)
|
|
12
|
+
- `@nestia/core`: super-fast decorators
|
|
13
|
+
- `@nestia/sdk`: evolved SDK and Swagger generator
|
|
15
14
|
- `nestia`: just CLI (command line interface) tool
|
|
16
15
|
|
|
16
|
+
> **Note**
|
|
17
|
+
>
|
|
18
|
+
> - **Only one line** required, with pure TypeScript type
|
|
19
|
+
> - Runtime validator is **20,000x faster** than `class-validator`
|
|
20
|
+
> - JSON serialization is **200x faster** than `class-transformer`
|
|
21
|
+
> - SDK is similar with [tRPC](https://trpc.io), but much advanced
|
|
22
|
+
|
|
17
23
|

|
|
18
24
|
|
|
25
|
+
> Left is server code, and right is client code utilizing SDK
|
|
26
|
+
|
|
19
27
|
|
|
20
28
|
|
|
21
29
|
|
|
@@ -29,191 +37,19 @@ Your donation would encourage `nestia` development.
|
|
|
29
37
|
|
|
30
38
|
|
|
31
39
|
|
|
32
|
-
##
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
npx nestia start <directory>
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Just run above command, then boilerplate project would be constructed.
|
|
39
|
-
|
|
40
|
-
### Setup Wizard
|
|
41
|
-
```bash
|
|
42
|
-
npm install --save-dev nestia
|
|
43
|
-
npx nestia setup
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
If you've installed [ttypescript](https://github.com/cevek/ttypescript) during setup, you should compile `@nestia/core` utilization code through `ttsc` command, instead of `tsc`.
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
# COMPILE THROUGH TTYPESCRIPT
|
|
50
|
-
npx ttsc
|
|
51
|
-
|
|
52
|
-
# RUN TS-NODE WITH TTYPESCRIPT
|
|
53
|
-
npx ts-node -C ttypescript src/index.ts
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Otherwise, you've chosen [ts-patch](https://github.com/nonara/ts-patch), you can use original `tsc` command. However, [ts-patch](https://github.com/nonara/ts-patch) hacks `node_modules/typescript` source code. Also, whenever update `typescript` version, you've to run `npm run prepare` command repeatedly.
|
|
57
|
-
|
|
58
|
-
By the way, when using `@nest/cli`, you must just choose [ts-patch](https://github.com/nonara/ts-patch).
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
# USE ORIGINAL TSC COMMAND
|
|
62
|
-
tsc
|
|
63
|
-
npx ts-node src/index.ts
|
|
64
|
-
|
|
65
|
-
# WHENVER UPDATE
|
|
66
|
-
npm install --save-dev typescript@latest
|
|
67
|
-
npm run prepare
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### Manual Setup
|
|
71
|
-
If you want to install and configure `nestia` manually, read [Guide Documents -> Setup](https://github.com/samchon/nestia/wiki/Setup).
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
## `@nestia/core`
|
|
77
|
-
[](https://www.npmjs.com/package/@nestia/core)
|
|
78
|
-
[](https://www.npmjs.com/package/@nestia/core)
|
|
79
|
-
|
|
80
|
-
Super-fast validation decorators for NestJS.
|
|
81
|
-
|
|
82
|
-
- 15,000x faster request body validation
|
|
83
|
-
- 100x faster JSON response, even type safe
|
|
84
|
-
- Do not need DTO class definition, just fine with interface
|
|
85
|
-
|
|
86
|
-
`@nestia/core` is a transformer library of NestJS, supporting super-fast validation decorators, by wrapping [typia](https://github.com/samchon/typia). Comparing validation speed with `class-validator`, [typia](https://github.com/samchon/typia) is maximum **15,000x times faster** and it is even much safer.
|
|
87
|
-
|
|
88
|
-
Furthermore, `@nestia/core` can use pure interface typed DTO with **only one line**. With `@nestia/core`, you don't need any extra dedication like defining JSON schema (`@nestjs/swagger`), or using class definition with decorator function calls (`class-validator`). Just enjoy the superfast decorators with pure TypeScript type.
|
|
40
|
+
## Guide Documents
|
|
41
|
+
Check out the document in the [website](https://nestia.io/docs/):
|
|
89
42
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
43
|
+
### 🏠 Home
|
|
44
|
+
- [Introduction](https://nestia.io/docs/)
|
|
45
|
+
- [Setup](https://nestia.io/docs/setup/)
|
|
93
46
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
*/
|
|
104
|
-
@TypedRoute.Post() // 50x faster and safer JSON.stringify()
|
|
105
|
-
public async store(
|
|
106
|
-
@TypedBody() input: IBbsArticle.IStore // super-fast validator
|
|
107
|
-
): Promise<IBbsArticle>;
|
|
108
|
-
// do not need DTO class definition,
|
|
109
|
-
// just fine with interface
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
If you want to know more about this core library, visit [Guide Documents](https://github.com/samchon/nestia/wiki).
|
|
114
|
-
|
|
115
|
-
- Decorators
|
|
116
|
-
- [TypedRoute](https://github.com/samchon/nestia/wiki/Core-Library#typedroute)
|
|
117
|
-
- [TypedBody](https://github.com/samchon/nestia/wiki/Core-Library#typedbody)
|
|
118
|
-
- [TypedQuery](https://github.com/samchon/nestia/wiki/Core-Library#typedquery)
|
|
119
|
-
- [TypedParam](https://github.com/samchon/nestia/wiki/Core-Library#typedparam)
|
|
120
|
-
- Enhancements
|
|
121
|
-
- [Comment Tags](https://github.com/samchon/nestia/wiki/Core-Library#comment-tags)
|
|
122
|
-
- [Configuration](https://github.com/samchon/nestia/wiki/Core-Library#configuration)
|
|
123
|
-
- Advanced Usage
|
|
124
|
-
- [DynamicModule](https://github.com/samchon/nestia/wiki/Core-Library#dynamicmodule)
|
|
125
|
-
- [Encryption](https://github.com/samchon/nestia/wiki/Core-Library#encryption)
|
|
126
|
-
- [Inheritance](https://github.com/samchon/nestia/wiki/Core-Library#inheritance)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
## `@nestia/sdk`
|
|
132
|
-
[](https://www.npmjs.com/package/@nestia/sdk)
|
|
133
|
-
[](https://www.npmjs.com/package/@nestia/sdk)
|
|
134
|
-
|
|
135
|
-
Automatic *SDK* and *Swagger* generator for [@nestia/core](#nestiacore).
|
|
136
|
-
|
|
137
|
-
With [@nestia/core](#nestiacore), you can boost up validation speed maximum **15,000x times faster**. However, as `@nestjs/swagger` does not support [@nestia/core](#nestiacore), you can't generate swagger documents from `@nestjs/swagger` more.
|
|
138
|
-
|
|
139
|
-
Instead, I provide you `@nestia/sdk` module, which can generate not only swagger documents, but also SDK (Software Development Kit) library. The SDK library can be utilized by client developers and it is almost same with `tRPC`.
|
|
140
|
-
|
|
141
|
-
### Usage
|
|
142
|
-
```bash
|
|
143
|
-
# BASIC COMMAND
|
|
144
|
-
npx nestia <sdk|swagger> <source_directories_or_patterns> \
|
|
145
|
-
--exclude <exclude_directory_or_pattern> \
|
|
146
|
-
--out <output_directory_or_file>
|
|
147
|
-
|
|
148
|
-
# EXAMPLES
|
|
149
|
-
npx nestia sdk "src/**/*.controller.ts" --out "src/api"
|
|
150
|
-
npx nestia swagger "src/controllers" --out "dist/swagger.json"
|
|
151
|
-
|
|
152
|
-
# ONLY WHEN "nestia.config.ts" FILE EXISTS
|
|
153
|
-
npx nestia sdk
|
|
154
|
-
npx nestia swagger
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
You can generate sdk or swagger documents by above commands.
|
|
158
|
-
|
|
159
|
-
If you want to know more, visit [Guide Documents](https://github.com/samchon/nestia/wiki).
|
|
160
|
-
|
|
161
|
-
- Generators
|
|
162
|
-
- [Swagger Documents](https://github.com/samchon/nestia/wiki/SDK-Generator#swagger-documents)
|
|
163
|
-
- [SDK Library](https://github.com/samchon/nestia/wiki/SDK-Generator#sdk-library)
|
|
164
|
-
- Advanced Usage
|
|
165
|
-
- [Comment Tags](https://github.com/samchon/nestia/wiki/SDK-Generator#comment-tags)
|
|
166
|
-
- [Configuration](https://github.com/samchon/nestia/wiki/SDK-Generator#configuration)
|
|
167
|
-
|
|
168
|
-
### Demonstration
|
|
169
|
-
Here is example projects building Swagger Documents and SDK Library with `npx nestia swagger` and `npx nestia sdk` comands. `@nestia/sdk` generates those documents and libraries by analyzing your NestJS backend server code in the compilation level.
|
|
170
|
-
|
|
171
|
-
Project | Controller | SDK | Swagger
|
|
172
|
-
--------|------------|-----|---------
|
|
173
|
-
`npx nestia start` | [`BbsArticlesController`](https://github.com/samchon/nestia-template/blob/master/src/controllers/BbsArticlesController.ts) | [Functions](https://github.com/samchon/nestia-template/blob/master/src/api/functional/bbs/articles/index.ts) | [Editor](https://editor.swagger.io/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fsamchon%2Fnestia-template%2Fmaster%2Fdist%2Fswagger.json)
|
|
174
|
-
[fake-iamport](https://github.com/samchon/fake-iamport-server) | [`IamportCertificationsController`](https://github.com/samchon/fake-iamport-server/blob/master/src/controllers/FakeIamportCertificationsController.ts) | [Functions](https://github.com/samchon/fake-iamport-server/blob/master/src/api/functional/certifications/index.ts) | [Editor](https://editor.swagger.io/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fsamchon%2Ffake-iamport-server%2Fmaster%2Fdist%2Fswagger.json)
|
|
175
|
-
[fake-toss-payments](https://github.com/samchon/fake-toss-payments-server) | [`TossPaymentsController`](https://github.com/samchon/fake-toss-payments-server/blob/master/src/controllers/FakeTossPaymentsController.ts) | [Functions](https://github.com/samchon/fake-toss-payments-server/blob/master/src/api/functional/v1/payments/index.ts) | [Editor](https://editor.swagger.io/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fsamchon%2Ffake-toss-payments-server%2Fmaster%2Fdist%2Fswagger.json)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
## Appendix
|
|
181
|
-
### Typia
|
|
182
|
-
> https://github.com/samchon/typia
|
|
183
|
-
>
|
|
184
|
-
> `@nestia/core` is wrapping `typia` and the `typia` is:
|
|
185
|
-
|
|
186
|
-
[](https://github.com/samchon/typia/blob/master/LICENSE)
|
|
187
|
-
[](https://www.npmjs.com/package/typia)
|
|
188
|
-
[](https://www.npmjs.com/package/typia)
|
|
189
|
-
[](https://github.com/samchon/typia/actions?query=workflow%3Abuild)
|
|
190
|
-
[](https://github.com/samchon/typia/wiki)
|
|
191
|
-
|
|
192
|
-
```typescript
|
|
193
|
-
// RUNTIME VALIDATORS
|
|
194
|
-
export function is<T>(input: unknown | T): input is T; // returns boolean
|
|
195
|
-
export function assert<T>(input: unknown | T): T; // throws TypeGuardError
|
|
196
|
-
export function validate<T>(input: unknown | T): IValidation<T>; // detailed
|
|
197
|
-
export const customValidators: CustomValidatorMap; // can add custom validators
|
|
198
|
-
|
|
199
|
-
// JSON
|
|
200
|
-
export function application<T>(): IJsonApplication; // JSON schema
|
|
201
|
-
export function assertParse<T>(input: string): T; // type safe parser
|
|
202
|
-
export function assertStringify<T>(input: T): string; // safe and faster
|
|
203
|
-
// +) isParse, validateParse
|
|
204
|
-
// +) stringify, isStringify, validateStringify
|
|
205
|
-
|
|
206
|
-
// RANDOM
|
|
207
|
-
export function random<T>(g?: Partial<IRandomGenerator>): Primitive<T>;
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
`typia` is a transformer library of TypeScript, supporting below features:
|
|
211
|
-
|
|
212
|
-
- Super-fast Runtime Validators
|
|
213
|
-
- Safe JSON parse and fast stringify functions
|
|
214
|
-
- JSON schema generator
|
|
215
|
-
- Random data generation
|
|
216
|
-
|
|
217
|
-
All functions in `typia` require **only one line**. You don't need any extra dedication like JSON schema definitions or decorator function calls. Just call `typia` function with only one line like `typia.assert<T>(input)`.
|
|
218
|
-
|
|
219
|
-
Also, as `typia` performs AOT (Ahead of Time) compilation skill, its performance is much faster than other competitive libaries. For an example, when comparing validate function `is()` with other competitive libraries, `typia` is maximum **20,000x times faster** than `class-validator`.
|
|
47
|
+
### 📖 Features
|
|
48
|
+
- Core Library
|
|
49
|
+
- [TypedRoute](https://nestia.io/docs/core/TypedRoute/)
|
|
50
|
+
- [TypedBody](https://nestia.io/docs/core/TypedBody/)
|
|
51
|
+
- [TypedParam](https://nestia.io/docs/core/TypedParam/)
|
|
52
|
+
- [TypedQuery](https://nestia.io/docs/core/TypedRoute/)
|
|
53
|
+
- SDK/Swagger Generator
|
|
54
|
+
- [SDK Library](https://nestia.io/docs/sdk/sdk/)
|
|
55
|
+
- [Swagger Documents](https://nestia.io/docs/sdk/swagger/)
|
package/bin/NestiaSetupWizard.js
CHANGED
|
@@ -22,35 +22,50 @@ var NestiaSetupWizard;
|
|
|
22
22
|
console.log("----------------------------------------");
|
|
23
23
|
console.log(" Nestia Setup Wizard");
|
|
24
24
|
console.log("----------------------------------------");
|
|
25
|
-
//
|
|
25
|
+
// PREPARE ASSETS
|
|
26
26
|
const pack = yield PackageManager_1.PackageManager.mount();
|
|
27
|
-
// TAKE ARGUMENTS
|
|
28
27
|
const args = yield ArgumentParser_1.ArgumentParser.parse(pack);
|
|
29
|
-
// INSTALL TYPESCRIPT
|
|
30
|
-
pack.install({ dev: true, modulo: "
|
|
28
|
+
// INSTALL TYPESCRIPT COMPILERS
|
|
29
|
+
pack.install({ dev: true, modulo: "ts-patch", version: "latest" });
|
|
30
|
+
pack.install({ dev: true, modulo: "ts-node", version: "latest" });
|
|
31
|
+
pack.install({
|
|
32
|
+
dev: true,
|
|
33
|
+
modulo: "typescript",
|
|
34
|
+
version: (() => {
|
|
35
|
+
var _a;
|
|
36
|
+
const version = (() => {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
try {
|
|
39
|
+
return (_b = (_a = require("ts-patch/package.json")) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : "";
|
|
40
|
+
}
|
|
41
|
+
catch (_c) {
|
|
42
|
+
return "";
|
|
43
|
+
}
|
|
44
|
+
})();
|
|
45
|
+
return Number((_a = version.split(".")[0]) !== null && _a !== void 0 ? _a : "") >= 3
|
|
46
|
+
? "latest"
|
|
47
|
+
: "4.9.5";
|
|
48
|
+
})(),
|
|
49
|
+
});
|
|
31
50
|
(_a = args.project) !== null && _a !== void 0 ? _a : (args.project = (() => {
|
|
32
51
|
CommandExecutor_1.CommandExecutor.run("npx tsc --init");
|
|
33
52
|
return (args.project = "tsconfig.json");
|
|
34
53
|
})());
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
CommandExecutor_1.CommandExecutor.run("npm run prepare");
|
|
52
|
-
}
|
|
53
|
-
// INSTALL AND CONFIGURE TYPIA
|
|
54
|
+
// SETUP TRANSFORMER
|
|
55
|
+
yield pack.save((data) => {
|
|
56
|
+
var _a;
|
|
57
|
+
(_a = data.scripts) !== null && _a !== void 0 ? _a : (data.scripts = {});
|
|
58
|
+
if (typeof data.scripts.prepare === "string" &&
|
|
59
|
+
data.scripts.prepare.length) {
|
|
60
|
+
if (data.scripts.prepare.indexOf("ts-patch install") === -1)
|
|
61
|
+
data.scripts.prepare =
|
|
62
|
+
"ts-patch install && " + data.scripts.prepare;
|
|
63
|
+
}
|
|
64
|
+
else
|
|
65
|
+
data.scripts.prepare = "ts-patch install";
|
|
66
|
+
});
|
|
67
|
+
CommandExecutor_1.CommandExecutor.run("npm run prepare");
|
|
68
|
+
// INSTALL AND CONFIGURE TYPIA + NESTIA
|
|
54
69
|
pack.install({ dev: false, modulo: "typia", version: "latest" });
|
|
55
70
|
pack.install({ dev: false, modulo: "@nestia/core", version: "latest" });
|
|
56
71
|
pack.install({ dev: true, modulo: "@nestia/sdk", version: "latest" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestiaSetupWizard.js","sourceRoot":"","sources":["../src/NestiaSetupWizard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8DAA2D;AAC3D,gEAA6D;AAC7D,8DAA2D;AAC3D,sEAAmE;AAEnE,IAAiB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"NestiaSetupWizard.js","sourceRoot":"","sources":["../src/NestiaSetupWizard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8DAA2D;AAC3D,gEAA6D;AAC7D,8DAA2D;AAC3D,sEAAmE;AAEnE,IAAiB,iBAAiB,CAwDjC;AAxDD,WAAiB,iBAAiB;IAC9B,SAAsB,KAAK;;;YACvB,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;YACxD,OA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+1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
declare const USAGE = "Wrong command has been detected. Use like below:\n\nnpx nestia [command] [options?]\n\n 1. npx nestia start <directory> --manager (npm|pnpm|yarn)\n - npx nestia start project\n - npx nestia start project --manager pnpm\n 2. npx nestia setup \\\n
|
|
2
|
+
declare const USAGE = "Wrong command has been detected. Use like below:\n\nnpx nestia [command] [options?]\n\n 1. npx nestia start <directory> --manager (npm|pnpm|yarn)\n - npx nestia start project\n - npx nestia start project --manager pnpm\n 2. npx nestia setup \\\n --manager (npm|pnpm|yarn) \\\n --project {tsconfig.json file path}\n - npx nestia setup\n - npx nestia setup --manager pnpm\n - npx nestia setup --project tsconfig.test.json\n 3. npx nestia dependencies --manager (npm|pnpm|yarn)\n - npx nestia dependencies\n - npx nestia dependencies --manager yarn\n 4. npx nestia init\n 5. npx nestia sdk <input> --out <output>\n - npx nestia sdk # when \"nestia.config.ts\" be configured\n - npx nestia sdk src/controllers --out src/api\n - npx nestia sdk src/**/*.controller.ts --out src/api\n 6. npx nestia swagger <input> --out <output>\n - npx nestia swagger # when \"nestia.config.ts\" be configured\n - npx nestia swagger src/controllers --out src/api\n - npx nestia swagger src/**/*.controller.ts --out src/api \n";
|
|
3
3
|
declare function halt(desc: string): never;
|
|
4
4
|
declare function main(): Promise<void>;
|
package/bin/index.js
CHANGED
|
@@ -40,13 +40,11 @@ npx nestia [command] [options?]
|
|
|
40
40
|
- npx nestia start project
|
|
41
41
|
- npx nestia start project --manager pnpm
|
|
42
42
|
2. npx nestia setup \\
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
--project {tsconfig.json file path}
|
|
43
|
+
--manager (npm|pnpm|yarn) \\
|
|
44
|
+
--project {tsconfig.json file path}
|
|
46
45
|
- npx nestia setup
|
|
47
|
-
- npx nestia setup --compiler ttypescript
|
|
48
|
-
- npx nestia setup --compiler ts-patch
|
|
49
46
|
- npx nestia setup --manager pnpm
|
|
47
|
+
- npx nestia setup --project tsconfig.test.json
|
|
50
48
|
3. npx nestia dependencies --manager (npm|pnpm|yarn)
|
|
51
49
|
- npx nestia dependencies
|
|
52
50
|
- npx nestia dependencies --manager yarn
|
package/bin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,MAAM,KAAK,GAAG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBb,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;;QACf,MAAM,IAAI,GAAuB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjD,MAAM,IAAI,GAAa,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAE7C,IAAI,IAAI,KAAK,OAAO,EAAE;YAClB,MAAM,CACF,wDAAa,iBAAiB,GAAC,CAClC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SAC5D;aAAM,IAAI,IAAI,KAAK,OAAO,EAAE;YACzB,IAAI;gBACA,wDAAa,cAAc,GAAC,CAAC;gBAC7B,wDAAa,UAAU,GAAC,CAAC;gBACzB,wDAAa,WAAW,GAAC,CAAC;aAC7B;YAAC,WAAM;gBACJ,IAAI,CACA,8DAA8D,CACjE,CAAC;aACL;YACD,MAAM,CAAC,wDAAa,qBAAqB,GAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;SACzE;aAAM,IACH,IAAI,KAAK,cAAc;YACvB,IAAI,KAAK,MAAM;YACf,IAAI,KAAK,KAAK;YACd,IAAI,KAAK,SAAS,EACpB;YACE,IAAI;gBACA,OAAO,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC;aACrD;YAAC,WAAM;gBACJ,IAAI,CACA,oEAAoE,CACvE,CAAC;aACL;YACD,wDAAa,gCAAgC,GAAC,CAAC;SAClD;;YAAM,IAAI,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;CAAA;AACD,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACjB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACzB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC,CAAC,CAAC"}
|
|
@@ -21,7 +21,6 @@ var ArgumentParser;
|
|
|
21
21
|
function parse(pack) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
// PREPARE ASSETS
|
|
24
|
-
commander_1.default.program.option("--compiler [compiler]", "compiler type");
|
|
25
24
|
commander_1.default.program.option("--manager [manager", "package manager");
|
|
26
25
|
commander_1.default.program.option("--project [project]", "tsconfig.json file location");
|
|
27
26
|
// INTERNAL PROCEDURES
|
|
@@ -70,20 +69,14 @@ var ArgumentParser;
|
|
|
70
69
|
});
|
|
71
70
|
// DO CONSTRUCT
|
|
72
71
|
return action((options) => __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
var _a, _b
|
|
74
|
-
|
|
75
|
-
console.log(COMPILER_DESCRIPTION);
|
|
76
|
-
options.compiler = yield select("compiler")(`Compiler`)(((_a = pack.data.scripts) === null || _a === void 0 ? void 0 : _a.build) === "nest build"
|
|
77
|
-
? ["ts-patch", "ttypescript"]
|
|
78
|
-
: ["ttypescript", "ts-patch"]);
|
|
79
|
-
}
|
|
80
|
-
(_b = options.manager) !== null && _b !== void 0 ? _b : (options.manager = yield select("manager")("Package Manager")([
|
|
72
|
+
var _a, _b;
|
|
73
|
+
(_a = options.manager) !== null && _a !== void 0 ? _a : (options.manager = yield select("manager")("Package Manager")([
|
|
81
74
|
"npm",
|
|
82
75
|
"pnpm",
|
|
83
76
|
"yarn",
|
|
84
77
|
]));
|
|
85
78
|
pack.manager = options.manager;
|
|
86
|
-
(
|
|
79
|
+
(_b = options.project) !== null && _b !== void 0 ? _b : (options.project = yield configure());
|
|
87
80
|
if (questioned.value)
|
|
88
81
|
console.log("");
|
|
89
82
|
return options;
|
|
@@ -92,14 +85,4 @@ var ArgumentParser;
|
|
|
92
85
|
}
|
|
93
86
|
ArgumentParser.parse = parse;
|
|
94
87
|
})(ArgumentParser = exports.ArgumentParser || (exports.ArgumentParser = {}));
|
|
95
|
-
const COMPILER_DESCRIPTION = [
|
|
96
|
-
`About compiler, if you adapt "ttypescript", you should use "ttsc" instead.`,
|
|
97
|
-
``,
|
|
98
|
-
`Otherwise, you choose "ts-patch", you can use the original "tsc" command.`,
|
|
99
|
-
`However, the "ts-patch" hacks "node_modules/typescript" source code.`,
|
|
100
|
-
`Also, whenever update "typescript", you've to run "npm run prepare" command.`,
|
|
101
|
-
``,
|
|
102
|
-
`By the way, when using "@nest/cli", you must just choose "ts-patch".`,
|
|
103
|
-
``,
|
|
104
|
-
].join("\n");
|
|
105
88
|
//# sourceMappingURL=ArgumentParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArgumentParser.js","sourceRoot":"","sources":["../../src/internal/ArgumentParser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0DAAkC;AAClC,4CAAoB;AACpB,wDAAgC;AAIhC,IAAiB,cAAc,
|
|
1
|
+
{"version":3,"file":"ArgumentParser.js","sourceRoot":"","sources":["../../src/internal/ArgumentParser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,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CAAC,EAAC;gBACH,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;gBAC/B,MAAA,OAAO,CAAC,OAAO,oCAAf,OAAO,CAAC,OAAO,GAAK,MAAM,SAAS,EAAE,EAAC;gBAEtC,IAAI,UAAU,CAAC,KAAK;oBAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBACtC,OAAO,OAAqB,CAAC;YACjC,CAAC,CAAA,CAAC,CAAC;QACP,CAAC;KAAA;IA/EqB,oBAAK,QA+E1B,CAAA;AACL,CAAC,EAtFgB,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAsF9B"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nestia",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.1.0-dev.20230427",
|
|
4
4
|
"description": "Nestia CLI tool",
|
|
5
5
|
"main": "bin/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"nestia": "bin/index.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "rimraf bin && tsc"
|
|
10
|
+
"build": "rimraf bin && tsc",
|
|
11
|
+
"prettier": "prettier .src/**/*.ts --write"
|
|
11
12
|
},
|
|
12
13
|
"repository": {
|
|
13
14
|
"type": "git",
|
|
@@ -34,10 +35,11 @@
|
|
|
34
35
|
"inquirer": "^8.2.5"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
|
-
"@nestia/core": "^1.0
|
|
38
|
-
"@nestia/sdk": "^1.0
|
|
38
|
+
"@nestia/core": "^1.1.0",
|
|
39
|
+
"@nestia/sdk": "^1.1.0",
|
|
39
40
|
"@types/inquirer": "^9.0.3",
|
|
40
41
|
"@types/node": "^18.11.16",
|
|
42
|
+
"prettier": "^2.8.7",
|
|
41
43
|
"rimraf": "^3.0.2",
|
|
42
44
|
"typescript": "^4.9.5"
|
|
43
45
|
},
|
package/src/NestiaSetupWizard.ts
CHANGED
|
@@ -9,44 +9,54 @@ export namespace NestiaSetupWizard {
|
|
|
9
9
|
console.log(" Nestia Setup Wizard");
|
|
10
10
|
console.log("----------------------------------------");
|
|
11
11
|
|
|
12
|
-
//
|
|
12
|
+
// PREPARE ASSETS
|
|
13
13
|
const pack: PackageManager = await PackageManager.mount();
|
|
14
|
-
|
|
15
|
-
// TAKE ARGUMENTS
|
|
16
14
|
const args: ArgumentParser.IArguments = await ArgumentParser.parse(
|
|
17
15
|
pack,
|
|
18
16
|
);
|
|
19
17
|
|
|
20
|
-
// INSTALL TYPESCRIPT
|
|
21
|
-
pack.install({ dev: true, modulo: "
|
|
18
|
+
// INSTALL TYPESCRIPT COMPILERS
|
|
19
|
+
pack.install({ dev: true, modulo: "ts-patch", version: "latest" });
|
|
20
|
+
pack.install({ dev: true, modulo: "ts-node", version: "latest" });
|
|
21
|
+
pack.install({
|
|
22
|
+
dev: true,
|
|
23
|
+
modulo: "typescript",
|
|
24
|
+
version: (() => {
|
|
25
|
+
const version: string = (() => {
|
|
26
|
+
try {
|
|
27
|
+
return require("ts-patch/package.json")?.version ?? "";
|
|
28
|
+
} catch {
|
|
29
|
+
return "";
|
|
30
|
+
}
|
|
31
|
+
})();
|
|
32
|
+
return Number(version.split(".")[0] ?? "") >= 3
|
|
33
|
+
? "latest"
|
|
34
|
+
: "4.9.5";
|
|
35
|
+
})(),
|
|
36
|
+
});
|
|
22
37
|
args.project ??= (() => {
|
|
23
38
|
CommandExecutor.run("npx tsc --init");
|
|
24
39
|
return (args.project = "tsconfig.json");
|
|
25
40
|
})();
|
|
26
|
-
pack.install({ dev: true, modulo: "ts-node", version: "latest" });
|
|
27
41
|
|
|
28
|
-
//
|
|
29
|
-
pack.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
data.scripts
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
42
|
-
CommandExecutor.run("npm run prepare");
|
|
43
|
-
}
|
|
42
|
+
// SETUP TRANSFORMER
|
|
43
|
+
await pack.save((data) => {
|
|
44
|
+
data.scripts ??= {};
|
|
45
|
+
if (
|
|
46
|
+
typeof data.scripts.prepare === "string" &&
|
|
47
|
+
data.scripts.prepare.length
|
|
48
|
+
) {
|
|
49
|
+
if (data.scripts.prepare.indexOf("ts-patch install") === -1)
|
|
50
|
+
data.scripts.prepare =
|
|
51
|
+
"ts-patch install && " + data.scripts.prepare;
|
|
52
|
+
} else data.scripts.prepare = "ts-patch install";
|
|
53
|
+
});
|
|
54
|
+
CommandExecutor.run("npm run prepare");
|
|
44
55
|
|
|
45
|
-
// INSTALL AND CONFIGURE TYPIA
|
|
56
|
+
// INSTALL AND CONFIGURE TYPIA + NESTIA
|
|
46
57
|
pack.install({ dev: false, modulo: "typia", version: "latest" });
|
|
47
58
|
pack.install({ dev: false, modulo: "@nestia/core", version: "latest" });
|
|
48
59
|
pack.install({ dev: true, modulo: "@nestia/sdk", version: "latest" });
|
|
49
|
-
|
|
50
60
|
await PluginConfigurator.configure(args);
|
|
51
61
|
}
|
|
52
62
|
}
|
package/src/index.ts
CHANGED
|
@@ -7,13 +7,11 @@ npx nestia [command] [options?]
|
|
|
7
7
|
- npx nestia start project
|
|
8
8
|
- npx nestia start project --manager pnpm
|
|
9
9
|
2. npx nestia setup \\
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
--project {tsconfig.json file path}
|
|
10
|
+
--manager (npm|pnpm|yarn) \\
|
|
11
|
+
--project {tsconfig.json file path}
|
|
13
12
|
- npx nestia setup
|
|
14
|
-
- npx nestia setup --compiler ttypescript
|
|
15
|
-
- npx nestia setup --compiler ts-patch
|
|
16
13
|
- npx nestia setup --manager pnpm
|
|
14
|
+
- npx nestia setup --project tsconfig.test.json
|
|
17
15
|
3. npx nestia dependencies --manager (npm|pnpm|yarn)
|
|
18
16
|
- npx nestia dependencies
|
|
19
17
|
- npx nestia dependencies --manager yarn
|
|
@@ -6,14 +6,12 @@ import { PackageManager } from "./PackageManager";
|
|
|
6
6
|
|
|
7
7
|
export namespace ArgumentParser {
|
|
8
8
|
export interface IArguments {
|
|
9
|
-
compiler: "ts-patch" | "ttypescript";
|
|
10
9
|
manager: "npm" | "pnpm" | "yarn";
|
|
11
10
|
project: string | null;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
export async function parse(pack: PackageManager): Promise<IArguments> {
|
|
15
14
|
// PREPARE ASSETS
|
|
16
|
-
commander.program.option("--compiler [compiler]", "compiler type");
|
|
17
15
|
commander.program.option("--manager [manager", "package manager");
|
|
18
16
|
commander.program.option(
|
|
19
17
|
"--project [project]",
|
|
@@ -80,14 +78,6 @@ export namespace ArgumentParser {
|
|
|
80
78
|
|
|
81
79
|
// DO CONSTRUCT
|
|
82
80
|
return action(async (options) => {
|
|
83
|
-
if (options.compiler === undefined) {
|
|
84
|
-
console.log(COMPILER_DESCRIPTION);
|
|
85
|
-
options.compiler = await select("compiler")(`Compiler`)(
|
|
86
|
-
pack.data.scripts?.build === "nest build"
|
|
87
|
-
? ["ts-patch" as const, "ttypescript" as const]
|
|
88
|
-
: ["ttypescript" as const, "ts-patch" as const],
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
81
|
options.manager ??= await select("manager")("Package Manager")([
|
|
92
82
|
"npm" as const,
|
|
93
83
|
"pnpm" as const,
|
|
@@ -101,14 +91,3 @@ export namespace ArgumentParser {
|
|
|
101
91
|
});
|
|
102
92
|
}
|
|
103
93
|
}
|
|
104
|
-
|
|
105
|
-
const COMPILER_DESCRIPTION = [
|
|
106
|
-
`About compiler, if you adapt "ttypescript", you should use "ttsc" instead.`,
|
|
107
|
-
``,
|
|
108
|
-
`Otherwise, you choose "ts-patch", you can use the original "tsc" command.`,
|
|
109
|
-
`However, the "ts-patch" hacks "node_modules/typescript" source code.`,
|
|
110
|
-
`Also, whenever update "typescript", you've to run "npm run prepare" command.`,
|
|
111
|
-
``,
|
|
112
|
-
`By the way, when using "@nest/cli", you must just choose "ts-patch".`,
|
|
113
|
-
``,
|
|
114
|
-
].join("\n");
|