nestia 10.0.2 → 11.0.0-dev.20260305

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.
Files changed (40) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +93 -93
  3. package/package.json +25 -12
  4. package/src/NestiaSetupWizard.ts +90 -90
  5. package/src/NestiaStarter.ts +41 -41
  6. package/src/NestiaTemplate.ts +37 -37
  7. package/src/boot.js +15 -0
  8. package/src/index.ts +65 -64
  9. package/src/internal/ArgumentParser.ts +123 -123
  10. package/src/internal/CommandExecutor.ts +8 -8
  11. package/src/internal/FileRetriever.ts +22 -22
  12. package/src/internal/PackageManager.ts +91 -91
  13. package/src/internal/PluginConfigurator.ts +125 -125
  14. package/bin/NestiaSetupWizard.d.ts +0 -3
  15. package/bin/NestiaSetupWizard.js +0 -98
  16. package/bin/NestiaSetupWizard.js.map +0 -1
  17. package/bin/NestiaStarter.d.ts +0 -3
  18. package/bin/NestiaStarter.js +0 -49
  19. package/bin/NestiaStarter.js.map +0 -1
  20. package/bin/NestiaTemplate.d.ts +0 -3
  21. package/bin/NestiaTemplate.js +0 -46
  22. package/bin/NestiaTemplate.js.map +0 -1
  23. package/bin/index.d.ts +0 -4
  24. package/bin/index.js +0 -106
  25. package/bin/index.js.map +0 -1
  26. package/bin/internal/ArgumentParser.d.ts +0 -9
  27. package/bin/internal/ArgumentParser.js +0 -106
  28. package/bin/internal/ArgumentParser.js.map +0 -1
  29. package/bin/internal/CommandExecutor.d.ts +0 -3
  30. package/bin/internal/CommandExecutor.js +0 -16
  31. package/bin/internal/CommandExecutor.js.map +0 -1
  32. package/bin/internal/FileRetriever.d.ts +0 -4
  33. package/bin/internal/FileRetriever.js +0 -28
  34. package/bin/internal/FileRetriever.js.map +0 -1
  35. package/bin/internal/PackageManager.d.ts +0 -25
  36. package/bin/internal/PackageManager.js +0 -76
  37. package/bin/internal/PackageManager.js.map +0 -1
  38. package/bin/internal/PluginConfigurator.d.ts +0 -4
  39. package/bin/internal/PluginConfigurator.js +0 -99
  40. package/bin/internal/PluginConfigurator.js.map +0 -1
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 Jeongho Nam
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Jeongho Nam
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,93 +1,93 @@
1
- # Nestia
2
- ![Nestia Logo](https://nestia.io/logo.png)
3
-
4
- [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)
5
- [![npm version](https://img.shields.io/npm/v/@nestia/fetcher.svg)](https://www.npmjs.com/package/@nestia/fetcher)
6
- [![Downloads](https://img.shields.io/npm/dm/@nestia/fetcher.svg)](https://www.npmjs.com/package/@nestia/fetcher)
7
- [![Build Status](https://github.com/samchon/nestia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)
8
- [![Guide Documents](https://img.shields.io/badge/Guide-Documents-forestgreen)](https://nestia.io/docs/)
9
- [![Gurubase](https://img.shields.io/badge/Gurubase-Document%20Chatbot-006BFF)](https://gurubase.io/g/nestia)
10
- [![Discord Badge](https://img.shields.io/badge/discord-samchon-d91965?style=flat&labelColor=5866f2&logo=discord&logoColor=white&link=https://discord.gg/E94XhzrUCZ)](https://discord.gg/E94XhzrUCZ)
11
-
12
- Nestia is a set of helper libraries for NestJS, supporting below features:
13
-
14
- - `@nestia/core`:
15
- - Super-fast/easy decorators
16
- - Advanced WebSocket routes
17
- - `@nestia/sdk`:
18
- - Swagger generator, more evolved than ever
19
- - SDK library generator for clients
20
- - Mockup Simulator for client applications
21
- - Automatic E2E test functions generator
22
- - `@nestia/e2e`: Test program utilizing e2e test functions
23
- - `@nestia/benchmark`: Benchmark program using e2e test functions
24
- - `@nestia/editor`: Swagger-UI with Online TypeScript Editor
25
- - [`@agentica`](https://github.com/wrtnlabs/agentica): Agentic AI library specialized in LLM function calling
26
- - [`@autobe`](https://github.com/wrtnlabs/autobe): Vibe coding agent generating NestJS application
27
- - `nestia`: Just CLI (command line interface) tool
28
-
29
- > [!NOTE]
30
- >
31
- > - **Only one line** required, with pure TypeScript type
32
- > - Enhance performance **30x** up
33
- > - Runtime validator is **20,000x faster** than `class-validator`
34
- > - JSON serialization is **200x faster** than `class-transformer`
35
- > - Software Development Kit
36
- > - Collection of typed `fetch` functions with DTO structures like [tRPC](https://trpc.io/)
37
- > - Mockup simulator means embedded backend simulator in the SDK
38
- > - similar with [msw](https://mswjs.io/), but fully automated
39
-
40
- ![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)
41
-
42
- > Left is NestJS server code, and right is client (frontend) code utilizing SDK
43
-
44
-
45
-
46
-
47
- ## Sponsors and Backers
48
- Thanks for your support.
49
-
50
- Your donation would encourage `nestia` development.
51
-
52
- [![Backers](https://opencollective.com/nestia/backers.svg?avatarHeight=75&width=600)](https://opencollective.com/nestia)
53
-
54
-
55
-
56
-
57
- ## Guide Documents
58
- Check out the document in the [website](https://nestia.io/docs/):
59
-
60
- ### 🏠 Home
61
- - [Introduction](https://nestia.io/docs/)
62
- - [Setup](https://nestia.io/docs/setup/)
63
- - [Pure TypeScript](https://nestia.io/docs/pure)
64
-
65
- ### 📖 Features
66
- - Core Library
67
- - [`@WebSocketRoute`](https://nestia.io/docs/core/WebSocketRoute)
68
- - [`@TypedRoute`](https://nestia.io/docs/core/TypedRoute/)
69
- - [**`@TypedBody`**](https://nestia.io/docs/core/TypedBody/)
70
- - [`@TypedParam`](https://nestia.io/docs/core/TypedParam/)
71
- - [`@TypedQuery`](https://nestia.io/docs/core/TypedQuery/)
72
- - [`@TypedFormData`](https://nestia.io/docs/core/TypedFormData/)
73
- - [`@TypedHeaders`](https://nestia.io/docs/core/TypedHeaders/)
74
- - [`@TypedException`](https://nestia.io/docs/core/TypedException/)
75
- - Software Development Kit
76
- - [SDK Builder](https://nestia.io/docs/sdk/)
77
- - [Mockup Simulator](https://nestia.io/docs/sdk/simulate/)
78
- - [E2E Test Functions](https://nestia.io/docs/sdk/e2e/)
79
- - [Distribution](https://nestia.io/docs/sdk/distribute/)
80
- - Swagger Document
81
- - [Swagger Builder](https://nestia.io/docs/swagger/)
82
- - [**AI Chatbot Development**](https://nestia.io/docs/swagger/chat/)
83
- - [Cloud Swagger Editor](https://nestia.io/docs/swagger/editor/)
84
- - [Documentation Strategy](https://nestia.io/docs/swagger/strategy/)
85
- - E2E Testing
86
- - [Why E2E Test?](https://nestia.io/docs/e2e/why/)
87
- - [Test Program Development](https://nestia.io/docs/e2e/development/)
88
- - [Performance Benchmark](https://nestia.io/docs/e2e/benchmark/)
89
-
90
- ### 🔗 Appendix
91
- - [API Documents](https://nestia.io/api)
92
- - [⇲ Benchmark Result](https://github.com/samchon/nestia/tree/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz)
93
- - [⇲ `dev.to` Articles](https://dev.to/samchon/series/22751)
1
+ # Nestia
2
+ ![Nestia Logo](https://nestia.io/logo.png)
3
+
4
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)
5
+ [![npm version](https://img.shields.io/npm/v/@nestia/fetcher.svg)](https://www.npmjs.com/package/@nestia/fetcher)
6
+ [![Downloads](https://img.shields.io/npm/dm/@nestia/fetcher.svg)](https://www.npmjs.com/package/@nestia/fetcher)
7
+ [![Build Status](https://github.com/samchon/nestia/workflows/test/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Atest)
8
+ [![Guide Documents](https://img.shields.io/badge/Guide-Documents-forestgreen)](https://nestia.io/docs/)
9
+ [![Gurubase](https://img.shields.io/badge/Gurubase-Document%20Chatbot-006BFF)](https://gurubase.io/g/nestia)
10
+ [![Discord Badge](https://img.shields.io/badge/discord-samchon-d91965?style=flat&labelColor=5866f2&logo=discord&logoColor=white&link=https://discord.gg/E94XhzrUCZ)](https://discord.gg/E94XhzrUCZ)
11
+
12
+ Nestia is a set of helper libraries for NestJS, supporting below features:
13
+
14
+ - `@nestia/core`:
15
+ - Super-fast/easy decorators
16
+ - Advanced WebSocket routes
17
+ - `@nestia/sdk`:
18
+ - Swagger generator, more evolved than ever
19
+ - SDK library generator for clients
20
+ - Mockup Simulator for client applications
21
+ - Automatic E2E test functions generator
22
+ - `@nestia/e2e`: Test program utilizing e2e test functions
23
+ - `@nestia/benchmark`: Benchmark program using e2e test functions
24
+ - `@nestia/editor`: Swagger-UI with Online TypeScript Editor
25
+ - [`@agentica`](https://github.com/wrtnlabs/agentica): Agentic AI library specialized in LLM function calling
26
+ - [`@autobe`](https://github.com/wrtnlabs/autobe): Vibe coding agent generating NestJS application
27
+ - `nestia`: Just CLI (command line interface) tool
28
+
29
+ > [!NOTE]
30
+ >
31
+ > - **Only one line** required, with pure TypeScript type
32
+ > - Enhance performance **30x** up
33
+ > - Runtime validator is **20,000x faster** than `class-validator`
34
+ > - JSON serialization is **200x faster** than `class-transformer`
35
+ > - Software Development Kit
36
+ > - Collection of typed `fetch` functions with DTO structures like [tRPC](https://trpc.io/)
37
+ > - Mockup simulator means embedded backend simulator in the SDK
38
+ > - similar with [msw](https://mswjs.io/), but fully automated
39
+
40
+ ![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)
41
+
42
+ > Left is NestJS server code, and right is client (frontend) code utilizing SDK
43
+
44
+
45
+
46
+
47
+ ## Sponsors and Backers
48
+ Thanks for your support.
49
+
50
+ Your donation would encourage `nestia` development.
51
+
52
+ [![Backers](https://opencollective.com/nestia/backers.svg?avatarHeight=75&width=600)](https://opencollective.com/nestia)
53
+
54
+
55
+
56
+
57
+ ## Guide Documents
58
+ Check out the document in the [website](https://nestia.io/docs/):
59
+
60
+ ### 🏠 Home
61
+ - [Introduction](https://nestia.io/docs/)
62
+ - [Setup](https://nestia.io/docs/setup/)
63
+ - [Pure TypeScript](https://nestia.io/docs/pure)
64
+
65
+ ### 📖 Features
66
+ - Core Library
67
+ - [`@WebSocketRoute`](https://nestia.io/docs/core/WebSocketRoute)
68
+ - [`@TypedRoute`](https://nestia.io/docs/core/TypedRoute/)
69
+ - [**`@TypedBody`**](https://nestia.io/docs/core/TypedBody/)
70
+ - [`@TypedParam`](https://nestia.io/docs/core/TypedParam/)
71
+ - [`@TypedQuery`](https://nestia.io/docs/core/TypedQuery/)
72
+ - [`@TypedFormData`](https://nestia.io/docs/core/TypedFormData/)
73
+ - [`@TypedHeaders`](https://nestia.io/docs/core/TypedHeaders/)
74
+ - [`@TypedException`](https://nestia.io/docs/core/TypedException/)
75
+ - Software Development Kit
76
+ - [SDK Builder](https://nestia.io/docs/sdk/)
77
+ - [Mockup Simulator](https://nestia.io/docs/sdk/simulate/)
78
+ - [E2E Test Functions](https://nestia.io/docs/sdk/e2e/)
79
+ - [Distribution](https://nestia.io/docs/sdk/distribute/)
80
+ - Swagger Document
81
+ - [Swagger Builder](https://nestia.io/docs/swagger/)
82
+ - [**AI Chatbot Development**](https://nestia.io/docs/swagger/chat/)
83
+ - [Cloud Swagger Editor](https://nestia.io/docs/swagger/editor/)
84
+ - [Documentation Strategy](https://nestia.io/docs/swagger/strategy/)
85
+ - E2E Testing
86
+ - [Why E2E Test?](https://nestia.io/docs/e2e/why/)
87
+ - [Test Program Development](https://nestia.io/docs/e2e/development/)
88
+ - [Performance Benchmark](https://nestia.io/docs/e2e/benchmark/)
89
+
90
+ ### 🔗 Appendix
91
+ - [API Documents](https://nestia.io/api)
92
+ - [⇲ Benchmark Result](https://github.com/samchon/nestia/tree/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz)
93
+ - [⇲ `dev.to` Articles](https://dev.to/samchon/series/22751)
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "nestia",
3
- "version": "10.0.2",
3
+ "version": "11.0.0-dev.20260305",
4
4
  "description": "Nestia CLI tool",
5
5
  "main": "bin/index.js",
6
6
  "bin": {
7
- "nestia": "bin/index.js"
7
+ "nestia": "./bin/index.js"
8
8
  },
9
- "scripts": {
10
- "build": "rimraf bin && tsc",
11
- "package:latest": "npm run build && npm publish --access public --tag latest",
12
- "package:next": "npm run build && npm publish --access public --tag next"
9
+ "exports": {
10
+ ".": {
11
+ "types": "./bin/index.d.ts",
12
+ "default": "./bin/index.js"
13
+ },
14
+ "./package.json": "./package.json"
13
15
  },
14
16
  "repository": {
15
17
  "type": "git",
@@ -37,12 +39,13 @@
37
39
  "package-manager-detector": "^0.2.0"
38
40
  },
39
41
  "devDependencies": {
40
- "@nestia/core": "^10.0.2",
41
- "@nestia/sdk": "^10.0.2",
42
42
  "@types/inquirer": "^9.0.3",
43
- "@types/node": "^18.11.16",
44
- "rimraf": "^6.0.1",
45
- "typescript": "~5.9.3"
43
+ "@types/node": "^25.3.3",
44
+ "rimraf": "^6.1.3",
45
+ "ts-node": "^10.9.2",
46
+ "typescript": "~5.9.3",
47
+ "@nestia/core": "^11.0.0-dev.20260305",
48
+ "@nestia/sdk": "^11.0.0-dev.20260305"
46
49
  },
47
50
  "files": [
48
51
  "bin",
@@ -50,5 +53,15 @@
50
53
  "README.md",
51
54
  "LICENSE",
52
55
  "package.json"
53
- ]
56
+ ],
57
+ "publishConfig": {
58
+ "access": "public"
59
+ },
60
+ "scripts": {
61
+ "build": "rimraf bin && tsc",
62
+ "dev": "rimraf bin && tsc --watch",
63
+ "package:latest": "npm run build && npm publish --access public --tag latest",
64
+ "package:next": "npm run build && npm publish --access public --tag next"
65
+ },
66
+ "types": "bin/index.d.ts"
54
67
  }
@@ -1,90 +1,90 @@
1
- import fs from "fs";
2
-
3
- import { ArgumentParser } from "./internal/ArgumentParser";
4
- import { CommandExecutor } from "./internal/CommandExecutor";
5
- import { PackageManager } from "./internal/PackageManager";
6
- import { PluginConfigurator } from "./internal/PluginConfigurator";
7
-
8
- export namespace NestiaSetupWizard {
9
- export async function setup(): Promise<void> {
10
- console.log("----------------------------------------");
11
- console.log(" Nestia Setup Wizard");
12
- console.log("----------------------------------------");
13
-
14
- // PREPARE ASSETS
15
- const pack: PackageManager = await PackageManager.mount();
16
- const args: ArgumentParser.IArguments = await ArgumentParser.parse(pack);
17
-
18
- // INSTALL NESTIA
19
- pack.install({ dev: false, modulo: "@nestia/core", version: "latest" });
20
- pack.install({ dev: false, modulo: "@nestia/e2e", version: "latest" });
21
- pack.install({ dev: false, modulo: "@nestia/fetcher", version: "latest" });
22
- pack.install({
23
- dev: args.runtime === false,
24
- modulo: "@nestia/sdk",
25
- version: "latest",
26
- });
27
- pack.install({ dev: true, modulo: "@nestia/benchmark", version: "latest" });
28
- pack.install({ dev: true, modulo: "nestia", version: "latest" });
29
- pack.install({ dev: false, modulo: "typia", version: "latest" });
30
-
31
- // INSTALL TYPESCRIPT COMPILERS
32
- pack.install({ dev: true, modulo: "ts-patch", version: "latest" });
33
- pack.install({ dev: true, modulo: "ts-node", version: "latest" });
34
- pack.install({
35
- dev: true,
36
- modulo: "typescript",
37
- version: await getTypeScriptVersion(),
38
- });
39
- args.project ??= (() => {
40
- const runner: string = pack.manager === "npm" ? "npx" : pack.manager;
41
- CommandExecutor.run(`${runner} tsc --init`);
42
- return (args.project = "tsconfig.json");
43
- })();
44
-
45
- // SETUP TRANSFORMER
46
- await pack.save((data) => {
47
- // COMPOSE PREPARE COMMAND
48
- data.scripts ??= {};
49
- if (
50
- typeof data.scripts.prepare === "string" &&
51
- data.scripts.prepare.trim().length !== 0
52
- ) {
53
- if (data.scripts.prepare.includes("ts-patch install") === false)
54
- data.scripts.prepare = "ts-patch install && " + data.scripts.prepare;
55
- } else data.scripts.prepare = "ts-patch install";
56
-
57
- // NO MORE "typia patch" REQUIRED
58
- data.scripts.prepare = data.scripts.prepare
59
- .split("&&")
60
- .map((str) => str.trim())
61
- .filter((str) => str !== "typia patch")
62
- .join(" && ");
63
-
64
- // FOR OLDER VERSIONS
65
- if (typeof data.scripts.postinstall === "string") {
66
- data.scripts.postinstall = data.scripts.postinstall
67
- .split("&&")
68
- .map((str) => str.trim())
69
- .filter((str) => str.indexOf("ts-patch install") === -1)
70
- .join(" && ");
71
- if (data.scripts.postinstall.length === 0)
72
- delete data.scripts.postinstall;
73
- }
74
- });
75
- CommandExecutor.run(`${pack.manager} run prepare`);
76
-
77
- // CONFIGURE PLUGIN
78
- await PluginConfigurator.configure(args);
79
- }
80
-
81
- const getTypeScriptVersion = async (): Promise<string> => {
82
- const content: string = await fs.promises.readFile(
83
- `${__dirname}/../package.json`,
84
- "utf-8",
85
- );
86
- const json: { devDependencies: { typescript: string } } =
87
- JSON.parse(content);
88
- return json.devDependencies.typescript;
89
- };
90
- }
1
+ import fs from "fs";
2
+
3
+ import { ArgumentParser } from "./internal/ArgumentParser";
4
+ import { CommandExecutor } from "./internal/CommandExecutor";
5
+ import { PackageManager } from "./internal/PackageManager";
6
+ import { PluginConfigurator } from "./internal/PluginConfigurator";
7
+
8
+ export namespace NestiaSetupWizard {
9
+ export async function setup(): Promise<void> {
10
+ console.log("----------------------------------------");
11
+ console.log(" Nestia Setup Wizard");
12
+ console.log("----------------------------------------");
13
+
14
+ // PREPARE ASSETS
15
+ const pack: PackageManager = await PackageManager.mount();
16
+ const args: ArgumentParser.IArguments = await ArgumentParser.parse(pack);
17
+
18
+ // INSTALL NESTIA
19
+ pack.install({ dev: false, modulo: "@nestia/core", version: "latest" });
20
+ pack.install({ dev: false, modulo: "@nestia/e2e", version: "latest" });
21
+ pack.install({ dev: false, modulo: "@nestia/fetcher", version: "latest" });
22
+ pack.install({
23
+ dev: args.runtime === false,
24
+ modulo: "@nestia/sdk",
25
+ version: "latest",
26
+ });
27
+ pack.install({ dev: true, modulo: "@nestia/benchmark", version: "latest" });
28
+ pack.install({ dev: true, modulo: "nestia", version: "latest" });
29
+ pack.install({ dev: false, modulo: "typia", version: "latest" });
30
+
31
+ // INSTALL TYPESCRIPT COMPILERS
32
+ pack.install({ dev: true, modulo: "ts-patch", version: "latest" });
33
+ pack.install({ dev: true, modulo: "ts-node", version: "latest" });
34
+ pack.install({
35
+ dev: true,
36
+ modulo: "typescript",
37
+ version: await getTypeScriptVersion(),
38
+ });
39
+ args.project ??= (() => {
40
+ const runner: string = pack.manager === "npm" ? "npx" : pack.manager;
41
+ CommandExecutor.run(`${runner} tsc --init`);
42
+ return (args.project = "tsconfig.json");
43
+ })();
44
+
45
+ // SETUP TRANSFORMER
46
+ await pack.save((data) => {
47
+ // COMPOSE PREPARE COMMAND
48
+ data.scripts ??= {};
49
+ if (
50
+ typeof data.scripts.prepare === "string" &&
51
+ data.scripts.prepare.trim().length !== 0
52
+ ) {
53
+ if (data.scripts.prepare.includes("ts-patch install") === false)
54
+ data.scripts.prepare = "ts-patch install && " + data.scripts.prepare;
55
+ } else data.scripts.prepare = "ts-patch install";
56
+
57
+ // NO MORE "typia patch" REQUIRED
58
+ data.scripts.prepare = data.scripts.prepare
59
+ .split("&&")
60
+ .map((str) => str.trim())
61
+ .filter((str) => str !== "typia patch")
62
+ .join(" && ");
63
+
64
+ // FOR OLDER VERSIONS
65
+ if (typeof data.scripts.postinstall === "string") {
66
+ data.scripts.postinstall = data.scripts.postinstall
67
+ .split("&&")
68
+ .map((str) => str.trim())
69
+ .filter((str) => str.indexOf("ts-patch install") === -1)
70
+ .join(" && ");
71
+ if (data.scripts.postinstall.length === 0)
72
+ delete data.scripts.postinstall;
73
+ }
74
+ });
75
+ CommandExecutor.run(`${pack.manager} run prepare`);
76
+
77
+ // CONFIGURE PLUGIN
78
+ await PluginConfigurator.configure(args);
79
+ }
80
+
81
+ const getTypeScriptVersion = async (): Promise<string> => {
82
+ const content: string = await fs.promises.readFile(
83
+ `${__dirname}/../package.json`,
84
+ "utf-8",
85
+ );
86
+ const json: { devDependencies: { typescript: string } } =
87
+ JSON.parse(content);
88
+ return json.devDependencies.typescript;
89
+ };
90
+ }
@@ -1,41 +1,41 @@
1
- import cp from "child_process";
2
- import fs from "fs";
3
-
4
- export namespace NestiaStarter {
5
- export const clone =
6
- (halter: (msg?: string) => never) =>
7
- async (argv: string[]): Promise<void> => {
8
- // VALIDATION
9
- const dest: string | undefined = argv[0];
10
- if (dest === undefined) halter();
11
- else if (fs.existsSync(dest) === true)
12
- halter("The target directory already exists.");
13
-
14
- console.log("-----------------------------------------");
15
- console.log(" Nestia Starter Kit");
16
- console.log("-----------------------------------------");
17
-
18
- // COPY PROJECTS
19
- execute(`git clone https://github.com/samchon/nestia-template ${dest}`);
20
- console.log(`cd "${dest}"`);
21
- process.chdir(dest);
22
-
23
- // INSTALL DEPENDENCIES
24
- execute("npm install");
25
-
26
- // BUILD TYPESCRIPT
27
- execute("npm run build");
28
-
29
- // DO TEST
30
- execute("npm run test");
31
-
32
- // REMOVE .GIT DIRECTORY
33
- cp.execSync("npx rimraf .git");
34
- cp.execSync("npx rimraf .github/dependabot.yml");
35
- };
36
-
37
- function execute(command: string): void {
38
- console.log(`\n$ ${command}`);
39
- cp.execSync(command, { stdio: "inherit" });
40
- }
41
- }
1
+ import cp from "child_process";
2
+ import fs from "fs";
3
+
4
+ export namespace NestiaStarter {
5
+ export const clone =
6
+ (halter: (msg?: string) => never) =>
7
+ async (argv: string[]): Promise<void> => {
8
+ // VALIDATION
9
+ const dest: string | undefined = argv[0];
10
+ if (dest === undefined) halter();
11
+ else if (fs.existsSync(dest) === true)
12
+ halter("The target directory already exists.");
13
+
14
+ console.log("-----------------------------------------");
15
+ console.log(" Nestia Starter Kit");
16
+ console.log("-----------------------------------------");
17
+
18
+ // COPY PROJECTS
19
+ execute(`git clone https://github.com/samchon/nestia-template ${dest}`);
20
+ console.log(`cd "${dest}"`);
21
+ process.chdir(dest);
22
+
23
+ // INSTALL DEPENDENCIES
24
+ execute("npm install");
25
+
26
+ // BUILD TYPESCRIPT
27
+ execute("npm run build");
28
+
29
+ // DO TEST
30
+ execute("npm run test");
31
+
32
+ // REMOVE .GIT DIRECTORY
33
+ cp.execSync("npx rimraf .git");
34
+ cp.execSync("npx rimraf .github/dependabot.yml");
35
+ };
36
+
37
+ function execute(command: string): void {
38
+ console.log(`\n$ ${command}`);
39
+ cp.execSync(command, { stdio: "inherit" });
40
+ }
41
+ }
@@ -1,37 +1,37 @@
1
- import cp from "child_process";
2
- import fs from "fs";
3
-
4
- export namespace NestiaTemplate {
5
- export const clone =
6
- (halter: (msg?: string) => never) =>
7
- async (argv: string[]): Promise<void> => {
8
- // VALIDATION
9
- const dest: string | undefined = argv[0];
10
- if (dest === undefined) halter();
11
- else if (fs.existsSync(dest) === true)
12
- halter("The target directory already exists.");
13
-
14
- console.log("-----------------------------------------");
15
- console.log(" Nestia Template Kit");
16
- console.log("-----------------------------------------");
17
-
18
- // COPY PROJECTS
19
- execute(`git clone https://github.com/samchon/backend ${dest}`);
20
- console.log(`cd "${dest}"`);
21
- process.chdir(dest);
22
-
23
- // INSTALL DEPENDENCIES
24
- execute("npm install");
25
-
26
- // BUILD TYPESCRIPT
27
- execute("npm run build");
28
-
29
- // REMOVE .GIT DIRECTORY
30
- cp.execSync("npx rimraf .git");
31
- };
32
-
33
- function execute(command: string): void {
34
- console.log(`\n$ ${command}`);
35
- cp.execSync(command, { stdio: "inherit" });
36
- }
37
- }
1
+ import cp from "child_process";
2
+ import fs from "fs";
3
+
4
+ export namespace NestiaTemplate {
5
+ export const clone =
6
+ (halter: (msg?: string) => never) =>
7
+ async (argv: string[]): Promise<void> => {
8
+ // VALIDATION
9
+ const dest: string | undefined = argv[0];
10
+ if (dest === undefined) halter();
11
+ else if (fs.existsSync(dest) === true)
12
+ halter("The target directory already exists.");
13
+
14
+ console.log("-----------------------------------------");
15
+ console.log(" Nestia Template Kit");
16
+ console.log("-----------------------------------------");
17
+
18
+ // COPY PROJECTS
19
+ execute(`git clone https://github.com/samchon/backend ${dest}`);
20
+ console.log(`cd "${dest}"`);
21
+ process.chdir(dest);
22
+
23
+ // INSTALL DEPENDENCIES
24
+ execute("npm install");
25
+
26
+ // BUILD TYPESCRIPT
27
+ execute("npm run build");
28
+
29
+ // REMOVE .GIT DIRECTORY
30
+ cp.execSync("npx rimraf .git");
31
+ };
32
+
33
+ function execute(command: string): void {
34
+ console.log(`\n$ ${command}`);
35
+ cp.execSync(command, { stdio: "inherit" });
36
+ }
37
+ }
package/src/boot.js ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ require("ts-node").register({
3
+ compilerOptions: {
4
+ plugins: [
5
+ { transform: "typia/lib/transform" },
6
+ { transform: "@nestia/core/lib/transform" },
7
+ { transform: "@nestia/sdk/lib/transform" },
8
+ ],
9
+ experimentalDecorators: true,
10
+ emitDecoratorMetadata: true,
11
+ esModuleInterop: true,
12
+ strict: true,
13
+ },
14
+ });
15
+ require("./index.ts");