@nestjs/cli 8.2.0 → 8.2.3

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 (38) hide show
  1. package/actions/add.action.js +1 -0
  2. package/actions/build.action.js +1 -0
  3. package/actions/index.js +5 -1
  4. package/actions/info.action.js +6 -3
  5. package/actions/new.action.js +3 -3
  6. package/commands/add.command.js +1 -1
  7. package/commands/generate.command.js +5 -2
  8. package/commands/index.js +5 -1
  9. package/lib/compiler/compiler.js +1 -1
  10. package/lib/compiler/hooks/tsconfig-paths.hook.js +6 -1
  11. package/lib/configuration/index.js +5 -1
  12. package/lib/dependency-managers/index.js +5 -1
  13. package/lib/package-managers/abstract.package-manager.js +7 -5
  14. package/lib/package-managers/index.js +5 -1
  15. package/lib/package-managers/npm.package-manager.js +1 -0
  16. package/lib/package-managers/package-manager-commands.d.ts +1 -0
  17. package/lib/package-managers/pnpm.package-manager.js +1 -0
  18. package/lib/package-managers/yarn.package-manager.js +1 -0
  19. package/lib/readers/index.js +5 -1
  20. package/lib/runners/abstract.runner.d.ts +5 -0
  21. package/lib/runners/abstract.runner.js +8 -0
  22. package/lib/runners/index.js +5 -1
  23. package/lib/schematics/index.js +5 -1
  24. package/lib/schematics/schematic.option.js +4 -5
  25. package/lib/ui/index.js +5 -1
  26. package/lib/ui/messages.d.ts +1 -1
  27. package/lib/ui/messages.js +1 -1
  28. package/lib/utils/formatting.d.ts +8 -0
  29. package/lib/utils/formatting.js +19 -0
  30. package/package.json +23 -23
  31. package/test/lib/compiler/hooks/__snapshots__/tsconfig-paths.hook.spec.ts.snap +45 -0
  32. package/test/lib/compiler/hooks/fixtures/aliased-imports/src/bar.tsx +1 -0
  33. package/test/lib/compiler/hooks/fixtures/aliased-imports/src/baz.js +1 -0
  34. package/test/lib/compiler/hooks/fixtures/aliased-imports/src/qux.jsx +1 -0
  35. package/.commitlintrc.json +0 -28
  36. package/.eslintignore +0 -3
  37. package/.eslintrc.js +0 -25
  38. package/.release-it.json +0 -9
@@ -34,6 +34,7 @@ class AddAction extends abstract_action_1.AbstractAction {
34
34
  }
35
35
  else {
36
36
  console.error(chalk.red(ui_1.MESSAGES.LIBRARY_INSTALLATION_FAILED_BAD_PACKAGE(libraryName)));
37
+ throw new Error(ui_1.MESSAGES.LIBRARY_INSTALLATION_FAILED_BAD_PACKAGE(libraryName));
37
38
  }
38
39
  });
39
40
  }
@@ -56,6 +56,7 @@ class BuildAction extends abstract_action_1.AbstractAction {
56
56
  else {
57
57
  console.error(`\n${chalk.red(err)}\n`);
58
58
  }
59
+ process.exit(1);
59
60
  }
60
61
  });
61
62
  }
package/actions/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -69,7 +69,8 @@ class InfoAction extends abstract_action_1.AbstractAction {
69
69
  }
