@gadmin2n/cli 0.0.73

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 (182) hide show
  1. package/.circleci/config.yml +62 -0
  2. package/.claude/settings.local.json +7 -0
  3. package/.github/ISSUE_TEMPLATE/Bug_report.yml +106 -0
  4. package/.github/ISSUE_TEMPLATE/Feature_request.yml +52 -0
  5. package/.github/ISSUE_TEMPLATE/Regression.yml +78 -0
  6. package/.github/ISSUE_TEMPLATE/config.yml +7 -0
  7. package/.github/PULL_REQUEST_TEMPLATE.md +41 -0
  8. package/LICENSE +24 -0
  9. package/README.md +56 -0
  10. package/actions/abstract.action.d.ts +4 -0
  11. package/actions/abstract.action.js +6 -0
  12. package/actions/add.action.d.ts +12 -0
  13. package/actions/add.action.js +129 -0
  14. package/actions/build.action.d.ts +27 -0
  15. package/actions/build.action.js +108 -0
  16. package/actions/generate.action.d.ts +5 -0
  17. package/actions/generate.action.js +95 -0
  18. package/actions/index.d.ts +8 -0
  19. package/actions/index.js +24 -0
  20. package/actions/info.action.d.ts +28 -0
  21. package/actions/info.action.js +129 -0
  22. package/actions/new.action.d.ts +7 -0
  23. package/actions/new.action.js +294 -0
  24. package/actions/prisma.action.d.ts +5 -0
  25. package/actions/prisma.action.js +153 -0
  26. package/actions/start.action.d.ts +9 -0
  27. package/actions/start.action.js +115 -0
  28. package/actions/update.action.d.ts +5 -0
  29. package/actions/update.action.js +26 -0
  30. package/bin/gadmin.d.ts +2 -0
  31. package/bin/gadmin.js +25 -0
  32. package/commands/abstract.command.d.ts +7 -0
  33. package/commands/abstract.command.js +9 -0
  34. package/commands/add.command.d.ts +5 -0
  35. package/commands/add.command.js +43 -0
  36. package/commands/build.command.d.ts +5 -0
  37. package/commands/build.command.js +50 -0
  38. package/commands/command.input.d.ts +25 -0
  39. package/commands/command.input.js +28 -0
  40. package/commands/command.loader.d.ts +5 -0
  41. package/commands/command.loader.js +33 -0
  42. package/commands/generate.command.d.ts +7 -0
  43. package/commands/generate.command.js +105 -0
  44. package/commands/index.d.ts +2 -0
  45. package/commands/index.js +18 -0
  46. package/commands/info.command.d.ts +5 -0
  47. package/commands/info.command.js +25 -0
  48. package/commands/new.command.d.ts +5 -0
  49. package/commands/new.command.js +52 -0
  50. package/commands/start.command.d.ts +5 -0
  51. package/commands/start.command.js +64 -0
  52. package/commands/update.command.d.ts +5 -0
  53. package/commands/update.command.js +30 -0
  54. package/lib/compiler/assets-manager.d.ts +15 -0
  55. package/lib/compiler/assets-manager.js +103 -0
  56. package/lib/compiler/compiler.d.ts +12 -0
  57. package/lib/compiler/compiler.js +60 -0
  58. package/lib/compiler/defaults/webpack-defaults.d.ts +3 -0
  59. package/lib/compiler/defaults/webpack-defaults.js +95 -0
  60. package/lib/compiler/helpers/append-extension.d.ts +1 -0
  61. package/lib/compiler/helpers/append-extension.js +8 -0
  62. package/lib/compiler/helpers/copy-path-resolve.d.ts +7 -0
  63. package/lib/compiler/helpers/copy-path-resolve.js +26 -0
  64. package/lib/compiler/helpers/get-value-or-default.d.ts +4 -0
  65. package/lib/compiler/helpers/get-value-or-default.js +67 -0
  66. package/lib/compiler/helpers/tsconfig-provider.d.ts +11 -0
  67. package/lib/compiler/helpers/tsconfig-provider.js +22 -0
  68. package/lib/compiler/hooks/tsconfig-paths.hook.d.ts +2 -0
  69. package/lib/compiler/hooks/tsconfig-paths.hook.js +70 -0
  70. package/lib/compiler/plugins-loader.d.ts +21 -0
  71. package/lib/compiler/plugins-loader.js +54 -0
  72. package/lib/compiler/typescript-loader.d.ts +6 -0
  73. package/lib/compiler/typescript-loader.js +31 -0
  74. package/lib/compiler/watch-compiler.d.ts +14 -0
  75. package/lib/compiler/watch-compiler.js +70 -0
  76. package/lib/compiler/webpack-compiler.d.ts +9 -0
  77. package/lib/compiler/webpack-compiler.js +74 -0
  78. package/lib/compiler/workspace-utils.d.ts +4 -0
  79. package/lib/compiler/workspace-utils.js +26 -0
  80. package/lib/configuration/configuration.d.ts +52 -0
  81. package/lib/configuration/configuration.js +2 -0
  82. package/lib/configuration/configuration.loader.d.ts +4 -0
  83. package/lib/configuration/configuration.loader.js +2 -0
  84. package/lib/configuration/defaults.d.ts +4 -0
  85. package/lib/configuration/defaults.js +56 -0
  86. package/lib/configuration/gadmin-configuration.loader.d.ts +8 -0
  87. package/lib/configuration/gadmin-configuration.loader.js +39 -0
  88. package/lib/configuration/index.d.ts +3 -0
  89. package/lib/configuration/index.js +19 -0
  90. package/lib/dependency-managers/index.d.ts +1 -0
  91. package/lib/dependency-managers/index.js +17 -0
  92. package/lib/dependency-managers/nest.dependency-manager.d.ts +7 -0
  93. package/lib/dependency-managers/nest.dependency-manager.js +48 -0
  94. package/lib/package-managers/abstract.package-manager.d.ts +25 -0
  95. package/lib/package-managers/abstract.package-manager.js +185 -0
  96. package/lib/package-managers/index.d.ts +8 -0
  97. package/lib/package-managers/index.js +24 -0
  98. package/lib/package-managers/npm.package-manager.d.ts +7 -0
  99. package/lib/package-managers/npm.package-manager.js +26 -0
  100. package/lib/package-managers/package-manager-commands.d.ts +9 -0
  101. package/lib/package-managers/package-manager-commands.js +2 -0
  102. package/lib/package-managers/package-manager.d.ts +5 -0
  103. package/lib/package-managers/package-manager.factory.d.ts +6 -0
  104. package/lib/package-managers/package-manager.factory.js +54 -0
  105. package/lib/package-managers/package-manager.js +9 -0
  106. package/lib/package-managers/pnpm.package-manager.d.ts +7 -0
  107. package/lib/package-managers/pnpm.package-manager.js +27 -0
  108. package/lib/package-managers/project.dependency.d.ts +4 -0
  109. package/lib/package-managers/project.dependency.js +2 -0
  110. package/lib/package-managers/yarn.package-manager.d.ts +7 -0
  111. package/lib/package-managers/yarn.package-manager.js +26 -0
  112. package/lib/questions/questions.d.ts +2 -0
  113. package/lib/questions/questions.js +23 -0
  114. package/lib/readers/file-system.reader.d.ts +8 -0
  115. package/lib/readers/file-system.reader.js +61 -0
  116. package/lib/readers/index.d.ts +2 -0
  117. package/lib/readers/index.js +18 -0
  118. package/lib/readers/reader.d.ts +5 -0
  119. package/lib/readers/reader.js +2 -0
  120. package/lib/runners/abstract.runner.d.ts +11 -0
  121. package/lib/runners/abstract.runner.js +55 -0
  122. package/lib/runners/git.runner.d.ts +4 -0
  123. package/lib/runners/git.runner.js +10 -0
  124. package/lib/runners/index.d.ts +3 -0
  125. package/lib/runners/index.js +19 -0
  126. package/lib/runners/npm.runner.d.ts +4 -0
  127. package/lib/runners/npm.runner.js +10 -0
  128. package/lib/runners/pnpm.runner.d.ts +4 -0
  129. package/lib/runners/pnpm.runner.js +10 -0
  130. package/lib/runners/runner.d.ts +6 -0
  131. package/lib/runners/runner.factory.d.ts +8 -0
  132. package/lib/runners/runner.factory.js +26 -0
  133. package/lib/runners/runner.js +10 -0
  134. package/lib/runners/schematic.runner.d.ts +6 -0
  135. package/lib/runners/schematic.runner.js +21 -0
  136. package/lib/runners/yarn.runner.d.ts +4 -0
  137. package/lib/runners/yarn.runner.js +10 -0
  138. package/lib/schematics/abstract.collection.d.ts +10 -0
  139. package/lib/schematics/abstract.collection.js +34 -0
  140. package/lib/schematics/collection.d.ts +3 -0
  141. package/lib/schematics/collection.factory.d.ts +5 -0
  142. package/lib/schematics/collection.factory.js +18 -0
  143. package/lib/schematics/collection.js +7 -0
  144. package/lib/schematics/custom.collection.d.ts +3 -0
  145. package/lib/schematics/custom.collection.js +7 -0
  146. package/lib/schematics/gadmin.collection.d.ts +16 -0
  147. package/lib/schematics/gadmin.collection.js +142 -0
  148. package/lib/schematics/index.d.ts +4 -0
  149. package/lib/schematics/index.js +20 -0
  150. package/lib/schematics/schematic.option.d.ts +8 -0
  151. package/lib/schematics/schematic.option.js +44 -0
  152. package/lib/ui/banner.d.ts +1 -0
  153. package/lib/ui/banner.js +11 -0
  154. package/lib/ui/emojis.d.ts +19 -0
  155. package/lib/ui/emojis.js +23 -0
  156. package/lib/ui/errors.d.ts +4 -0
  157. package/lib/ui/errors.js +8 -0
  158. package/lib/ui/index.d.ts +5 -0
  159. package/lib/ui/index.js +21 -0
  160. package/lib/ui/messages.d.ts +26 -0
  161. package/lib/ui/messages.js +34 -0
  162. package/lib/ui/prefixes.d.ts +2 -0
  163. package/lib/ui/prefixes.js +6 -0
  164. package/lib/utils/formatting.d.ts +8 -0
  165. package/lib/utils/formatting.js +19 -0
  166. package/lib/utils/is-error.d.ts +1 -0
  167. package/lib/utils/is-error.js +11 -0
  168. package/lib/utils/load-configuration.d.ts +2 -0
  169. package/lib/utils/load-configuration.js +21 -0
  170. package/lib/utils/local-binaries.d.ts +3 -0
  171. package/lib/utils/local-binaries.js +16 -0
  172. package/lib/utils/project-utils.d.ts +8 -0
  173. package/lib/utils/project-utils.js +69 -0
  174. package/lib/utils/remaining-flags.d.ts +2 -0
  175. package/lib/utils/remaining-flags.js +37 -0
  176. package/lib/utils/tree-kill.d.ts +1 -0
  177. package/lib/utils/tree-kill.js +66 -0
  178. package/package.json +105 -0
  179. package/test/lib/compiler/hooks/__snapshots__/tsconfig-paths.hook.spec.ts.snap +68 -0
  180. package/test/lib/compiler/hooks/fixtures/aliased-imports/src/bar.tsx +1 -0
  181. package/test/lib/compiler/hooks/fixtures/aliased-imports/src/baz.js +1 -0
  182. package/test/lib/compiler/hooks/fixtures/aliased-imports/src/qux.jsx +1 -0
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MESSAGES = void 0;
4
+ const chalk = require("chalk");
5
+ const emojis_1 = require("./emojis");
6
+ exports.MESSAGES = {
7
+ PROJECT_SELECTION_QUESTION: 'Which project would you like to generate to?',
8
+ LIBRARY_PROJECT_SELECTION_QUESTION: 'Which project would you like to add the library to?',
9
+ DRY_RUN_MODE: 'Command has been executed in dry run mode, nothing changed!',
10
+ PROJECT_INFORMATION_START: `${emojis_1.EMOJIS.ZAP} We will scaffold your app in a few seconds..`,
11
+ RUNNER_EXECUTION_ERROR: (command) => `\nFailed to execute command: ${command}`,
12
+ PACKAGE_MANAGER_QUESTION: `Which package manager would you ${emojis_1.EMOJIS.HEART} to use?`,
13
+ PACKAGE_MANAGER_INSTALLATION_IN_PROGRESS: `Installation in progress... ${emojis_1.EMOJIS.COFFEE}`,
14
+ PACKAGE_MANAGER_UPDATE_IN_PROGRESS: `Installation in progress... ${emojis_1.EMOJIS.COFFEE}`,
15
+ PACKAGE_MANAGER_UPGRADE_IN_PROGRESS: `Installation in progress... ${emojis_1.EMOJIS.COFFEE}`,
16
+ PACKAGE_MANAGER_PRODUCTION_INSTALLATION_IN_PROGRESS: `Package installation in progress... ${emojis_1.EMOJIS.COFFEE}`,
17
+ GIT_INITIALIZATION_ERROR: 'Git repository has not been initialized',
18
+ PACKAGE_MANAGER_INSTALLATION_SUCCEED: (name) => name !== '.'
19
+ ? `${emojis_1.EMOJIS.ROCKET} Successfully created project ${chalk.green(name)}`
20
+ : `${emojis_1.EMOJIS.ROCKET} Successfully created a new project`,
21
+ GET_STARTED_INFORMATION: `${emojis_1.EMOJIS.POINT_RIGHT} Get started with the following commands:`,
22
+ CHANGE_DIR_COMMAND: (name) => `$ cd ${name}\n`,
23
+ PACKAGE_MANAGER_INSTALLATION_FAILED: (commandToRunManually) => `${emojis_1.EMOJIS.SCREAM} Packages installation failed!\nIn case you don't see any errors above, consider manually running the failed command ${commandToRunManually} to see more details on why it errored out.`,
24
+ // tslint:disable-next-line:max-line-length
25
+ GADMIN_INFORMATION_PACKAGE_MANAGER_FAILED: `${emojis_1.EMOJIS.SMIRK} cannot read your project package.json file, are you inside your project directory?`,
26
+ LIBRARY_INSTALLATION_FAILED_BAD_PACKAGE: (name) => `Unable to install library ${name} because package did not install. Please check package name.`,
27
+ LIBRARY_INSTALLATION_FAILED_NO_LIBRARY: 'No library found.',
28
+ LIBRARY_INSTALLATION_STARTS: 'Starting library setup...',
29
+ TEMPLATE_QUESTION: 'Which template would you like to use?',
30
+ WITH_WEB_QUESTION: 'Need generate frontend web pages?',
31
+ TRANSFER_PROTOCOL_QUESTION: 'Transfer protocol to use (Restful or GraphQL)?',
32
+ SERVER_FRAMEWORK_QUESTION: 'Server framework to use (Nest or Iris)?',
33
+ UI_FRAMEWORK_QUESTION: 'UI framework to use (Antd or Tea)?',
34
+ };
@@ -0,0 +1,2 @@
1
+ export declare const ERROR_PREFIX: string;
2
+ export declare const INFO_PREFIX: string;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.INFO_PREFIX = exports.ERROR_PREFIX = void 0;
4
+ const chalk = require("chalk");
5
+ exports.ERROR_PREFIX = chalk.bgRgb(210, 0, 75).bold.rgb(0, 0, 0)(' Error ');
6
+ exports.INFO_PREFIX = chalk.bgRgb(60, 190, 100).bold.rgb(0, 0, 0)(' Info ');
@@ -0,0 +1,8 @@
1
+ /**
2
+ *
3
+ * @param str
4
+ * @returns formated string
5
+ * @description normalizes input to supported path and file name format.
6
+ * Changes camelCase strings to kebab-case, replaces spaces with dash and keeps underscores.
7
+ */
8
+ export declare function normalizeToKebabOrSnakeCase(str: string): string;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeToKebabOrSnakeCase = void 0;
4
+ /**
5
+ *
6
+ * @param str
7
+ * @returns formated string
8
+ * @description normalizes input to supported path and file name format.
9
+ * Changes camelCase strings to kebab-case, replaces spaces with dash and keeps underscores.
10
+ */
11
+ function normalizeToKebabOrSnakeCase(str) {
12
+ const STRING_DASHERIZE_REGEXP = /\s/g;
13
+ const STRING_DECAMELIZE_REGEXP = /([a-z\d])([A-Z])/g;
14
+ return str
15
+ .replace(STRING_DECAMELIZE_REGEXP, '$1-$2')
16
+ .toLowerCase()
17
+ .replace(STRING_DASHERIZE_REGEXP, '-');
18
+ }
19
+ exports.normalizeToKebabOrSnakeCase = normalizeToKebabOrSnakeCase;
@@ -0,0 +1 @@
1
+ export declare function isError(e: Record<string, any> | undefined): any;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isError = void 0;
4
+ function isError(e) {
5
+ return (e &&
6
+ e.stack &&
7
+ e.message &&
8
+ typeof e.stack === 'string' &&
9
+ typeof e.message === 'string');
10
+ }
11
+ exports.isError = isError;
@@ -0,0 +1,2 @@
1
+ import { Configuration } from '../configuration';
2
+ export declare function loadConfiguration(): Promise<Required<Configuration>>;
@@ -0,0 +1,21 @@
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.loadConfiguration = void 0;
13
+ const gadmin_configuration_loader_1 = require("../configuration/gadmin-configuration.loader");
14
+ const readers_1 = require("../readers");
15
+ function loadConfiguration() {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ const loader = new gadmin_configuration_loader_1.GadminConfigurationLoader(new readers_1.FileSystemReader(process.cwd()));
18
+ return loader.load();
19
+ });
20
+ }
21
+ exports.loadConfiguration = loadConfiguration;
@@ -0,0 +1,3 @@
1
+ import { CommandLoader } from '../../commands';
2
+ export declare function localBinExists(): boolean;
3
+ export declare function loadLocalBinCommandLoader(): typeof CommandLoader;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadLocalBinCommandLoader = exports.localBinExists = void 0;
4
+ const fs_1 = require("fs");
5
+ const path_1 = require("path");
6
+ const localBinPathSegments = [process.cwd(), 'node_modules', '@gadmin', 'cli'];
7
+ function localBinExists() {
8
+ return (0, fs_1.existsSync)((0, path_1.join)(...localBinPathSegments));
9
+ }
10
+ exports.localBinExists = localBinExists;
11
+ function loadLocalBinCommandLoader() {
12
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
13
+ const commandsFile = require(path_1.posix.join(...localBinPathSegments, 'commands'));
14
+ return commandsFile.CommandLoader;
15
+ }
16
+ exports.loadLocalBinCommandLoader = loadLocalBinCommandLoader;
@@ -0,0 +1,8 @@
1
+ import { Answers } from 'inquirer';
2
+ import { Configuration, ProjectConfiguration } from '../configuration';
3
+ export declare function shouldAskForProject(schematic: string, configurationProjects: {
4
+ [key: string]: ProjectConfiguration;
5
+ }, appName: string): boolean;
6
+ export declare function shouldGenerateSpec(configuration: Required<Configuration>, schematic: string, appName: string, specValue: boolean, specPassedAsInput?: boolean): any;
7
+ export declare function askForProjectName(promptQuestion: string, projects: string[]): Promise<Answers>;
8
+ export declare function moveDefaultProjectToStart(configuration: Configuration, defaultProjectName: string, defaultLabel: string): string[];
@@ -0,0 +1,69 @@
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.moveDefaultProjectToStart = exports.askForProjectName = exports.shouldGenerateSpec = exports.shouldAskForProject = void 0;
13
+ const inquirer = require("inquirer");
14
+ const get_value_or_default_1 = require("../compiler/helpers/get-value-or-default");
15
+ const questions_1 = require("../questions/questions");
16
+ function shouldAskForProject(schematic, configurationProjects, appName) {
17
+ return (['app', 'sub-app', 'library', 'lib'].includes(schematic) === false &&
18
+ configurationProjects &&
19
+ Object.entries(configurationProjects).length !== 0 &&
20
+ !appName);
21
+ }
22
+ exports.shouldAskForProject = shouldAskForProject;
23
+ function shouldGenerateSpec(configuration, schematic, appName, specValue, specPassedAsInput) {
24
+ if (specPassedAsInput === true || specPassedAsInput === undefined) {
25
+ // CLI parameters has the highest priority
26
+ return specValue;
27
+ }
28
+ let specConfiguration = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'generateOptions.spec', appName || '');
29
+ if (typeof specConfiguration === 'boolean') {
30
+ return specConfiguration;
31
+ }
32
+ if (typeof specConfiguration === 'object' &&
33
+ specConfiguration[schematic] !== undefined) {
34
+ return specConfiguration[schematic];
35
+ }
36
+ if (typeof specConfiguration === 'object' && appName) {
37
+ // The appName has a generateOption spec, but not for the schematic trying to generate
38
+ // Check if the global generateOptions has a spec to use instead
39
+ specConfiguration = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'generateOptions.spec', '');
40
+ if (typeof specConfiguration === 'boolean') {
41
+ return specConfiguration;
42
+ }
43
+ if (typeof specConfiguration === 'object' &&
44
+ specConfiguration[schematic] !== undefined) {
45
+ return specConfiguration[schematic];
46
+ }
47
+ }
48
+ return specValue;
49
+ }
50
+ exports.shouldGenerateSpec = shouldGenerateSpec;
51
+ function askForProjectName(promptQuestion, projects) {
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ const questions = [
54
+ (0, questions_1.generateSelect)('appName')(promptQuestion)(projects),
55
+ ];
56
+ const prompt = inquirer.createPromptModule();
57
+ return prompt(questions);
58
+ });
59
+ }
60
+ exports.askForProjectName = askForProjectName;
61
+ function moveDefaultProjectToStart(configuration, defaultProjectName, defaultLabel) {
62
+ let projects = configuration.projects != null ? Object.keys(configuration.projects) : [];
63
+ if (configuration.sourceRoot !== 'src') {
64
+ projects = projects.filter((p) => p !== defaultProjectName.replace(defaultLabel, ''));
65
+ }
66
+ projects.unshift(defaultProjectName);
67
+ return projects;
68
+ }
69
+ exports.moveDefaultProjectToStart = moveDefaultProjectToStart;
@@ -0,0 +1,2 @@
1
+ import { CommanderStatic } from 'commander';
2
+ export declare function getRemainingFlags(cli: CommanderStatic): any[];
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRemainingFlags = void 0;
4
+ function getRemainingFlags(cli) {
5
+ const rawArgs = [...cli.rawArgs];
6
+ return rawArgs
7
+ .splice(Math.max(rawArgs.findIndex((item) => item.startsWith('--')), 0))
8
+ .filter((item, index, array) => {
9
+ // If the option is consumed by commander.js, then we skip it
10
+ if (cli.options.find((o) => o.short === item || o.long === item)) {
11
+ return false;
12
+ }
13
+ // If it's an argument of an option consumed by commander.js, then we
14
+ // skip it too
15
+ const prevKeyRaw = array[index - 1];
16
+ if (prevKeyRaw) {
17
+ const previousKey = camelCase(prevKeyRaw.replace('--', '').replace('no', ''));
18
+ if (cli[previousKey] === item) {
19
+ return false;
20
+ }
21
+ }
22
+ return true;
23
+ });
24
+ }
25
+ exports.getRemainingFlags = getRemainingFlags;
26
+ /**
27
+ * Camel-case the given `flag`
28
+ *
29
+ * @param {String} flag
30
+ * @return {String}
31
+ * @api private
32
+ */
33
+ function camelCase(flag) {
34
+ return flag.split('-').reduce((str, word) => {
35
+ return str + word[0].toUpperCase() + word.slice(1);
36
+ });
37
+ }
@@ -0,0 +1 @@
1
+ export declare function treeKillSync(pid: number, signal?: string | number): void;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.treeKillSync = void 0;
4
+ const child_process_1 = require("child_process");
5
+ function treeKillSync(pid, signal) {
6
+ if (process.platform === 'win32') {
7
+ (0, child_process_1.execSync)('taskkill /pid ' + pid + ' /T /F');
8
+ return;
9
+ }
10
+ const childs = getAllChilds(pid);
11
+ childs.forEach(function (pid) {
12
+ killPid(pid, signal);
13
+ });
14
+ killPid(pid, signal);
15
+ return;
16
+ }
17
+ exports.treeKillSync = treeKillSync;
18
+ function getAllPid() {
19
+ const rows = (0, child_process_1.execSync)('ps -A -o pid,ppid')
20
+ .toString()
21
+ .trim()
22
+ .split('\n')
23
+ .slice(1);
24
+ return rows
25
+ .map(function (row) {
26
+ const parts = row.match(/\s*(\d+)\s*(\d+)/);
27
+ if (parts === null) {
28
+ return null;
29
+ }
30
+ return {
31
+ pid: Number(parts[1]),
32
+ ppid: Number(parts[2]),
33
+ };
34
+ })
35
+ .filter((input) => {
36
+ return input != null;
37
+ });
38
+ }
39
+ function getAllChilds(pid) {
40
+ const allpid = getAllPid();
41
+ const ppidHash = {};
42
+ const result = [];
43
+ allpid.forEach(function (item) {
44
+ ppidHash[item.ppid] = ppidHash[item.ppid] || [];
45
+ ppidHash[item.ppid].push(item.pid);
46
+ });
47
+ const find = function (pid) {
48
+ ppidHash[pid] = ppidHash[pid] || [];
49
+ ppidHash[pid].forEach(function (childPid) {
50
+ result.push(childPid);
51
+ find(childPid);
52
+ });
53
+ };
54
+ find(pid);
55
+ return result;
56
+ }
57
+ function killPid(pid, signal) {
58
+ try {
59
+ process.kill(pid, signal);
60
+ }
61
+ catch (err) {
62
+ if (err.code !== 'ESRCH') {
63
+ throw err;
64
+ }
65
+ }
66
+ }
package/package.json ADDED
@@ -0,0 +1,105 @@
1
+ {
2
+ "name": "@gadmin2n/cli",
3
+ "version": "0.0.73",
4
+ "description": "Gadmin - modern, fast, powerful node.js web framework (@cli)",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "engines": {
9
+ "node": ">= 10.13.0",
10
+ "npm": ">= 6.11.0"
11
+ },
12
+ "bin": {
13
+ "gadmin2": "bin/gadmin.js"
14
+ },
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "clean": "gulp clean:bundle",
18
+ "format": "prettier --write \"**/*.ts\"",
19
+ "lint": "eslint '{lib,commands,actions}/**/*.ts' --fix",
20
+ "start": "node bin/gadmin.js",
21
+ "prepack": "npm run build",
22
+ "prepublish:next": "npm run build",
23
+ "publish:next": "npm publish --access public --tag next",
24
+ "prepublish:npm": "npm run build",
25
+ "publish:npm": "npm publish --access public",
26
+ "updateAndPublish": "node ./updateVersion.js",
27
+ "test": "jest --config test/jest-config.json",
28
+ "test:dev": "npm run clean && jest --config test/jest-config.json --watchAll",
29
+ "prerelease": "npm run build",
30
+ "release": "release-it"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/nestjs/nest-cli.git"
35
+ },
36
+ "contributors": [
37
+ "Kamil Mysliwiec <mail@kamilmysliwiec.com>",
38
+ "Mark Pieszak <mark@trilon.io>",
39
+ "ThomRick"
40
+ ],
41
+ "license": "MIT",
42
+ "bugs": {
43
+ "url": "https://github.com/nestjs/nest-cli/issues"
44
+ },
45
+ "homepage": "https://github.com/nestjs/nest-cli#readme",
46
+ "dependencies": {
47
+ "@angular-devkit/core": "13.3.2",
48
+ "@angular-devkit/schematics": "13.3.2",
49
+ "@angular-devkit/schematics-cli": "13.3.2",
50
+ "@gadmin2n/schematics": "^0.0.55",
51
+ "abc": "^0.6.1",
52
+ "chalk": "3.0.0",
53
+ "chokidar": "3.5.3",
54
+ "cli-table3": "0.6.1",
55
+ "commander": "4.1.1",
56
+ "fork-ts-checker-webpack-plugin": "7.2.3",
57
+ "inquirer": "7.3.3",
58
+ "node-emoji": "1.11.0",
59
+ "ora": "5.4.1",
60
+ "os-name": "4.0.1",
61
+ "rimraf": "3.0.2",
62
+ "shelljs": "0.8.5",
63
+ "source-map-support": "0.5.21",
64
+ "tree-kill": "1.2.2",
65
+ "tsconfig-paths": "3.14.1",
66
+ "tsconfig-paths-webpack-plugin": "3.5.2",
67
+ "typescript": "4.6.2",
68
+ "webpack": "5.71.0",
69
+ "webpack-node-externals": "3.0.0"
70
+ },
71
+ "devDependencies": {
72
+ "@commitlint/cli": "16.2.3",
73
+ "@commitlint/config-angular": "16.2.3",
74
+ "@types/copyfiles": "2.4.1",
75
+ "@types/inquirer": "7.3.3",
76
+ "@types/jest": "27.4.1",
77
+ "@types/node": "16.11.26",
78
+ "@types/node-emoji": "1.8.1",
79
+ "@types/ora": "3.2.0",
80
+ "@types/os-name": "3.1.0",
81
+ "@types/rimraf": "3.0.2",
82
+ "@types/shelljs": "0.8.11",
83
+ "@types/webpack-node-externals": "2.5.3",
84
+ "@typescript-eslint/eslint-plugin": "5.17.0",
85
+ "@typescript-eslint/parser": "5.17.0",
86
+ "delete-empty": "3.0.0",
87
+ "eslint": "8.12.0",
88
+ "eslint-config-prettier": "8.5.0",
89
+ "eslint-plugin-import": "2.26.0",
90
+ "gulp": "4.0.2",
91
+ "gulp-clean": "0.4.0",
92
+ "husky": "7.0.4",
93
+ "jest": "27.5.1",
94
+ "prettier": "2.6.2",
95
+ "release-it": "14.14.0",
96
+ "ts-jest": "27.1.4",
97
+ "ts-loader": "9.2.8",
98
+ "ts-node": "10.7.0"
99
+ },
100
+ "husky": {
101
+ "hooks": {
102
+ "commit-msg": "commitlint -c .commitlintrc.json -E HUSKY_GIT_PARAMS"
103
+ }
104
+ }
105
+ }
@@ -0,0 +1,68 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`tsconfig paths hooks should remove unused imports 1`] = `
4
+ Map {
5
+ "dist/foo.js" => "\\"use strict\\";
6
+ Object.defineProperty(exports, \\"__esModule\\", { value: true });
7
+ exports.Foo = void 0;
8
+ class Foo {
9
+ }
10
+ exports.Foo = Foo;
11
+ ",
12
+ "dist/bar.js" => "\\"use strict\\";
13
+ Object.defineProperty(exports, \\"__esModule\\", { value: true });
14
+ exports.Bar = void 0;
15
+ class Bar {
16
+ }
17
+ exports.Bar = Bar;
18
+ ",
19
+ "dist/main.js" => "\\"use strict\\";
20
+ Object.defineProperty(exports, \\"__esModule\\", { value: true });
21
+ ",
22
+ }
23
+ `;
24
+
25
+ exports[`tsconfig paths hooks should replace path of every import using a path alias by its relative path 1`] = `
26
+ Map {
27
+ "dist/foo.js" => "\\"use strict\\";
28
+ Object.defineProperty(exports, \\"__esModule\\", { value: true });
29
+ exports.Foo = void 0;
30
+ class Foo {
31
+ }
32
+ exports.Foo = Foo;
33
+ ",
34
+ "dist/bar.jsx" => "\\"use strict\\";
35
+ Object.defineProperty(exports, \\"__esModule\\", { value: true });
36
+ exports.Bar = void 0;
37
+ class Bar {
38
+ }
39
+ exports.Bar = Bar;
40
+ ",
41
+ "dist/baz.js" => "\\"use strict\\";
42
+ Object.defineProperty(exports, \\"__esModule\\", { value: true });
43
+ exports.Baz = void 0;
44
+ class Baz {
45
+ }
46
+ exports.Baz = Baz;
47
+ ",
48
+ "dist/qux.jsx" => "\\"use strict\\";
49
+ Object.defineProperty(exports, \\"__esModule\\", { value: true });
50
+ exports.Qux = void 0;
51
+ class Qux {
52
+ }
53
+ exports.Qux = Qux;
54
+ ",
55
+ "dist/main.js" => "\\"use strict\\";
56
+ Object.defineProperty(exports, \\"__esModule\\", { value: true });
57
+ const foo_1 = require(\\"./foo\\");
58
+ const bar_1 = require(\\"./bar\\");
59
+ const baz_1 = require(\\"./baz\\");
60
+ const qux_1 = require(\\"./qux\\");
61
+ // use the imports so they do not get eliminated
62
+ console.log(foo_1.Foo);
63
+ console.log(bar_1.Bar);
64
+ console.log(baz_1.Baz);
65
+ console.log(qux_1.Qux);
66
+ ",
67
+ }
68
+ `;
@@ -0,0 +1 @@
1
+ export class Bar {}
@@ -0,0 +1 @@
1
+ export class Baz {}
@@ -0,0 +1 @@
1
+ export class Qux {}