@nestjs/cli 8.2.2 → 8.2.5
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/actions/add.action.js +1 -0
- package/actions/build.action.js +1 -0
- package/actions/generate.action.js +4 -1
- package/actions/index.js +5 -1
- package/actions/info.action.js +6 -3
- package/actions/new.action.js +3 -3
- package/commands/add.command.js +1 -1
- package/commands/generate.command.js +13 -2
- package/commands/index.js +5 -1
- package/commands/new.command.js +12 -15
- package/lib/compiler/compiler.js +1 -1
- package/lib/compiler/watch-compiler.js +4 -2
- package/lib/configuration/index.js +5 -1
- package/lib/dependency-managers/index.js +5 -1
- package/lib/package-managers/abstract.package-manager.js +3 -3
- package/lib/package-managers/index.js +5 -1
- package/lib/readers/index.js +5 -1
- package/lib/runners/index.js +5 -1
- package/lib/schematics/index.js +5 -1
- package/lib/schematics/schematic.option.d.ts +2 -1
- package/lib/schematics/schematic.option.js +8 -6
- package/lib/ui/index.js +5 -1
- package/lib/utils/formatting.d.ts +8 -0
- package/lib/utils/formatting.js +19 -0
- package/package.json +18 -18
package/actions/add.action.js
CHANGED
|
@@ -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
|
}
|
package/actions/build.action.js
CHANGED
|
@@ -85,7 +85,10 @@ const mapSchematicOptions = (inputs) => {
|
|
|
85
85
|
const options = [];
|
|
86
86
|
inputs.forEach((input) => {
|
|
87
87
|
if (!excludedInputNames.includes(input.name) && input.value !== undefined) {
|
|
88
|
-
|
|
88
|
+
const keepInputName = input.options
|
|
89
|
+
? 'keepInputNameFormat' in input.options
|
|
90
|
+
: false;
|
|
91
|
+
options.push(new schematics_1.SchematicOption(input.name, input.value, keepInputName));
|
|
89
92
|
}
|
|
90
93
|
});
|
|
91
94
|
return options;
|
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.
|
|
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];
|
package/actions/info.action.js
CHANGED
|
@@ -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())
|
|
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', {
|
|
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({
|
package/actions/new.action.js
CHANGED
|
@@ -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,
|
|
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();
|
package/commands/add.command.js
CHANGED
|
@@ -22,10 +22,12 @@ 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)
|
|
30
|
+
.option('--skip-import', 'Skip importing', () => true, false)
|
|
29
31
|
.option('--no-spec', 'Disable spec files generation.', () => {
|
|
30
32
|
return { value: false, passedAsInput: true };
|
|
31
33
|
})
|
|
@@ -33,7 +35,9 @@ class GenerateCommand extends abstract_command_1.AbstractCommand {
|
|
|
33
35
|
.action((schematic, name, path, command) => __awaiter(this, void 0, void 0, function* () {
|
|
34
36
|
const options = [];
|
|
35
37
|
options.push({ name: 'dry-run', value: !!command.dryRun });
|
|
36
|
-
|
|
38
|
+
if (command.flat !== undefined) {
|
|
39
|
+
options.push({ name: 'flat', value: command.flat });
|
|
40
|
+
}
|
|
37
41
|
options.push({
|
|
38
42
|
name: 'spec',
|
|
39
43
|
value: typeof command.spec === 'boolean'
|
|
@@ -53,6 +57,13 @@ class GenerateCommand extends abstract_command_1.AbstractCommand {
|
|
|
53
57
|
name: 'project',
|
|
54
58
|
value: command.project,
|
|
55
59
|
});
|
|
60
|
+
options.push({
|
|
61
|
+
name: 'skipImport',
|
|
62
|
+
value: command.skipImport,
|
|
63
|
+
options: {
|
|
64
|
+
keepInputNameFormat: true,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
56
67
|
const inputs = [];
|
|
57
68
|
inputs.push({ name: 'schematic', value: schematic });
|
|
58
69
|
inputs.push({ name: 'name', value: name });
|
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.
|
|
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];
|
package/commands/new.command.js
CHANGED
|
@@ -19,25 +19,26 @@ class NewCommand extends abstract_command_1.AbstractCommand {
|
|
|
19
19
|
.alias('n')
|
|
20
20
|
.description('Generate Nest application.')
|
|
21
21
|
.option('--directory [directory]', 'Specify the destination directory')
|
|
22
|
-
.option('-d, --dry-run', 'Report actions that would be performed without writing out results.')
|
|
23
|
-
.option('-g, --skip-git', 'Skip git repository initialization.')
|
|
24
|
-
.option('-s, --skip-install', 'Skip package installation.')
|
|
22
|
+
.option('-d, --dry-run', 'Report actions that would be performed without writing out results.', false)
|
|
23
|
+
.option('-g, --skip-git', 'Skip git repository initialization.', false)
|
|
24
|
+
.option('-s, --skip-install', 'Skip package installation.', false)
|
|
25
25
|
.option('-p, --package-manager [package-manager]', 'Specify package manager.')
|
|
26
|
-
.option('-l, --language [language]', 'Programming language to be used (TypeScript or JavaScript)
|
|
27
|
-
.option('-c, --collection [collectionName]', 'Schematics collection to use.
|
|
28
|
-
.option('--strict', 'Enables strict mode in TypeScript.')
|
|
26
|
+
.option('-l, --language [language]', 'Programming language to be used (TypeScript or JavaScript)', 'TypeScript')
|
|
27
|
+
.option('-c, --collection [collectionName]', 'Schematics collection to use', schematics_1.Collection.NESTJS)
|
|
28
|
+
.option('--strict', 'Enables strict mode in TypeScript.', false)
|
|
29
29
|
.action((name, command) => __awaiter(this, void 0, void 0, function* () {
|
|
30
30
|
const options = [];
|
|
31
31
|
const availableLanguages = ['js', 'ts', 'javascript', 'typescript'];
|
|
32
32
|
options.push({ name: 'directory', value: command.directory });
|
|
33
|
-
options.push({ name: 'dry-run', value:
|
|
34
|
-
options.push({ name: 'skip-git', value:
|
|
35
|
-
options.push({ name: 'skip-install', value:
|
|
36
|
-
options.push({ name: 'strict', value:
|
|
33
|
+
options.push({ name: 'dry-run', value: command.dryRun });
|
|
34
|
+
options.push({ name: 'skip-git', value: command.skipGit });
|
|
35
|
+
options.push({ name: 'skip-install', value: command.skipInstall });
|
|
36
|
+
options.push({ name: 'strict', value: command.strict });
|
|
37
37
|
options.push({
|
|
38
38
|
name: 'package-manager',
|
|
39
39
|
value: command.packageManager,
|
|
40
40
|
});
|
|
41
|
+
options.push({ name: 'collection', value: command.collection });
|
|
41
42
|
if (!!command.language) {
|
|
42
43
|
const lowercasedLanguage = command.language.toLowerCase();
|
|
43
44
|
const langMatch = availableLanguages.includes(lowercasedLanguage);
|
|
@@ -58,11 +59,7 @@ class NewCommand extends abstract_command_1.AbstractCommand {
|
|
|
58
59
|
}
|
|
59
60
|
options.push({
|
|
60
61
|
name: 'language',
|
|
61
|
-
value:
|
|
62
|
-
});
|
|
63
|
-
options.push({
|
|
64
|
-
name: 'collection',
|
|
65
|
-
value: command.collection || schematics_1.Collection.NESTJS,
|
|
62
|
+
value: command.language,
|
|
66
63
|
});
|
|
67
64
|
const inputs = [];
|
|
68
65
|
inputs.push({ name: 'name', value: name });
|
package/lib/compiler/compiler.js
CHANGED
|
@@ -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
|
|
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,
|
|
@@ -27,7 +27,7 @@ class WatchCompiler {
|
|
|
27
27
|
host.createProgram = (rootNames, options,
|
|
28
28
|
// tslint:disable-next-line:no-shadowed-variable
|
|
29
29
|
host, oldProgram) => {
|
|
30
|
-
const tsconfigPathsPlugin = (0, tsconfig_paths_hook_1.tsconfigPathsBeforeHookFactory)(options);
|
|
30
|
+
const tsconfigPathsPlugin = options ? (0, tsconfig_paths_hook_1.tsconfigPathsBeforeHookFactory)(options) : null;
|
|
31
31
|
const program = origCreateProgram(rootNames, options, host, oldProgram, undefined, projectReferences);
|
|
32
32
|
const origProgramEmit = program.emit;
|
|
33
33
|
program.emit = (targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) => {
|
|
@@ -36,7 +36,9 @@ class WatchCompiler {
|
|
|
36
36
|
const before = plugins.beforeHooks.map((hook) => hook(program.getProgram()));
|
|
37
37
|
const after = plugins.afterHooks.map((hook) => hook(program.getProgram()));
|
|
38
38
|
const afterDeclarations = plugins.afterDeclarationsHooks.map((hook) => hook(program.getProgram()));
|
|
39
|
-
|
|
39
|
+
if (tsconfigPathsPlugin) {
|
|
40
|
+
before.unshift(tsconfigPathsPlugin);
|
|
41
|
+
}
|
|
40
42
|
transforms.before = before.concat(transforms.before || []);
|
|
41
43
|
transforms.after = after.concat(transforms.after || []);
|
|
42
44
|
transforms.afterDeclarations = afterDeclarations.concat(transforms.afterDeclarations || []);
|
|
@@ -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.
|
|
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.
|
|
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;
|
|
@@ -33,8 +33,8 @@ class AbstractPackageManager {
|
|
|
33
33
|
try {
|
|
34
34
|
const commandArgs = `${this.cli.install} ${this.cli.silentFlag}`;
|
|
35
35
|
const collect = true;
|
|
36
|
-
const
|
|
37
|
-
yield this.runner.run(commandArgs, collect, (0, path_1.join)(process.cwd(),
|
|
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));
|
|
@@ -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.
|
|
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];
|
package/lib/readers/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.
|
|
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];
|
package/lib/runners/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.
|
|
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];
|
package/lib/schematics/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.
|
|
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,8 @@
|
|
|
1
1
|
export declare class SchematicOption {
|
|
2
2
|
private name;
|
|
3
3
|
private value;
|
|
4
|
-
|
|
4
|
+
private keepInputNameFormat;
|
|
5
|
+
constructor(name: string, value: boolean | string, keepInputNameFormat?: boolean);
|
|
5
6
|
toCommandString(): string;
|
|
6
7
|
private format;
|
|
7
8
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SchematicOption = void 0;
|
|
4
|
-
const
|
|
4
|
+
const formatting_1 = require("../utils/formatting");
|
|
5
5
|
class SchematicOption {
|
|
6
|
-
constructor(name, value) {
|
|
6
|
+
constructor(name, value, keepInputNameFormat = false) {
|
|
7
7
|
this.name = name;
|
|
8
8
|
this.value = value;
|
|
9
|
+
this.keepInputNameFormat = keepInputNameFormat;
|
|
9
10
|
}
|
|
10
11
|
toCommandString() {
|
|
11
12
|
if (typeof this.value === 'string') {
|
|
@@ -20,16 +21,17 @@ class SchematicOption {
|
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
else if (typeof this.value === 'boolean') {
|
|
23
|
-
const str =
|
|
24
|
+
const str = this.keepInputNameFormat
|
|
25
|
+
? this.name
|
|
26
|
+
: (0, formatting_1.normalizeToKebabOrSnakeCase)(this.name);
|
|
24
27
|
return this.value ? `--${str}` : `--no-${str}`;
|
|
25
28
|
}
|
|
26
29
|
else {
|
|
27
|
-
return `--${
|
|
30
|
+
return `--${(0, formatting_1.normalizeToKebabOrSnakeCase)(this.name)}=${this.value}`;
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
format() {
|
|
31
|
-
return
|
|
32
|
-
.dasherize(this.value)
|
|
34
|
+
return (0, formatting_1.normalizeToKebabOrSnakeCase)(this.value)
|
|
33
35
|
.split('')
|
|
34
36
|
.reduce((content, char) => {
|
|
35
37
|
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.
|
|
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];
|
|
@@ -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.
|
|
3
|
+
"version": "8.2.5",
|
|
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.2
|
|
47
|
-
"@angular-devkit/schematics": "13.2
|
|
48
|
-
"@angular-devkit/schematics-cli": "13.2
|
|
46
|
+
"@angular-devkit/core": "13.3.2",
|
|
47
|
+
"@angular-devkit/schematics": "13.3.2",
|
|
48
|
+
"@angular-devkit/schematics-cli": "13.3.2",
|
|
49
49
|
"@nestjs/schematics": "^8.0.3",
|
|
50
50
|
"chalk": "3.0.0",
|
|
51
51
|
"chokidar": "3.5.3",
|
|
52
52
|
"cli-table3": "0.6.1",
|
|
53
53
|
"commander": "4.1.1",
|
|
54
|
-
"fork-ts-checker-webpack-plugin": "7.2.
|
|
54
|
+
"fork-ts-checker-webpack-plugin": "7.2.3",
|
|
55
55
|
"inquirer": "7.3.3",
|
|
56
56
|
"node-emoji": "1.11.0",
|
|
57
57
|
"ora": "5.4.1",
|
|
@@ -60,15 +60,15 @@
|
|
|
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.
|
|
63
|
+
"tsconfig-paths": "3.14.1",
|
|
64
64
|
"tsconfig-paths-webpack-plugin": "3.5.2",
|
|
65
65
|
"typescript": "4.6.2",
|
|
66
|
-
"webpack": "5.
|
|
66
|
+
"webpack": "5.71.0",
|
|
67
67
|
"webpack-node-externals": "3.0.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@commitlint/cli": "16.2.
|
|
71
|
-
"@commitlint/config-angular": "16.2.
|
|
70
|
+
"@commitlint/cli": "16.2.3",
|
|
71
|
+
"@commitlint/config-angular": "16.2.3",
|
|
72
72
|
"@types/copyfiles": "2.4.1",
|
|
73
73
|
"@types/inquirer": "7.3.3",
|
|
74
74
|
"@types/jest": "27.4.1",
|
|
@@ -79,21 +79,21 @@
|
|
|
79
79
|
"@types/rimraf": "3.0.2",
|
|
80
80
|
"@types/shelljs": "0.8.11",
|
|
81
81
|
"@types/webpack-node-externals": "2.5.3",
|
|
82
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
83
|
-
"@typescript-eslint/parser": "5.
|
|
82
|
+
"@typescript-eslint/eslint-plugin": "5.17.0",
|
|
83
|
+
"@typescript-eslint/parser": "5.17.0",
|
|
84
84
|
"delete-empty": "3.0.0",
|
|
85
|
-
"eslint": "8.
|
|
85
|
+
"eslint": "8.12.0",
|
|
86
86
|
"eslint-config-prettier": "8.5.0",
|
|
87
|
-
"eslint-plugin-import": "2.
|
|
87
|
+
"eslint-plugin-import": "2.26.0",
|
|
88
88
|
"gulp": "4.0.2",
|
|
89
89
|
"gulp-clean": "0.4.0",
|
|
90
90
|
"husky": "7.0.4",
|
|
91
91
|
"jest": "27.5.1",
|
|
92
|
-
"prettier": "2.
|
|
93
|
-
"release-it": "14.
|
|
94
|
-
"ts-jest": "27.1.
|
|
95
|
-
"ts-loader": "9.2.
|
|
96
|
-
"ts-node": "10.
|
|
92
|
+
"prettier": "2.6.2",
|
|
93
|
+
"release-it": "14.14.0",
|
|
94
|
+
"ts-jest": "27.1.4",
|
|
95
|
+
"ts-loader": "9.2.8",
|
|
96
|
+
"ts-node": "10.7.0"
|
|
97
97
|
},
|
|
98
98
|
"husky": {
|
|
99
99
|
"hooks": {
|