70
70
  displayCliVersion() {
71
71
  console.info(chalk.green('[Nest CLI]'));
72
- console.info('Nest CLI Version :', chalk.blue(JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../package.json')).toString()).version), '\n');
72
+ console.info('Nest CLI Version :', chalk.blue(JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../package.json')).toString())
73
+ .version), '\n');
73
74
  }
74
75
  readProjectPackageDependencies() {
75
76
  const buffer = (0, fs_1.readFileSync)((0, path_1.join)(process.cwd(), 'package.json'));
@@ -77,7 +78,7 @@ class InfoAction extends abstract_action_1.AbstractAction {
77
78
  const dependencies = Object.assign(Object.assign({}, pack.dependencies), pack.devDependencies);
78
79
  Object.keys(dependencies).forEach((key) => {
79
80
  dependencies[key] = {
80
- version: dependencies[key]
81
+ version: dependencies[key],
81
82
  };
82
83
  });
83
84
  return dependencies;
@@ -93,7 +94,9 @@ class InfoAction extends abstract_action_1.AbstractAction {
93
94
  const nestDependencies = [];
94
95
  Object.keys(dependencies).forEach((key) => {
95
96
  if (key.indexOf('@nestjs') > -1) {
96
- const depPackagePath = require.resolve(key + '/package.json', { paths: [process.cwd()] });
97
+ const depPackagePath = require.resolve(key + '/package.json', {
98
+ paths: [process.cwd()],
99
+ });
97
100
  const depPackage = (0, fs_1.readFileSync)(depPackagePath).toString();
98
101
  const value = JSON.parse(depPackage).version;
99
102
  nestDependencies.push({
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.exit = exports.retrieveCols = exports.NewAction = void 0;
13
- const strings_1 = require("@angular-devkit/core/src/utils/strings");
14
13
  const chalk = require("chalk");
15
14
  const child_process_1 = require("child_process");
16
15
  const fs = require("fs");
@@ -23,6 +22,7 @@ const questions_1 = require("../lib/questions/questions");
23
22
  const git_runner_1 = require("../lib/runners/git.runner");
24
23
  const schematics_1 = require("../lib/schematics");
25
24
  const ui_1 = require("../lib/ui");
25
+ const formatting_1 = require("../lib/utils/formatting");
26
26
  const abstract_action_1 = require("./abstract.action");
27
27
  class NewAction extends abstract_action_1.AbstractAction {
28
28
  handle(inputs, options) {
@@ -53,7 +53,7 @@ exports.NewAction = NewAction;
53
53
  const getApplicationNameInput = (inputs) => inputs.find((input) => input.name === 'name');
54
54
  const getProjectDirectory = (applicationName, directoryOption) => {
55
55
  return ((directoryOption && directoryOption.value) ||
56
- (0, strings_1.dasherize)(applicationName.value));
56
+ (0, formatting_1.normalizeToKebabOrSnakeCase)(applicationName.value));
57
57
  };
58
58
  const askForMissingInformation = (inputs) => __awaiter(void 0, void 0, void 0, function* () {
59
59
  console.info(ui_1.MESSAGES.PROJECT_INFORMATION_START);
@@ -121,7 +121,7 @@ const askForPackageManager = () => __awaiter(void 0, void 0, void 0, function* (
121
121
  (0, questions_1.generateSelect)('package-manager')(ui_1.MESSAGES.PACKAGE_MANAGER_QUESTION)([
122
122
  package_managers_1.PackageManager.NPM,
123
123
  package_managers_1.PackageManager.YARN,
124
- package_managers_1.PackageManager.PNPM
124
+ package_managers_1.PackageManager.PNPM,
125
125
  ]),
126
126
  ];
127
127
  const prompt = inquirer.createPromptModule();
@@ -35,7 +35,7 @@ class AddCommand extends abstract_command_1.AbstractCommand {
35
35
  yield this.action.handle(inputs, options, flags);
36
36
  }
37
37
  catch (err) {
38
- process.exit(0);
38
+ process.exit(1);
39
39
  }
40
40
  }));
41
41
  }
@@ -22,7 +22,8 @@ class GenerateCommand extends abstract_command_1.AbstractCommand {
22
22
  .description(this.buildDescription())
23
23
  .option('-d, --dry-run', 'Report actions that would be taken without writing out results.')
24
24
  .option('-p, --project [project]', 'Project in which to generate files.')
25
- .option('--flat', 'Enforce flat structure of generated element.')
25
+ .option('--flat', 'Enforce flat structure of generated element.', () => true)
26
+ .option('--no-flat', 'Enforce that directories are generated.', () => false)
26
27
  .option('--spec', 'Enforce spec files generation.', () => {
27
28
  return { value: true, passedAsInput: true };
28
29
  }, true)
@@ -33,7 +34,9 @@ class GenerateCommand extends abstract_command_1.AbstractCommand {
33
34
  .action((schematic, name, path, command) => __awaiter(this, void 0, void 0, function* () {
34
35
  const options = [];
35
36
  options.push({ name: 'dry-run', value: !!command.dryRun });
36
- options.push({ name: 'flat', value: command.flat });
37
+ if (command.flat !== undefined) {
38
+ options.push({ name: 'flat', value: command.flat });
39
+ }
37
40
  options.push({
38
41
  name: 'spec',
39
42
  value: typeof command.spec === 'boolean'
package/commands/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -17,7 +17,7 @@ class Compiler {
17
17
  getCurrentDirectory: tsBinary.sys.getCurrentDirectory,
18
18
  getNewLine: () => tsBinary.sys.newLine,
19
19
  };
20
- const { options, fileNames, projectReferences, } = this.tsConfigProvider.getByConfigFilename(configFilename);
20
+ const { options, fileNames, projectReferences } = this.tsConfigProvider.getByConfigFilename(configFilename);
21
21
  const createProgram = tsBinary.createIncrementalProgram || tsBinary.createProgram;
22
22
  const program = createProgram.call(ts, {
23
23
  rootNames: fileNames,
@@ -42,7 +42,12 @@ function tsconfigPathsBeforeHookFactory(compilerOptions) {
42
42
  }
43
43
  exports.tsconfigPathsBeforeHookFactory = tsconfigPathsBeforeHookFactory;
44
44
  function getNotAliasedPath(sf, matcher, text) {
45
- let result = matcher(text, undefined, undefined, ['.ts', '.js']);
45
+ let result = matcher(text, undefined, undefined, [
46
+ '.ts',
47
+ '.tsx',
48
+ '.js',
49
+ '.jsx',
50
+ ]);
46
51
  if (!result) {
47
52
  return;
48
53
  }
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -10,12 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.AbstractPackageManager = void 0;
13
- const strings_1 = require("@angular-devkit/core/src/utils/strings");
14
13
  const chalk = require("chalk");
15
14
  const fs_1 = require("fs");
16
15
  const ora = require("ora");
17
16
  const path_1 = require("path");
18
17
  const ui_1 = require("../ui");
18
+ const formatting_1 = require("../utils/formatting");
19
19
  class AbstractPackageManager {
20
20
  constructor(runner) {
21
21
  this.runner = runner;
@@ -31,10 +31,10 @@ class AbstractPackageManager {
31
31
  });
32
32
  spinner.start();
33
33
  try {
34
- const commandArguments = `${this.cli.install} --silent`;
34
+ const commandArgs = `${this.cli.install} ${this.cli.silentFlag}`;
35
35
  const collect = true;
36
- const dasherizedDirectory = (0, strings_1.dasherize)(directory);
37
- yield this.runner.run(commandArguments, collect, (0, path_1.join)(process.cwd(), dasherizedDirectory));
36
+ const normalizedDirectory = (0, formatting_1.normalizeToKebabOrSnakeCase)(directory);
37
+ yield this.runner.run(commandArgs, collect, (0, path_1.join)(process.cwd(), normalizedDirectory));
38
38
  spinner.succeed();
39
39
  console.info();
40
40
  console.info(ui_1.MESSAGES.PACKAGE_MANAGER_INSTALLATION_SUCCEED(directory));
@@ -46,7 +46,9 @@ class AbstractPackageManager {
46
46
  }
47
47
  catch (_a) {
48
48
  spinner.fail();
49
- console.error(chalk.red(ui_1.MESSAGES.PACKAGE_MANAGER_INSTALLATION_FAILED));
49
+ const commandArgs = this.cli.install;
50
+ const commandToRun = this.runner.rawFullCommand(commandArgs);
51
+ console.error(chalk.red(ui_1.MESSAGES.PACKAGE_MANAGER_INSTALLATION_FAILED(chalk.bold(commandToRun))));
50
52
  }
51
53
  });
52
54
  }
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -19,6 +19,7 @@ class NpmPackageManager extends abstract_package_manager_1.AbstractPackageManage
19
19
  remove: 'uninstall',
20
20
  saveFlag: '--save',
21
21
  saveDevFlag: '--save-dev',
22
+ silentFlag: '--silent',
22
23
  };
23
24
  }
24
25
  }
@@ -5,4 +5,5 @@ export interface PackageManagerCommands {
5
5
  remove: string;
6
6
  saveFlag: string;
7
7
  saveDevFlag: string;
8
+ silentFlag: string;
8
9
  }
@@ -20,6 +20,7 @@ class PnpmPackageManager extends abstract_package_manager_1.AbstractPackageManag
20
20
  remove: 'uninstall',
21
21
  saveFlag: '--save',
22
22
  saveDevFlag: '--save-dev',
23
+ silentFlag: '--reporter=silent',
23
24
  };
24
25
  }
25
26
  }
@@ -19,6 +19,7 @@ class YarnPackageManager extends abstract_package_manager_1.AbstractPackageManag
19
19
  remove: 'remove',
20
20
  saveFlag: '',
21
21
  saveDevFlag: '-D',
22
+ silentFlag: '--silent',
22
23
  };
23
24
  }
24
25
  }
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -3,4 +3,9 @@ export declare class AbstractRunner {
3
3
  protected args: string[];
4
4
  constructor(binary: string, args?: string[]);
5
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;
6
11
  }
@@ -43,5 +43,13 @@ class AbstractRunner {
43
43
  });
44
44
  });
45
45
  }
46
+ /**
47
+ * @param command
48
+ * @returns The entire command that will be ran when calling `run(command)`.
49
+ */
50
+ rawFullCommand(command) {
51
+ const commandArgs = [...this.args, command];
52
+ return `${this.binary} ${commandArgs.join(' ')}`;
53
+ }
46
54
  }
47
55
  exports.AbstractRunner = AbstractRunner;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SchematicOption = void 0;
4
- const core_1 = require("@angular-devkit/core");
4
+ const formatting_1 = require("../utils/formatting");
5
5
  class SchematicOption {
6
6
  constructor(name, value) {
7
7
  this.name = name;
@@ -20,16 +20,15 @@ class SchematicOption {
20
20
  }
21
21
  }
22
22
  else if (typeof this.value === 'boolean') {
23
- const str = core_1.strings.dasherize(this.name);
23
+ const str = (0, formatting_1.normalizeToKebabOrSnakeCase)(this.name);
24
24
  return this.value ? `--${str}` : `--no-${str}`;
25
25
  }
26
26
  else {
27
- return `--${core_1.strings.dasherize(this.name)}=${this.value}`;
27
+ return `--${(0, formatting_1.normalizeToKebabOrSnakeCase)(this.name)}=${this.value}`;
28
28
  }
29
29
  }
30
30
  format() {
31
- return core_1.strings
32
- .dasherize(this.value)
31
+ return (0, formatting_1.normalizeToKebabOrSnakeCase)(this.value)
33
32
  .split('')
34
33
  .reduce((content, char) => {
35
34
  if (char === '(' || char === ')' || char === '[' || char === ']') {
package/lib/ui/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -14,7 +14,7 @@ export declare const MESSAGES: {
14
14
  GET_STARTED_INFORMATION: string;
15
15
  CHANGE_DIR_COMMAND: (name: string) => string;
16
16
  START_COMMAND: (name: string) => string;
17
- PACKAGE_MANAGER_INSTALLATION_FAILED: string;
17
+ PACKAGE_MANAGER_INSTALLATION_FAILED: (commandToRunManually: string) => string;
18
18
  NEST_INFORMATION_PACKAGE_MANAGER_FAILED: string;
19
19
  LIBRARY_INSTALLATION_FAILED_BAD_PACKAGE: (name: string) => string;
20
20
  LIBRARY_INSTALLATION_FAILED_NO_LIBRARY: string;
@@ -21,7 +21,7 @@ exports.MESSAGES = {
21
21
  GET_STARTED_INFORMATION: `${emojis_1.EMOJIS.POINT_RIGHT} Get started with the following commands:`,
22
22
  CHANGE_DIR_COMMAND: (name) => `$ cd ${name}`,
23
23
  START_COMMAND: (name) => `$ ${name} run start`,
24
- PACKAGE_MANAGER_INSTALLATION_FAILED: `${emojis_1.EMOJIS.SCREAM} Packages installation failed, see above`,
24
+ 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.`,
25
25
  // tslint:disable-next-line:max-line-length
26
26
  NEST_INFORMATION_PACKAGE_MANAGER_FAILED: `${emojis_1.EMOJIS.SMIRK} cannot read your project package.json file, are you inside your project directory?`,
27
27
  LIBRARY_INSTALLATION_FAILED_BAD_PACKAGE: (name) => `Unable to install library ${name} because package did not install. Please check package name.`,
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/cli",
3
- "version": "8.2.0",
3
+ "version": "8.2.3",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@cli)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -43,15 +43,15 @@
43
43
  },
44
44
  "homepage": "https://github.com/nestjs/nest-cli#readme",
45
45
  "dependencies": {
46
- "@angular-devkit/core": "13.1.2",
47
- "@angular-devkit/schematics": "13.1.2",
48
- "@angular-devkit/schematics-cli": "13.1.2",
46
+ "@angular-devkit/core": "13.2.6",
47
+ "@angular-devkit/schematics": "13.2.6",
48
+ "@angular-devkit/schematics-cli": "13.2.6",
49
49
  "@nestjs/schematics": "^8.0.3",
50
50
  "chalk": "3.0.0",
51
- "chokidar": "3.5.2",
51
+ "chokidar": "3.5.3",
52
52
  "cli-table3": "0.6.1",
53
53
  "commander": "4.1.1",
54
- "fork-ts-checker-webpack-plugin": "6.5.0",
54
+ "fork-ts-checker-webpack-plugin": "7.2.1",
55
55
  "inquirer": "7.3.3",
56
56
  "node-emoji": "1.11.0",
57
57
  "ora": "5.4.1",
@@ -60,40 +60,40 @@
60
60
  "shelljs": "0.8.5",
61
61
  "source-map-support": "0.5.21",
62
62
  "tree-kill": "1.2.2",
63
- "tsconfig-paths": "3.12.0",
63
+ "tsconfig-paths": "3.14.0",
64
64
  "tsconfig-paths-webpack-plugin": "3.5.2",
65
- "typescript": "4.5.4",
66
- "webpack": "5.66.0",
65
+ "typescript": "4.6.2",
66
+ "webpack": "5.70.0",
67
67
  "webpack-node-externals": "3.0.0"
68
68
  },
69
69
  "devDependencies": {
70
- "@commitlint/cli": "16.0.2",
71
- "@commitlint/config-angular": "16.0.0",
70
+ "@commitlint/cli": "16.2.1",
71
+ "@commitlint/config-angular": "16.2.1",
72
72
  "@types/copyfiles": "2.4.1",
73
73
  "@types/inquirer": "7.3.3",
74
- "@types/jest": "27.4.0",
75
- "@types/node": "16.11.19",
74
+ "@types/jest": "27.4.1",
75
+ "@types/node": "16.11.26",
76
76
  "@types/node-emoji": "1.8.1",
77
77
  "@types/ora": "3.2.0",
78
78
  "@types/os-name": "3.1.0",
79
79
  "@types/rimraf": "3.0.2",
80
- "@types/shelljs": "0.8.10",
80
+ "@types/shelljs": "0.8.11",
81
81
  "@types/webpack-node-externals": "2.5.3",
82
- "@typescript-eslint/eslint-plugin": "5.9.1",
83
- "@typescript-eslint/parser": "5.9.1",
82
+ "@typescript-eslint/eslint-plugin": "5.15.0",
83
+ "@typescript-eslint/parser": "5.15.0",
84
84
  "delete-empty": "3.0.0",
85
- "eslint": "8.6.0",
86
- "eslint-config-prettier": "8.3.0",
85
+ "eslint": "8.11.0",
86
+ "eslint-config-prettier": "8.5.0",
87
87
  "eslint-plugin-import": "2.25.4",
88
88
  "gulp": "4.0.2",
89
89
  "gulp-clean": "0.4.0",
90
90
  "husky": "7.0.4",
91
- "jest": "27.4.7",
91
+ "jest": "27.5.1",
92
92
  "prettier": "2.5.1",
93
- "release-it": "14.12.1",
94
- "ts-jest": "27.1.2",
95
- "ts-loader": "9.2.6",
96
- "ts-node": "10.4.0"
93
+ "release-it": "14.12.5",
94
+ "ts-jest": "27.1.3",
95
+ "ts-loader": "9.2.8",
96
+ "ts-node": "10.7.0"
97
97
  },
98
98
  "husky": {
99
99
  "hooks": {
@@ -21,3 +21,48 @@ Object.defineProperty(exports, \\"__esModule\\", { value: true });
21
21
  ",
22
22
  }
23
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 {}
@@ -1,28 +0,0 @@
1
- {
2
- "extends": ["@commitlint/config-angular"],
3
- "rules": {
4
- "subject-case": [
5
- 2,
6
- "always",
7
- ["sentence-case", "start-case", "pascal-case", "upper-case", "lower-case"]
8
- ],
9
- "type-enum": [
10
- 2,
11
- "always",
12
- [
13
- "build",
14
- "chore",
15
- "ci",
16
- "docs",
17
- "feat",
18
- "fix",
19
- "perf",
20
- "refactor",
21
- "revert",
22
- "style",
23
- "test",
24
- "sample"
25
- ]
26
- ]
27
- }
28
- }
package/.eslintignore DELETED
@@ -1,3 +0,0 @@
1
- src/**/*.test.ts
2
- src/**/files/**
3
- test/**
package/.eslintrc.js DELETED
@@ -1,25 +0,0 @@
1
- module.exports = {
2
- parser: '@typescript-eslint/parser',
3
- parserOptions: {
4
- project: 'tsconfig.json',
5
- sourceType: 'module',
6
- },
7
- plugins: ['@typescript-eslint/eslint-plugin'],
8
- extends: [
9
- 'plugin:@typescript-eslint/eslint-recommended',
10
- 'plugin:@typescript-eslint/recommended',
11
- 'prettier'
12
- ],
13
- root: true,
14
- env: {
15
- node: true,
16
- jest: true,
17
- },
18
- rules: {
19
- '@typescript-eslint/interface-name-prefix': 'off',
20
- '@typescript-eslint/explicit-function-return-type': 'off',
21
- '@typescript-eslint/no-explicit-any': 'off',
22
- '@typescript-eslint/no-use-before-define': 'off',
23
- '@typescript-eslint/no-non-null-assertion': 'off',
24
- },
25
- };
package/.release-it.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "git": {
3
- "tagName": "${version}",
4
- "commitMessage": "chore(): release v${version}"
5
- },
6
- "github": {
7
- "release": true
8
- }
9
- }