@depup/nestjs__cli 11.0.16-depup.1

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 (196) hide show
  1. package/LICENSE +24 -0
  2. package/README.md +42 -0
  3. package/actions/abstract.action.d.ts +4 -0
  4. package/actions/abstract.action.js +6 -0
  5. package/actions/add.action.d.ts +12 -0
  6. package/actions/add.action.js +113 -0
  7. package/actions/build.action.d.ts +22 -0
  8. package/actions/build.action.js +145 -0
  9. package/actions/generate.action.d.ts +5 -0
  10. package/actions/generate.action.js +97 -0
  11. package/actions/index.d.ts +7 -0
  12. package/actions/index.js +23 -0
  13. package/actions/info.action.d.ts +35 -0
  14. package/actions/info.action.js +181 -0
  15. package/actions/new.action.d.ts +7 -0
  16. package/actions/new.action.js +186 -0
  17. package/actions/start.action.d.ts +10 -0
  18. package/actions/start.action.js +122 -0
  19. package/bin/nest.d.ts +2 -0
  20. package/bin/nest.js +25 -0
  21. package/changes.json +54 -0
  22. package/commands/abstract.command.d.ts +7 -0
  23. package/commands/abstract.command.js +9 -0
  24. package/commands/add.command.d.ts +5 -0
  25. package/commands/add.command.js +36 -0
  26. package/commands/build.command.d.ts +5 -0
  27. package/commands/build.command.js +74 -0
  28. package/commands/command.input.d.ts +5 -0
  29. package/commands/command.input.js +2 -0
  30. package/commands/command.loader.d.ts +5 -0
  31. package/commands/command.loader.js +31 -0
  32. package/commands/generate.command.d.ts +9 -0
  33. package/commands/generate.command.js +107 -0
  34. package/commands/index.d.ts +2 -0
  35. package/commands/index.js +18 -0
  36. package/commands/info.command.d.ts +5 -0
  37. package/commands/info.command.js +16 -0
  38. package/commands/new.command.d.ts +5 -0
  39. package/commands/new.command.js +61 -0
  40. package/commands/start.command.d.ts +5 -0
  41. package/commands/start.command.js +104 -0
  42. package/lib/compiler/assets-manager.d.ts +15 -0
  43. package/lib/compiler/assets-manager.js +129 -0
  44. package/lib/compiler/base-compiler.d.ts +9 -0
  45. package/lib/compiler/base-compiler.js +26 -0
  46. package/lib/compiler/compiler.d.ts +12 -0
  47. package/lib/compiler/compiler.js +61 -0
  48. package/lib/compiler/defaults/swc-defaults.d.ts +61 -0
  49. package/lib/compiler/defaults/swc-defaults.js +57 -0
  50. package/lib/compiler/defaults/webpack-defaults.d.ts +3 -0
  51. package/lib/compiler/defaults/webpack-defaults.js +104 -0
  52. package/lib/compiler/helpers/append-extension.d.ts +1 -0
  53. package/lib/compiler/helpers/append-extension.js +7 -0
  54. package/lib/compiler/helpers/copy-path-resolve.d.ts +7 -0
  55. package/lib/compiler/helpers/copy-path-resolve.js +25 -0
  56. package/lib/compiler/helpers/delete-out-dir.d.ts +2 -0
  57. package/lib/compiler/helpers/delete-out-dir.js +12 -0
  58. package/lib/compiler/helpers/get-builder.d.ts +21 -0
  59. package/lib/compiler/helpers/get-builder.js +19 -0
  60. package/lib/compiler/helpers/get-tsc-config.path.d.ts +10 -0
  61. package/lib/compiler/helpers/get-tsc-config.path.js +24 -0
  62. package/lib/compiler/helpers/get-value-or-default.d.ts +4 -0
  63. package/lib/compiler/helpers/get-value-or-default.js +66 -0
  64. package/lib/compiler/helpers/get-webpack-config-path.d.ts +10 -0
  65. package/lib/compiler/helpers/get-webpack-config-path.js +23 -0
  66. package/lib/compiler/helpers/manual-restart.d.ts +2 -0
  67. package/lib/compiler/helpers/manual-restart.js +17 -0
  68. package/lib/compiler/helpers/tsconfig-provider.d.ts +11 -0
  69. package/lib/compiler/helpers/tsconfig-provider.js +22 -0
  70. package/lib/compiler/hooks/tsconfig-paths.hook.d.ts +2 -0
  71. package/lib/compiler/hooks/tsconfig-paths.hook.js +76 -0
  72. package/lib/compiler/interfaces/readonly-visitor.interface.d.ts +10 -0
  73. package/lib/compiler/interfaces/readonly-visitor.interface.js +2 -0
  74. package/lib/compiler/plugins/plugin-metadata-generator.d.ts +58 -0
  75. package/lib/compiler/plugins/plugin-metadata-generator.js +84 -0
  76. package/lib/compiler/plugins/plugin-metadata-printer.d.ts +17 -0
  77. package/lib/compiler/plugins/plugin-metadata-printer.js +51 -0
  78. package/lib/compiler/plugins/plugins-loader.d.ts +30 -0
  79. package/lib/compiler/plugins/plugins-loader.js +70 -0
  80. package/lib/compiler/swc/constants.d.ts +9 -0
  81. package/lib/compiler/swc/constants.js +13 -0
  82. package/lib/compiler/swc/forked-type-checker.d.ts +1 -0
  83. package/lib/compiler/swc/forked-type-checker.js +63 -0
  84. package/lib/compiler/swc/swc-compiler.d.ts +25 -0
  85. package/lib/compiler/swc/swc-compiler.js +231 -0
  86. package/lib/compiler/swc/type-checker-host.d.ts +14 -0
  87. package/lib/compiler/swc/type-checker-host.js +90 -0
  88. package/lib/compiler/typescript-loader.d.ts +6 -0
  89. package/lib/compiler/typescript-loader.js +31 -0
  90. package/lib/compiler/watch-compiler.d.ts +22 -0
  91. package/lib/compiler/watch-compiler.js +89 -0
  92. package/lib/compiler/webpack-compiler.d.ts +21 -0
  93. package/lib/compiler/webpack-compiler.js +99 -0
  94. package/lib/configuration/configuration.d.ts +91 -0
  95. package/lib/configuration/configuration.js +2 -0
  96. package/lib/configuration/configuration.loader.d.ts +4 -0
  97. package/lib/configuration/configuration.loader.js +2 -0
  98. package/lib/configuration/defaults.d.ts +6 -0
  99. package/lib/configuration/defaults.js +86 -0
  100. package/lib/configuration/index.d.ts +3 -0
  101. package/lib/configuration/index.js +19 -0
  102. package/lib/configuration/nest-configuration.loader.d.ts +8 -0
  103. package/lib/configuration/nest-configuration.loader.js +61 -0
  104. package/lib/package-managers/abstract.package-manager.d.ts +25 -0
  105. package/lib/package-managers/abstract.package-manager.js +151 -0
  106. package/lib/package-managers/index.d.ts +8 -0
  107. package/lib/package-managers/index.js +24 -0
  108. package/lib/package-managers/npm.package-manager.d.ts +7 -0
  109. package/lib/package-managers/npm.package-manager.js +26 -0
  110. package/lib/package-managers/package-manager-commands.d.ts +9 -0
  111. package/lib/package-managers/package-manager-commands.js +2 -0
  112. package/lib/package-managers/package-manager.d.ts +5 -0
  113. package/lib/package-managers/package-manager.factory.d.ts +6 -0
  114. package/lib/package-managers/package-manager.factory.js +41 -0
  115. package/lib/package-managers/package-manager.js +9 -0
  116. package/lib/package-managers/pnpm.package-manager.d.ts +7 -0
  117. package/lib/package-managers/pnpm.package-manager.js +27 -0
  118. package/lib/package-managers/project.dependency.d.ts +4 -0
  119. package/lib/package-managers/project.dependency.js +2 -0
  120. package/lib/package-managers/yarn.package-manager.d.ts +7 -0
  121. package/lib/package-managers/yarn.package-manager.js +26 -0
  122. package/lib/questions/questions.d.ts +9 -0
  123. package/lib/questions/questions.js +27 -0
  124. package/lib/readers/file-system.reader.d.ts +8 -0
  125. package/lib/readers/file-system.reader.js +46 -0
  126. package/lib/readers/index.d.ts +2 -0
  127. package/lib/readers/index.js +18 -0
  128. package/lib/readers/reader.d.ts +10 -0
  129. package/lib/readers/reader.js +11 -0
  130. package/lib/runners/abstract.runner.d.ts +11 -0
  131. package/lib/runners/abstract.runner.js +47 -0
  132. package/lib/runners/git.runner.d.ts +4 -0
  133. package/lib/runners/git.runner.js +10 -0
  134. package/lib/runners/index.d.ts +3 -0
  135. package/lib/runners/index.js +19 -0
  136. package/lib/runners/npm.runner.d.ts +4 -0
  137. package/lib/runners/npm.runner.js +10 -0
  138. package/lib/runners/pnpm.runner.d.ts +4 -0
  139. package/lib/runners/pnpm.runner.js +10 -0
  140. package/lib/runners/runner.d.ts +6 -0
  141. package/lib/runners/runner.factory.d.ts +8 -0
  142. package/lib/runners/runner.factory.js +26 -0
  143. package/lib/runners/runner.js +10 -0
  144. package/lib/runners/schematic.runner.d.ts +6 -0
  145. package/lib/runners/schematic.runner.js +21 -0
  146. package/lib/runners/yarn.runner.d.ts +4 -0
  147. package/lib/runners/yarn.runner.js +10 -0
  148. package/lib/schematics/abstract.collection.d.ts +12 -0
  149. package/lib/schematics/abstract.collection.js +23 -0
  150. package/lib/schematics/collection.d.ts +3 -0
  151. package/lib/schematics/collection.factory.d.ts +5 -0
  152. package/lib/schematics/collection.factory.js +19 -0
  153. package/lib/schematics/collection.js +7 -0
  154. package/lib/schematics/custom.collection.d.ts +10 -0
  155. package/lib/schematics/custom.collection.js +33 -0
  156. package/lib/schematics/index.d.ts +4 -0
  157. package/lib/schematics/index.js +20 -0
  158. package/lib/schematics/nest.collection.d.ts +15 -0
  159. package/lib/schematics/nest.collection.js +126 -0
  160. package/lib/schematics/schematic.option.d.ts +8 -0
  161. package/lib/schematics/schematic.option.js +44 -0
  162. package/lib/ui/banner.d.ts +1 -0
  163. package/lib/ui/banner.js +12 -0
  164. package/lib/ui/emojis.d.ts +19 -0
  165. package/lib/ui/emojis.js +23 -0
  166. package/lib/ui/errors.d.ts +4 -0
  167. package/lib/ui/errors.js +8 -0
  168. package/lib/ui/index.d.ts +5 -0
  169. package/lib/ui/index.js +21 -0
  170. package/lib/ui/messages.d.ts +24 -0
  171. package/lib/ui/messages.js +32 -0
  172. package/lib/ui/prefixes.d.ts +2 -0
  173. package/lib/ui/prefixes.js +6 -0
  174. package/lib/utils/formatting.d.ts +8 -0
  175. package/lib/utils/formatting.js +18 -0
  176. package/lib/utils/get-default-tsconfig-path.d.ts +1 -0
  177. package/lib/utils/get-default-tsconfig-path.js +12 -0
  178. package/lib/utils/gracefully-exit-on-prompt-error.d.ts +1 -0
  179. package/lib/utils/gracefully-exit-on-prompt-error.js +11 -0
  180. package/lib/utils/is-module-available.d.ts +1 -0
  181. package/lib/utils/is-module-available.js +12 -0
  182. package/lib/utils/load-configuration.d.ts +2 -0
  183. package/lib/utils/load-configuration.js +9 -0
  184. package/lib/utils/local-binaries.d.ts +3 -0
  185. package/lib/utils/local-binaries.js +15 -0
  186. package/lib/utils/os-info.utils.d.ts +1 -0
  187. package/lib/utils/os-info.utils.js +23 -0
  188. package/lib/utils/project-utils.d.ts +11 -0
  189. package/lib/utils/project-utils.js +83 -0
  190. package/lib/utils/remaining-flags.d.ts +2 -0
  191. package/lib/utils/remaining-flags.js +36 -0
  192. package/lib/utils/tree-kill.d.ts +1 -0
  193. package/lib/utils/tree-kill.js +68 -0
  194. package/lib/utils/type-assertions.d.ts +1 -0
  195. package/lib/utils/type-assertions.js +8 -0
  196. package/package.json +161 -0
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { AbstractPackageManager } from './abstract.package-manager';
2
+ import { PackageManagerCommands } from './package-manager-commands';
3
+ export declare class YarnPackageManager extends AbstractPackageManager {
4
+ constructor();
5
+ get name(): string;
6
+ get cli(): PackageManagerCommands;
7
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.YarnPackageManager = void 0;
4
+ const runners_1 = require("../runners");
5
+ const abstract_package_manager_1 = require("./abstract.package-manager");
6
+ const package_manager_1 = require("./package-manager");
7
+ class YarnPackageManager extends abstract_package_manager_1.AbstractPackageManager {
8
+ constructor() {
9
+ super(runners_1.RunnerFactory.create(runners_1.Runner.YARN));
10
+ }
11
+ get name() {
12
+ return package_manager_1.PackageManager.YARN.toUpperCase();
13
+ }
14
+ get cli() {
15
+ return {
16
+ install: 'install',
17
+ add: 'add',
18
+ update: 'upgrade',
19
+ remove: 'remove',
20
+ saveFlag: '',
21
+ saveDevFlag: '-D',
22
+ silentFlag: '--silent',
23
+ };
24
+ }
25
+ }
26
+ exports.YarnPackageManager = YarnPackageManager;
@@ -0,0 +1,9 @@
1
+ export declare const generateInput: (name: string, message: string) => (defaultAnswer: string) => any;
2
+ export declare const generateSelect: (name: string) => (message: string) => (choices: string[]) => {
3
+ name: string;
4
+ message: string;
5
+ choices: {
6
+ name: string;
7
+ value: string;
8
+ }[];
9
+ };
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateSelect = exports.generateInput = void 0;
4
+ const generateInput = (name, message) => {
5
+ return (defaultAnswer) => ({
6
+ name,
7
+ message,
8
+ default: defaultAnswer,
9
+ });
10
+ };
11
+ exports.generateInput = generateInput;
12
+ const generateSelect = (name) => {
13
+ return (message) => {
14
+ return (choices) => {
15
+ const choicesFormatted = choices.map((choice) => ({
16
+ name: choice,
17
+ value: choice,
18
+ }));
19
+ return {
20
+ name,
21
+ message,
22
+ choices: choicesFormatted,
23
+ };
24
+ };
25
+ };
26
+ };
27
+ exports.generateSelect = generateSelect;
@@ -0,0 +1,8 @@
1
+ import { Reader, ReaderFileLackPermissionsError } from './reader';
2
+ export declare class FileSystemReader implements Reader {
3
+ private readonly directory;
4
+ constructor(directory: string);
5
+ list(): string[];
6
+ read(name: string): string;
7
+ readAnyOf(filenames: string[]): string | undefined | ReaderFileLackPermissionsError;
8
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileSystemReader = void 0;
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+ const reader_1 = require("./reader");
7
+ class FileSystemReader {
8
+ constructor(directory) {
9
+ this.directory = directory;
10
+ }
11
+ list() {
12
+ return fs.readdirSync(this.directory);
13
+ }
14
+ read(name) {
15
+ return fs.readFileSync(path.join(this.directory, name), 'utf8');
16
+ }
17
+ readAnyOf(filenames) {
18
+ let firstFilePathFoundButWithInsufficientPermissions;
19
+ for (let id = 0; id < filenames.length; id++) {
20
+ const file = filenames[id];
21
+ try {
22
+ return this.read(file);
23
+ }
24
+ catch (readErr) {
25
+ if (!firstFilePathFoundButWithInsufficientPermissions &&
26
+ typeof readErr?.code === 'string') {
27
+ const isInsufficientPermissionsError = readErr.code === 'EACCES' || readErr.code === 'EPERM';
28
+ if (isInsufficientPermissionsError) {
29
+ firstFilePathFoundButWithInsufficientPermissions = readErr.path;
30
+ }
31
+ }
32
+ const isLastFileToLookFor = id === filenames.length - 1;
33
+ if (!isLastFileToLookFor) {
34
+ continue;
35
+ }
36
+ if (firstFilePathFoundButWithInsufficientPermissions) {
37
+ return new reader_1.ReaderFileLackPermissionsError(firstFilePathFoundButWithInsufficientPermissions, readErr.code);
38
+ }
39
+ else {
40
+ return undefined;
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ exports.FileSystemReader = FileSystemReader;
@@ -0,0 +1,2 @@
1
+ export * from './reader';
2
+ export * from './file-system.reader';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./reader"), exports);
18
+ __exportStar(require("./file-system.reader"), exports);
@@ -0,0 +1,10 @@
1
+ export declare class ReaderFileLackPermissionsError extends Error {
2
+ readonly filePath: string;
3
+ readonly fsErrorCode: string;
4
+ constructor(filePath: string, fsErrorCode: string);
5
+ }
6
+ export interface Reader {
7
+ list(): string[];
8
+ read(name: string): string;
9
+ readAnyOf(filenames: string[]): string | undefined | ReaderFileLackPermissionsError;
10
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReaderFileLackPermissionsError = void 0;
4
+ class ReaderFileLackPermissionsError extends Error {
5
+ constructor(filePath, fsErrorCode) {
6
+ super(`File ${filePath} lacks read permissions!`);
7
+ this.filePath = filePath;
8
+ this.fsErrorCode = fsErrorCode;
9
+ }
10
+ }
11
+ exports.ReaderFileLackPermissionsError = ReaderFileLackPermissionsError;
@@ -0,0 +1,11 @@
1
+ export declare class AbstractRunner {
2
+ protected binary: string;
3
+ protected args: string[];
4
+ constructor(binary: string, args?: string[]);
5
+ run(command: string, collect?: boolean, cwd?: string): Promise<null | string>;
6
+ /**
7
+ * @param command
8
+ * @returns The entire command that will be ran when calling `run(command)`.
9
+ */
10
+ rawFullCommand(command: string): string;
11
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbstractRunner = void 0;
4
+ const ansis_1 = require("ansis");
5
+ const child_process_1 = require("child_process");
6
+ const os_1 = require("os");
7
+ const ui_1 = require("../ui");
8
+ class AbstractRunner {
9
+ constructor(binary, args = []) {
10
+ this.binary = binary;
11
+ this.args = args;
12
+ }
13
+ async run(command, collect = false, cwd = process.cwd()) {
14
+ const args = [command];
15
+ const isWindows = (0, os_1.platform)() === 'win32';
16
+ const options = {
17
+ cwd,
18
+ stdio: collect ? 'pipe' : 'inherit',
19
+ shell: true,
20
+ };
21
+ return new Promise((resolve, reject) => {
22
+ const command = [this.binary, ...this.args, ...args].join(' ');
23
+ const child = (0, child_process_1.spawn)(command, options);
24
+ if (collect) {
25
+ child.stdout.on('data', (data) => resolve(data.toString().replace(/\r\n|\n/, '')));
26
+ }
27
+ child.on('close', (code) => {
28
+ if (code === 0) {
29
+ resolve(null);
30
+ }
31
+ else {
32
+ console.error((0, ansis_1.red)(ui_1.MESSAGES.RUNNER_EXECUTION_ERROR(`${this.binary} ${command}`)));
33
+ reject();
34
+ }
35
+ });
36
+ });
37
+ }
38
+ /**
39
+ * @param command
40
+ * @returns The entire command that will be ran when calling `run(command)`.
41
+ */
42
+ rawFullCommand(command) {
43
+ const commandArgs = [...this.args, command];
44
+ return `${this.binary} ${commandArgs.join(' ')}`;
45
+ }
46
+ }
47
+ exports.AbstractRunner = AbstractRunner;
@@ -0,0 +1,4 @@
1
+ import { AbstractRunner } from './abstract.runner';
2
+ export declare class GitRunner extends AbstractRunner {
3
+ constructor();
4
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GitRunner = void 0;
4
+ const abstract_runner_1 = require("./abstract.runner");
5
+ class GitRunner extends abstract_runner_1.AbstractRunner {
6
+ constructor() {
7
+ super('git');
8
+ }
9
+ }
10
+ exports.GitRunner = GitRunner;
@@ -0,0 +1,3 @@
1
+ export * from './runner';
2
+ export * from './runner.factory';
3
+ export * from './abstract.runner';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./runner"), exports);
18
+ __exportStar(require("./runner.factory"), exports);
19
+ __exportStar(require("./abstract.runner"), exports);
@@ -0,0 +1,4 @@
1
+ import { AbstractRunner } from './abstract.runner';
2
+ export declare class NpmRunner extends AbstractRunner {
3
+ constructor();
4
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NpmRunner = void 0;
4
+ const abstract_runner_1 = require("./abstract.runner");
5
+ class NpmRunner extends abstract_runner_1.AbstractRunner {
6
+ constructor() {
7
+ super('npm');
8
+ }
9
+ }
10
+ exports.NpmRunner = NpmRunner;
@@ -0,0 +1,4 @@
1
+ import { AbstractRunner } from './abstract.runner';
2
+ export declare class PnpmRunner extends AbstractRunner {
3
+ constructor();
4
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PnpmRunner = void 0;
4
+ const abstract_runner_1 = require("./abstract.runner");
5
+ class PnpmRunner extends abstract_runner_1.AbstractRunner {
6
+ constructor() {
7
+ super('pnpm');
8
+ }
9
+ }
10
+ exports.PnpmRunner = PnpmRunner;
@@ -0,0 +1,6 @@
1
+ export declare enum Runner {
2
+ SCHEMATIC = 0,
3
+ NPM = 1,
4
+ YARN = 2,
5
+ PNPM = 3
6
+ }
@@ -0,0 +1,8 @@
1
+ import { NpmRunner } from './npm.runner';
2
+ import { Runner } from './runner';
3
+ import { SchematicRunner } from './schematic.runner';
4
+ import { YarnRunner } from './yarn.runner';
5
+ import { PnpmRunner } from './pnpm.runner';
6
+ export declare class RunnerFactory {
7
+ static create(runner: Runner): NpmRunner | SchematicRunner | YarnRunner | PnpmRunner | undefined;
8
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RunnerFactory = void 0;
4
+ const ansis_1 = require("ansis");
5
+ const npm_runner_1 = require("./npm.runner");
6
+ const runner_1 = require("./runner");
7
+ const schematic_runner_1 = require("./schematic.runner");
8
+ const yarn_runner_1 = require("./yarn.runner");
9
+ const pnpm_runner_1 = require("./pnpm.runner");
10
+ class RunnerFactory {
11
+ static create(runner) {
12
+ switch (runner) {
13
+ case runner_1.Runner.SCHEMATIC:
14
+ return new schematic_runner_1.SchematicRunner();
15
+ case runner_1.Runner.NPM:
16
+ return new npm_runner_1.NpmRunner();
17
+ case runner_1.Runner.YARN:
18
+ return new yarn_runner_1.YarnRunner();
19
+ case runner_1.Runner.PNPM:
20
+ return new pnpm_runner_1.PnpmRunner();
21
+ default:
22
+ console.info((0, ansis_1.yellow) `[WARN] Unsupported runner: ${runner}`);
23
+ }
24
+ }
25
+ }
26
+ exports.RunnerFactory = RunnerFactory;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Runner = void 0;
4
+ var Runner;
5
+ (function (Runner) {
6
+ Runner[Runner["SCHEMATIC"] = 0] = "SCHEMATIC";
7
+ Runner[Runner["NPM"] = 1] = "NPM";
8
+ Runner[Runner["YARN"] = 2] = "YARN";
9
+ Runner[Runner["PNPM"] = 3] = "PNPM";
10
+ })(Runner || (exports.Runner = Runner = {}));
@@ -0,0 +1,6 @@
1
+ import { AbstractRunner } from './abstract.runner';
2
+ export declare class SchematicRunner extends AbstractRunner {
3
+ constructor();
4
+ static getModulePaths(): string[];
5
+ static findClosestSchematicsBinary(): string;
6
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SchematicRunner = void 0;
4
+ const abstract_runner_1 = require("./abstract.runner");
5
+ class SchematicRunner extends abstract_runner_1.AbstractRunner {
6
+ constructor() {
7
+ super(`node`, [`"${SchematicRunner.findClosestSchematicsBinary()}"`]);
8
+ }
9
+ static getModulePaths() {
10
+ return module.paths;
11
+ }
12
+ static findClosestSchematicsBinary() {
13
+ try {
14
+ return require.resolve('@angular-devkit/schematics-cli/bin/schematics.js', { paths: this.getModulePaths() });
15
+ }
16
+ catch {
17
+ throw new Error("'schematics' binary path could not be found!");
18
+ }
19
+ }
20
+ }
21
+ exports.SchematicRunner = SchematicRunner;
@@ -0,0 +1,4 @@
1
+ import { AbstractRunner } from './abstract.runner';
2
+ export declare class YarnRunner extends AbstractRunner {
3
+ constructor();
4
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.YarnRunner = void 0;
4
+ const abstract_runner_1 = require("./abstract.runner");
5
+ class YarnRunner extends abstract_runner_1.AbstractRunner {
6
+ constructor() {
7
+ super('yarn');
8
+ }
9
+ }
10
+ exports.YarnRunner = YarnRunner;
@@ -0,0 +1,12 @@
1
+ import { AbstractRunner } from '../runners';
2
+ import { Schematic } from './nest.collection';
3
+ import { SchematicOption } from './schematic.option';
4
+ export declare abstract class AbstractCollection {
5
+ protected collection: string;
6
+ protected runner: AbstractRunner;
7
+ constructor(collection: string, runner: AbstractRunner);
8
+ execute(name: string, options: SchematicOption[], extraFlags?: string): Promise<void>;
9
+ abstract getSchematics(): Schematic[];
10
+ private buildCommandLine;
11
+ private buildOptions;
12
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbstractCollection = void 0;
4
+ class AbstractCollection {
5
+ constructor(collection, runner) {
6
+ this.collection = collection;
7
+ this.runner = runner;
8
+ }
9
+ async execute(name, options, extraFlags) {
10
+ let command = this.buildCommandLine(name, options);
11
+ command = extraFlags ? command.concat(` ${extraFlags}`) : command;
12
+ await this.runner.run(command);
13
+ }
14
+ buildCommandLine(name, options) {
15
+ return `${this.collection}:${name}${this.buildOptions(options)}`;
16
+ }
17
+ buildOptions(options) {
18
+ return options.reduce((line, option) => {
19
+ return line.concat(` ${option.toCommandString()}`);
20
+ }, '');
21
+ }
22
+ }
23
+ exports.AbstractCollection = AbstractCollection;
@@ -0,0 +1,3 @@
1
+ export declare enum Collection {
2
+ NESTJS = "@nestjs/schematics"
3
+ }
@@ -0,0 +1,5 @@
1
+ import { AbstractCollection } from './abstract.collection';
2
+ import { Collection } from './collection';
3
+ export declare class CollectionFactory {
4
+ static create(collection: Collection | string): AbstractCollection;
5
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CollectionFactory = void 0;
4
+ const runners_1 = require("../runners");
5
+ const collection_1 = require("./collection");
6
+ const custom_collection_1 = require("./custom.collection");
7
+ const nest_collection_1 = require("./nest.collection");
8
+ class CollectionFactory {
9
+ static create(collection) {
10
+ const schematicRunner = runners_1.RunnerFactory.create(runners_1.Runner.SCHEMATIC);
11
+ if (collection === collection_1.Collection.NESTJS) {
12
+ return new nest_collection_1.NestCollection(schematicRunner);
13
+ }
14
+ else {
15
+ return new custom_collection_1.CustomCollection(collection, schematicRunner);
16
+ }
17
+ }
18
+ }
19
+ exports.CollectionFactory = CollectionFactory;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Collection = void 0;
4
+ var Collection;
5
+ (function (Collection) {
6
+ Collection["NESTJS"] = "@nestjs/schematics";
7
+ })(Collection || (exports.Collection = Collection = {}));
@@ -0,0 +1,10 @@
1
+ import { AbstractCollection } from './abstract.collection';
2
+ import { Schematic } from './nest.collection';
3
+ export interface CollectionSchematic {
4
+ schema: string;
5
+ description: string;
6
+ aliases: string[];
7
+ }
8
+ export declare class CustomCollection extends AbstractCollection {
9
+ getSchematics(): Schematic[];
10
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomCollection = void 0;
4
+ const tools_1 = require("@angular-devkit/schematics/tools");
5
+ const abstract_collection_1 = require("./abstract.collection");
6
+ class CustomCollection extends abstract_collection_1.AbstractCollection {
7
+ getSchematics() {
8
+ const workflow = new tools_1.NodeWorkflow(process.cwd(), {});
9
+ const collection = workflow.engine.createCollection(this.collection);
10
+ const collectionDescriptions = [
11
+ collection.description,
12
+ ...(collection.baseDescriptions ?? []),
13
+ ];
14
+ const usedNames = new Set();
15
+ const schematics = [];
16
+ for (const collectionDesc of collectionDescriptions) {
17
+ const schematicsDescs = Object.entries(collectionDesc.schematics);
18
+ for (const [name, { description, aliases = [] }] of schematicsDescs) {
19
+ if (usedNames.has(name)) {
20
+ continue;
21
+ }
22
+ usedNames.add(name);
23
+ const alias = aliases.find((a) => !usedNames.has(a)) ?? name;
24
+ for (const alias of aliases) {
25
+ usedNames.add(alias);
26
+ }
27
+ schematics.push({ name, alias, description });
28
+ }
29
+ }
30
+ return schematics.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
31
+ }
32
+ }
33
+ exports.CustomCollection = CustomCollection;
@@ -0,0 +1,4 @@
1
+ export * from './collection';
2
+ export * from './collection.factory';
3
+ export * from './schematic.option';
4
+ export * from './abstract.collection';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./collection"), exports);
18
+ __exportStar(require("./collection.factory"), exports);
19
+ __exportStar(require("./schematic.option"), exports);
20
+ __exportStar(require("./abstract.collection"), exports);
@@ -0,0 +1,15 @@
1
+ import { AbstractRunner } from '../runners';
2
+ import { AbstractCollection } from './abstract.collection';
3
+ import { SchematicOption } from './schematic.option';
4
+ export interface Schematic {
5
+ name: string;
6
+ alias: string;
7
+ description: string;
8
+ }
9
+ export declare class NestCollection extends AbstractCollection {
10
+ private static schematics;
11
+ constructor(runner: AbstractRunner);
12
+ execute(name: string, options: SchematicOption[]): Promise<void>;
13
+ getSchematics(): Schematic[];
14
+ private validate;
15
+ }