nestia 4.3.2 → 4.4.0-dev.20230607

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 CHANGED
@@ -11,21 +11,27 @@ Nestia is a set of helper libraries for NestJS, supporting below features:
11
11
 
12
12
  - `@nestia/core`: super-fast decorators
13
13
  - `@nestia/sdk`:
14
- - SDK generator for clients
15
14
  - Swagger generator evolved than ever
15
+ - SDK library generator for clients
16
+ - Mockup Simulator for client applications
16
17
  - Automatic E2E test functions generator
18
+ - `@nestia/migrate`: migration from Swagger to NestJS
17
19
  - `nestia`: just CLI (command line interface) tool
18
20
 
19
21
  > **Note**
20
22
  >
21
23
  > - **Only one line** required, with pure TypeScript type
22
- > - Runtime validator is **20,000x faster** than `class-validator`
23
- > - JSON serialization is **200x faster** than `class-transformer`
24
- > - SDK is similar with [tRPC](https://trpc.io), but much advanced
24
+ > - Enhance performance **30x** up
25
+ > - Runtime validator is **20,000x faster** than `class-validator`
26
+ > - JSON serialization is **200x faster** than `class-transformer`
27
+ > - Software Development Kit
28
+ > - SDK is a collection of `fetch` functions with type definitions like [tRPC](https://trpc.io/)
29
+ > - Mockup simulator means embedded backend simulator in SDK
30
+ > - similar with [msw](https://mswjs.io/), but fully automated
25
31
 
26
32
  ![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)
27
33
 
28
- > Left is server code, and right is client code utilizing SDK
34
+ > Left is NestJS server code, and right is client (frontend) code utilizing SDK
29
35
 
30
36
 
31
37
 
@@ -46,9 +52,9 @@ Check out the document in the [website](https://nestia.io/docs/):
46
52
  ### 🏠 Home
47
53
  - [Introduction](https://nestia.io/docs/)
48
54
  - [Setup](https://nestia.io/docs/setup/)
55
+ - [Pure TypeScript](https://nestia.io/docs/pure)
49
56
 
50
57
  ### 📖 Features
51
- - [Pure TypeScript](https://nestia.io/docs/pure)
52
58
  - Core Library
53
59
  - [TypedRoute](https://nestia.io/docs/core/TypedRoute/)
54
60
  - [TypedBody](https://nestia.io/docs/core/TypedBody/)
@@ -58,3 +64,9 @@ Check out the document in the [website](https://nestia.io/docs/):
58
64
  - [Swagger Documents](https://nestia.io/docs/sdk/swagger/)
59
65
  - [SDK Library](https://nestia.io/docs/sdk/sdk/)
60
66
  - [E2E Functions](https://nestia.io/docs/sdk/e2e/)
67
+ - [Mockup Simulator](https://nestia.io/docs/sdk/simulator/)
68
+ - [Swagger to NestJS](https://nestia.io/docs/migrate/)
69
+
70
+ ### 🔗 Appendix
71
+ - [⇲ Benchmark Result](https://github.com/samchon/nestia/tree/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz)
72
+ - [⇲ `dev.to` Articles](https://dev.to/samchon/series/22751)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nestia",
3
- "version": "4.3.2",
3
+ "version": "4.4.0-dev.20230607",
4
4
  "description": "Nestia CLI tool",
5
5
  "main": "bin/index.js",
6
6
  "bin": {
@@ -36,14 +36,14 @@
36
36
  "inquirer": "^8.2.5"
37
37
  },
38
38
  "devDependencies": {
39
- "@nestia/core": "^1.3.0",
40
- "@nestia/sdk": "^1.3.0",
39
+ "@nestia/core": "^1.6.1",
40
+ "@nestia/sdk": "^1.6.1",
41
41
  "@trivago/prettier-plugin-sort-imports": "^4.1.1",
42
42
  "@types/inquirer": "^9.0.3",
43
43
  "@types/node": "^18.11.16",
44
44
  "prettier": "^2.8.7",
45
45
  "rimraf": "^3.0.2",
46
- "typescript": "^5.1.3"
46
+ "typescript": "^5.1.6"
47
47
  },
48
48
  "files": [
49
49
  "bin",
@@ -20,23 +20,37 @@ export namespace NestiaSetupWizard {
20
20
  pack.install({ dev: true, modulo: "ts-node", version: "latest" });
21
21
  pack.install({ dev: true, modulo: "typescript", version: "latest" });
22
22
  args.project ??= (() => {
23
- CommandExecutor.run("npx tsc --init");
23
+ const runner: string =
24
+ pack.manager === "npm" ? "npx" : pack.manager;
25
+ CommandExecutor.run(`${runner} tsc --init`);
24
26
  return (args.project = "tsconfig.json");
25
27
  })();
26
28
 
27
29
  // SETUP TRANSFORMER
28
30
  await pack.save((data) => {
31
+ // COMPOSE POSTINSTALL COMMAND
29
32
  data.scripts ??= {};
30
33
  if (
31
- typeof data.scripts.prepare === "string" &&
32
- data.scripts.prepare.length
34
+ typeof data.scripts.postinstall === "string" &&
35
+ data.scripts.postinstall.trim().length
33
36
  ) {
34
- if (data.scripts.prepare.indexOf("ts-patch install") === -1)
35
- data.scripts.prepare =
36
- "ts-patch install && " + data.scripts.prepare;
37
- } else data.scripts.prepare = "ts-patch install";
37
+ if (data.scripts.postinstall.indexOf("ts-patch install") === -1)
38
+ data.scripts.postinstall =
39
+ "ts-patch install && " + data.scripts.postinstall;
40
+ } else data.scripts.postinstall = "ts-patch install";
41
+
42
+ // FOR OLDER VERSIONS
43
+ if (typeof data.scripts.prepare === "string") {
44
+ data.scripts.prepare = data.scripts.prepare
45
+ .split("&&")
46
+ .map((str) => str.trim())
47
+ .filter((str) => str.indexOf("ts-patch install") === -1)
48
+ .join(" && ");
49
+ if (data.scripts.prepare.length === 0)
50
+ delete data.scripts.prepare;
51
+ }
38
52
  });
39
- CommandExecutor.run("npm run prepare");
53
+ CommandExecutor.run(`${pack.manager} run postinstall`);
40
54
 
41
55
  // INSTALL AND CONFIGURE TYPIA + NESTIA
42
56
  pack.install({ dev: false, modulo: "typia", version: "latest" });
@@ -12,7 +12,7 @@ export namespace ArgumentParser {
12
12
 
13
13
  export async function parse(pack: PackageManager): Promise<IArguments> {
14
14
  // PREPARE ASSETS
15
- commander.program.option("--manager [manager", "package manager");
15
+ commander.program.option("--manager [manager]", "package manager");
16
16
  commander.program.option(
17
17
  "--project [project]",
18
18
  "tsconfig.json file location",
@@ -39,6 +39,7 @@ export namespace ArgumentParser {
39
39
  (message: string) =>
40
40
  async <Choice extends string>(
41
41
  choices: Choice[],
42
+ filter?: (value: string) => Choice,
42
43
  ): Promise<Choice> => {
43
44
  questioned.value = true;
44
45
  return (
@@ -47,6 +48,7 @@ export namespace ArgumentParser {
47
48
  name: name,
48
49
  message: message,
49
50
  choices: choices,
51
+ filter,
50
52
  })
51
53
  )[name];
52
54
  };
@@ -78,11 +80,14 @@ export namespace ArgumentParser {
78
80
 
79
81
  // DO CONSTRUCT
80
82
  return action(async (options) => {
81
- options.manager ??= await select("manager")("Package Manager")([
82
- "npm" as const,
83
- "pnpm" as const,
84
- "yarn" as const,
85
- ]);
83
+ options.manager ??= await select("manager")("Package Manager")(
84
+ [
85
+ "npm" as const,
86
+ "pnpm" as const,
87
+ "yarn (berry is not supported)" as "yarn",
88
+ ],
89
+ (value) => value.split(" ")[0] as "yarn",
90
+ );
86
91
  pack.manager = options.manager;
87
92
  options.project ??= await configure();
88
93
 
@@ -1,3 +0,0 @@
1
- export declare namespace NestiaSetupWizard {
2
- function setup(): Promise<void>;
3
- }
@@ -1,61 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.NestiaSetupWizard = void 0;
13
- const ArgumentParser_1 = require("./internal/ArgumentParser");
14
- const CommandExecutor_1 = require("./internal/CommandExecutor");
15
- const PackageManager_1 = require("./internal/PackageManager");
16
- const PluginConfigurator_1 = require("./internal/PluginConfigurator");
17
- var NestiaSetupWizard;
18
- (function (NestiaSetupWizard) {
19
- function setup() {
20
- var _a;
21
- return __awaiter(this, void 0, void 0, function* () {
22
- console.log("----------------------------------------");
23
- console.log(" Nestia Setup Wizard");
24
- console.log("----------------------------------------");
25
- // PREPARE ASSETS
26
- const pack = yield PackageManager_1.PackageManager.mount();
27
- const args = yield ArgumentParser_1.ArgumentParser.parse(pack);
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({ dev: true, modulo: "typescript", version: "latest" });
32
- (_a = args.project) !== null && _a !== void 0 ? _a : (args.project = (() => {
33
- CommandExecutor_1.CommandExecutor.run("npx tsc --init");
34
- return (args.project = "tsconfig.json");
35
- })());
36
- // SETUP TRANSFORMER
37
- yield pack.save((data) => {
38
- var _a;
39
- (_a = data.scripts) !== null && _a !== void 0 ? _a : (data.scripts = {});
40
- if (typeof data.scripts.prepare === "string" &&
41
- data.scripts.prepare.length) {
42
- if (data.scripts.prepare.indexOf("ts-patch install") === -1)
43
- data.scripts.prepare =
44
- "ts-patch install && " + data.scripts.prepare;
45
- }
46
- else
47
- data.scripts.prepare = "ts-patch install";
48
- });
49
- CommandExecutor_1.CommandExecutor.run("npm run prepare");
50
- // INSTALL AND CONFIGURE TYPIA + NESTIA
51
- pack.install({ dev: false, modulo: "typia", version: "latest" });
52
- pack.install({ dev: false, modulo: "@nestia/core", version: "latest" });
53
- pack.install({ dev: true, modulo: "@nestia/e2e", version: "latest" });
54
- pack.install({ dev: true, modulo: "@nestia/sdk", version: "latest" });
55
- pack.install({ dev: true, modulo: "nestia", version: "latest" });
56
- yield PluginConfigurator_1.PluginConfigurator.configure(args);
57
- });
58
- }
59
- NestiaSetupWizard.setup = setup;
60
- })(NestiaSetupWizard || (exports.NestiaSetupWizard = NestiaSetupWizard = {}));
61
- //# sourceMappingURL=NestiaSetupWizard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NestiaSetupWizard.js","sourceRoot":"","sources":["../src/NestiaSetupWizard.ts"],"names":[],"mappings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namespace NestiaStarter {
2
- const start: (halter: (msg?: string) => never) => (argv: string[]) => Promise<void>;
3
- }
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.NestiaStarter = void 0;
16
- const child_process_1 = __importDefault(require("child_process"));
17
- const fs_1 = __importDefault(require("fs"));
18
- var NestiaStarter;
19
- (function (NestiaStarter) {
20
- NestiaStarter.start = (halter) => (argv) => __awaiter(this, void 0, void 0, function* () {
21
- // VALIDATION
22
- const dest = argv[0];
23
- if (dest === undefined)
24
- halter();
25
- else if (fs_1.default.existsSync(dest) === true)
26
- halter("The target directory already exists.");
27
- console.log("-----------------------------------------");
28
- console.log(" Nestia Starter Kit");
29
- console.log("-----------------------------------------");
30
- // COPY PROJECTS
31
- execute(`git clone https://github.com/samchon/nestia-template ${dest}`);
32
- console.log(`cd "${dest}"`);
33
- process.chdir(dest);
34
- // INSTALL DEPENDENCIES
35
- execute("npm install");
36
- // BUILD TYPESCRIPT
37
- execute("npm run build");
38
- // DO TEST
39
- execute("npm run test");
40
- // REMOVE .GIT DIRECTORY
41
- child_process_1.default.execSync("npx rimraf .git");
42
- });
43
- function execute(command) {
44
- console.log(command);
45
- child_process_1.default.execSync(command, { stdio: "inherit" });
46
- }
47
- })(NestiaStarter || (exports.NestiaStarter = NestiaStarter =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S,EAAE,CAAC,CAAC;IAC/C,CAAC;AACL,CAAC,EAtCgB,aAAa,6BAAb,aAAa,QAsC7B"}
package/bin/index.d.ts DELETED
@@ -1,4 +0,0 @@
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>\n 2. npx nestia setup\n 3. npx nestia dependencies\n 4. npx nestia init\n 5. npx nestia sdk\n 6. npx nestia swagger\n 7. npx nestia e2e\n";
3
- declare function halt(desc: string): never;
4
- declare function main(): Promise<void>;
package/bin/index.js DELETED
@@ -1,90 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || function (mod) {
20
- if (mod && mod.__esModule) return mod;
21
- var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
- __setModuleDefault(result, mod);
24
- return result;
25
- };
26
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
27
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
28
- return new (P || (P = Promise))(function (resolve, reject) {
29
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
30
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
31
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
32
- step((generator = generator.apply(thisArg, _arguments || [])).next());
33
- });
34
- };
35
- const USAGE = `Wrong command has been detected. Use like below:
36
-
37
- npx nestia [command] [options?]
38
-
39
- 1. npx nestia start <directory>
40
- 2. npx nestia setup
41
- 3. npx nestia dependencies
42
- 4. npx nestia init
43
- 5. npx nestia sdk
44
- 6. npx nestia swagger
45
- 7. npx nestia e2e
46
- `;
47
- function halt(desc) {
48
- console.error(desc);
49
- process.exit(-1);
50
- }
51
- function main() {
52
- return __awaiter(this, void 0, void 0, function* () {
53
- const type = process.argv[2];
54
- const argv = process.argv.slice(3);
55
- if (type === "start") {
56
- yield (yield Promise.resolve().then(() => __importStar(require("./NestiaStarter")))).NestiaStarter.start((msg) => halt(msg !== null && msg !== void 0 ? msg : USAGE))(argv);
57
- }
58
- else if (type === "setup") {
59
- try {
60
- yield Promise.resolve().then(() => __importStar(require("comment-json")));
61
- yield Promise.resolve().then(() => __importStar(require("inquirer")));
62
- yield Promise.resolve().then(() => __importStar(require("commander")));
63
- }
64
- catch (_a) {
65
- halt(`nestia has not been installed. Run "npm i -D nestia" before.`);
66
- }
67
- yield (yield Promise.resolve().then(() => __importStar(require("./NestiaSetupWizard")))).NestiaSetupWizard.setup();
68
- }
69
- else if (type === "dependencies" ||
70
- type === "init" ||
71
- type === "sdk" ||
72
- type === "swagger" ||
73
- type === "e2e") {
74
- try {
75
- require.resolve("@nestia/sdk/lib/executable/sdk");
76
- }
77
- catch (_b) {
78
- halt(`@nestia/sdk has not been installed. Run "npx nestia setup" before.`);
79
- }
80
- yield Promise.resolve().then(() => __importStar(require("@nestia/sdk/lib/executable/sdk")));
81
- }
82
- else
83
- halt(USAGE);
84
- });
85
- }
86
- main().catch((exp) => {
87
- console.log(exp.message);
88
- process.exit(-1);
89
- });
90
- //# sourceMappingURL=index.js.map
package/bin/index.js.map DELETED
@@ -1 +0,0 @@
1
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C;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"}
@@ -1,8 +0,0 @@
1
- import { PackageManager } from "./PackageManager";
2
- export declare namespace ArgumentParser {
3
- interface IArguments {
4
- manager: "npm" | "pnpm" | "yarn";
5
- project: string | null;
6
- }
7
- function parse(pack: PackageManager): Promise<IArguments>;
8
- }
@@ -1,88 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.ArgumentParser = void 0;
16
- const commander_1 = __importDefault(require("commander"));
17
- const fs_1 = __importDefault(require("fs"));
18
- const inquirer_1 = __importDefault(require("inquirer"));
19
- var ArgumentParser;
20
- (function (ArgumentParser) {
21
- function parse(pack) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- // PREPARE ASSETS
24
- commander_1.default.program.option("--manager [manager", "package manager");
25
- commander_1.default.program.option("--project [project]", "tsconfig.json file location");
26
- // INTERNAL PROCEDURES
27
- const questioned = { value: false };
28
- const action = (closure) => {
29
- return new Promise((resolve, reject) => {
30
- commander_1.default.program.action((options) => __awaiter(this, void 0, void 0, function* () {
31
- try {
32
- resolve(yield closure(options));
33
- }
34
- catch (exp) {
35
- reject(exp);
36
- }
37
- }));
38
- commander_1.default.program.parseAsync().catch(reject);
39
- });
40
- };
41
- const select = (name) => (message) => (choices) => __awaiter(this, void 0, void 0, function* () {
42
- questioned.value = true;
43
- return (yield inquirer_1.default.createPromptModule()({
44
- type: "list",
45
- name: name,
46
- message: message,
47
- choices: choices,
48
- }))[name];
49
- });
50
- const configure = () => __awaiter(this, void 0, void 0, function* () {
51
- const fileList = yield (yield fs_1.default.promises.readdir(process.cwd()))
52
- .filter((str) => str.substring(0, 8) === "tsconfig" &&
53
- str.substring(str.length - 5) === ".json")
54
- .sort((x, y) => x === "tsconfig.json"
55
- ? -1
56
- : y === "tsconfig.json"
57
- ? 1
58
- : x < y
59
- ? -1
60
- : 1);
61
- if (fileList.length === 0) {
62
- if (process.cwd() !== pack.directory)
63
- throw new Error(`Unable to find "tsconfig.json" file.`);
64
- return null;
65
- }
66
- else if (fileList.length === 1)
67
- return fileList[0];
68
- return select("tsconfig")("TS Config File")(fileList);
69
- });
70
- // DO CONSTRUCT
71
- return action((options) => __awaiter(this, void 0, void 0, function* () {
72
- var _a, _b;
73
- (_a = options.manager) !== null && _a !== void 0 ? _a : (options.manager = yield select("manager")("Package Manager")([
74
- "npm",
75
- "pnpm",
76
- "yarn",
77
- ]));
78
- pack.manager = options.manager;
79
- (_b = options.project) !== null && _b !== void 0 ? _b : (options.project = yield configure());
80
- if (questioned.value)
81
- console.log("");
82
- return options;
83
- }));
84
- });
85
- }
86
- ArgumentParser.parse = parse;
87
- })(ArgumentParser || (exports.ArgumentParser = ArgumentParser = {}));
88
- //# sourceMappingURL=ArgumentParser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ArgumentParser.js","sourceRoot":"","sources":["../../src/internal/ArgumentParser.ts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,KAAc;oBACd,MAAe;oBACf,MAAe;iBAClB,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,8BAAd,cAAc,QAsF9B"}
@@ -1,3 +0,0 @@
1
- export declare namespace CommandExecutor {
2
- function run(str: string): void;
3
- }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CommandExecutor = void 0;
7
- const child_process_1 = __importDefault(require("child_process"));
8
- var CommandExecutor;
9
- (function (CommandExecutor) {
10
- function run(str) {
11
- console.log(str);
12
- child_process_1.default.execSync(str, { stdio: "ignore" });
13
- }
14
- CommandExecutor.run = run;
15
- })(CommandExecutor || (exports.CommandExecutor = CommandExecutor = {}));
16
- //# sourceMappingURL=CommandExecutor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CommandExecutor.js","sourceRoot":"","sources":["../../src/internal/CommandExecutor.ts"],"names":[],"mappings":";;;;;;AAAA,kEAA+B;AAE/B,IAAiB,eAAe,CAK/B;AALD,WAAiB,eAAe;IAC5B,SAAgB,GAAG,CAAC,GAAW;QAC3B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjB,uBAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC1C,CAAC;IAHe,mBAAG,MAGlB,CAAA;AACL,CAAC,EALgB,eAAe,+BAAf,eAAe,QAK/B"}
@@ -1,4 +0,0 @@
1
- export declare namespace FileRetriever {
2
- const directory: (name: string) => (dir: string, depth?: number) => string | null;
3
- const file: (name: string) => (directory: string, depth?: number) => string | null;
4
- }
@@ -1,28 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FileRetriever = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- var FileRetriever;
10
- (function (FileRetriever) {
11
- FileRetriever.directory = (name) => (dir, depth = 0) => {
12
- const location = path_1.default.join(dir, name);
13
- if (fs_1.default.existsSync(location))
14
- return dir;
15
- else if (depth > 2)
16
- return null;
17
- return FileRetriever.directory(name)(path_1.default.join(dir, ".."), depth + 1);
18
- };
19
- FileRetriever.file = (name) => (directory, depth = 0) => {
20
- const location = path_1.default.join(directory, name);
21
- if (fs_1.default.existsSync(location))
22
- return location;
23
- else if (depth > 2)
24
- return null;
25
- return FileRetriever.file(name)(path_1.default.join(directory, ".."), depth + 1);
26
- };
27
- })(FileRetriever || (exports.FileRetriever = FileRetriever = {}));
28
- //# sourceMappingURL=FileRetriever.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FileRetriever.js","sourceRoot":"","sources":["../../src/internal/FileRetriever.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,IAAiB,aAAa,CAkB7B;AAlBD,WAAiB,aAAa;IACb,uBAAS,GAClB,CAAC,IAAY,EAAE,EAAE,CACjB,CAAC,GAAW,EAAE,QAAgB,CAAC,EAAiB,EAAE;QAC9C,MAAM,QAAQ,GAAW,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC9C,IAAI,YAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;YAAE,OAAO,GAAG,CAAC;aACnC,IAAI,KAAK,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAChC,OAAO,cAAA,SAAS,CAAC,IAAI,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC;IAEO,kBAAI,GACb,CAAC,IAAY,EAAE,EAAE,CACjB,CAAC,SAAiB,EAAE,QAAgB,CAAC,EAAiB,EAAE;QACpD,MAAM,QAAQ,GAAW,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QACpD,IAAI,YAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;YAAE,OAAO,QAAQ,CAAC;aACxC,IAAI,KAAK,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAChC,OAAO,cAAA,IAAI,CAAC,IAAI,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IAC7D,CAAC,CAAC;AACV,CAAC,EAlBgB,aAAa,6BAAb,aAAa,QAkB7B"}
@@ -1,22 +0,0 @@
1
- export declare class PackageManager {
2
- readonly directory: string;
3
- data: Package.Data;
4
- manager: string;
5
- get file(): string;
6
- static mount(): Promise<PackageManager>;
7
- save(modifier: (data: Package.Data) => void): Promise<void>;
8
- install(props: {
9
- dev: boolean;
10
- modulo: string;
11
- version: `latest` | `${number}.${number}.${number}`;
12
- }): boolean;
13
- private constructor();
14
- private static load;
15
- }
16
- export declare namespace Package {
17
- interface Data {
18
- scripts?: Record<string, string>;
19
- dependencies?: Record<string, string>;
20
- devDependencies?: Record<string, string>;
21
- }
22
- }
@@ -1,60 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.PackageManager = void 0;
16
- const fs_1 = __importDefault(require("fs"));
17
- const path_1 = __importDefault(require("path"));
18
- const CommandExecutor_1 = require("./CommandExecutor");
19
- const FileRetriever_1 = require("./FileRetriever");
20
- class PackageManager {
21
- get file() {
22
- return path_1.default.join(this.directory, "package.json");
23
- }
24
- static mount() {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- const location = yield FileRetriever_1.FileRetriever.directory("package.json")(process.cwd());
27
- if (location === null)
28
- throw new Error(`Unable to find "package.json" file`);
29
- return new PackageManager(location, yield this.load(path_1.default.join(location, "package.json")));
30
- });
31
- }
32
- save(modifier) {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- const content = yield fs_1.default.promises.readFile(this.file, "utf8");
35
- this.data = JSON.parse(content);
36
- modifier(this.data);
37
- return fs_1.default.promises.writeFile(this.file, JSON.stringify(this.data, null, 2), "utf8");
38
- });
39
- }
40
- install(props) {
41
- const middle = this.manager === "yarn"
42
- ? `add${props.dev ? " -D" : ""}`
43
- : `install ${props.dev ? "--save-dev" : "--save"}`;
44
- CommandExecutor_1.CommandExecutor.run(`${this.manager} ${middle} ${props.modulo}${props.version ? `@${props.version}` : ""}`);
45
- return true;
46
- }
47
- constructor(directory, data) {
48
- this.directory = directory;
49
- this.data = data;
50
- this.manager = "npm";
51
- }
52
- static load(file) {
53
- return __awaiter(this, void 0, void 0, function* () {
54
- const content = yield fs_1.default.promises.readFile(file, "utf8");
55
- return JSON.parse(content);
56
- });
57
- }
58
- }
59
- exports.PackageManager = PackageManager;
60
- //# sourceMappingURL=PackageManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PackageManager.js","sourceRoot":"","sources":["../../src/internal/PackageManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,uDAAoD;AACpD,mDAAgD;AAEhD,MAAa,cAAc;IAEvB,IAAW,IAAI;QACX,OAAO,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IACrD,CAAC;IAEM,MAAM,CAAO,KAAK;;YACrB,MAAM,QAAQ,GAAkB,MAAM,6BAAa,CAAC,SAAS,CACzD,cAAc,CACjB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YACjB,IAAI,QAAQ,KAAK,IAAI;gBACjB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;YAE1D,OAAO,IAAI,cAAc,CACrB,QAAQ,EACR,MAAM,IAAI,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CACvD,CAAC;QACN,CAAC;KAAA;IAEY,IAAI,CAAC,QAAsC;;YACpD,MAAM,OAAO,GAAW,MAAM,YAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACtE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAChC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAEpB,OAAO,YAAE,CAAC,QAAQ,CAAC,SAAS,CACxB,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAClC,MAAM,CACT,CAAC;QACN,CAAC;KAAA;IAEM,OAAO,CAAC,KAId;QACG,MAAM,MAAM,GACR,IAAI,CAAC,OAAO,KAAK,MAAM;YACnB,CAAC,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YAChC,CAAC,CAAC,WAAW,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC3D,iCAAe,CAAC,GAAG,CACf,GAAG,IAAI,CAAC,OAAO,IAAI,MAAM,IAAI,KAAK,CAAC,MAAM,GACrC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAC1C,EAAE,CACL,CAAC;QACF,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,YACoB,SAAiB,EAC1B,IAAkB;QADT,cAAS,GAAT,SAAS,CAAQ;QAC1B,SAAI,GAAJ,IAAI,CAAc;QAjDtB,YAAO,GAAW,KAAK,CAAC;IAkD5B,CAAC;IAEI,MAAM,CAAO,IAAI,CAAC,IAAY;;YAClC,MAAM,OAAO,GAAW,MAAM,YAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACjE,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;KAAA;CACJ;AAzDD,wCAyDC"}
@@ -1,4 +0,0 @@
1
- import { ArgumentParser } from "./ArgumentParser";
2
- export declare namespace PluginConfigurator {
3
- function configure(args: ArgumentParser.IArguments): Promise<void>;
4
- }
@@ -1,89 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.PluginConfigurator = void 0;
16
- const comment_json_1 = __importDefault(require("comment-json"));
17
- const fs_1 = __importDefault(require("fs"));
18
- var PluginConfigurator;
19
- (function (PluginConfigurator) {
20
- function configure(args) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- // GET COMPILER-OPTIONS
23
- const config = comment_json_1.default.parse(yield fs_1.default.promises.readFile(args.project, "utf8"));
24
- const compilerOptions = config.compilerOptions;
25
- if (compilerOptions === undefined)
26
- throw new Error(`${args.project} file does not have "compilerOptions" property.`);
27
- // PREPARE PLUGINS
28
- const plugins = (() => {
29
- const plugins = compilerOptions.plugins;
30
- if (plugins === undefined)
31
- return (compilerOptions.plugins = []);
32
- else if (!Array.isArray(plugins))
33
- throw new Error(`"plugins" property of ${args.project} must be array type.`);
34
- return plugins;
35
- })();
36
- // CHECK WHETHER CONFIGURED
37
- const strict = compilerOptions.strict;
38
- const strictNullChecks = compilerOptions.strictNullChecks;
39
- const core = plugins.find((p) => typeof p === "object" &&
40
- p !== null &&
41
- p.transform === "@nestia/core/lib/transform");
42
- const typia = plugins.find((p) => typeof p === "object" &&
43
- p !== null &&
44
- p.transform === "typia/lib/transform");
45
- if (strictNullChecks !== false &&
46
- (strict === true || strictNullChecks === true) &&
47
- core !== undefined &&
48
- typia !== undefined)
49
- return;
50
- // DO CONFIGURE
51
- compilerOptions.strictNullChecks = true;
52
- if (strict === undefined && strictNullChecks === undefined)
53
- compilerOptions.strict = true;
54
- compilerOptions.experimentalDecorators = true;
55
- compilerOptions.emitDecoratorMetadata = true;
56
- if (core === undefined)
57
- plugins.push(comment_json_1.default.parse(`{
58
- "transform": "@nestia/core/lib/transform",
59
- /**
60
- * Validate request body.
61
- *
62
- * - "assert": Use typia.assert() function
63
- * - "is": Use typia.is() function
64
- * - "validate": Use typia.validate() function
65
- * - "assertEquals": Use typia.assertEquals() function
66
- * - "equals": Use typia.equals() function
67
- * - "validateEquals": Use typia.validateEquals() function
68
- */
69
- "validate": "assert",
70
-
71
- /**
72
- * Validate JSON typed response body.
73
- *
74
- * - "assert": Use typia.assertStringify() function
75
- * - "is": Use typia.isStringify() function
76
- * - "validate": Use typia.validateStringify() function
77
- * - "stringify": Use typia.stringify() function, but dangerous
78
- * - null: Just use JSON.stringify() function, without boosting
79
- */
80
- "stringify": "assert"
81
- }`));
82
- if (typia === undefined)
83
- plugins.push(comment_json_1.default.parse(`{ "transform": "typia/lib/transform" }`));
84
- yield fs_1.default.promises.writeFile(args.project, comment_json_1.default.stringify(config, null, 2));
85
- });
86
- }
87
- PluginConfigurator.configure = configure;
88
- })(PluginConfigurator || (exports.PluginConfigurator = PluginConfigurator = {}));
89
- //# sourceMappingURL=PluginConfigurator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PluginConfigurator.js","sourceRoot":"","sources":["../../src/internal/PluginConfigurator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAAoC;AACpC,4CAAoB;AAIpB,IAAiB,kBAAkB,CAqGlC;AArGD,WAAiB,kBAAkB;IAC/B,SAAsB,SAAS,CAC3B,IAA+B;;YAE/B,uBAAuB;YACvB,MAAM,MAAM,GAA2B,sBAAQ,CAAC,KAAK,CACjD,MAAM,YAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAQ,EAAE,MAAM,CAAC,CAC1B,CAAC;YAC5B,MAAM,eAAe,GACjB,MAAM,CAAC,eAAqD,CAAC;YACjE,IAAI,eAAe,KAAK,SAAS;gBAC7B,MAAM,IAAI,KAAK,CACX,GAAG,IAAI,CAAC,OAAO,iDAAiD,CACnE,CAAC;YAEN,kBAAkB;YAClB,MAAM,OAAO,GAAkD,CAAC,GA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