@nestjs/cli 9.4.0 → 9.4.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.
|
@@ -34,6 +34,7 @@ const generateFiles = (inputs) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
34
34
|
.value;
|
|
35
35
|
const spec = inputs.find((option) => option.name === 'spec');
|
|
36
36
|
const flat = inputs.find((option) => option.name === 'flat');
|
|
37
|
+
const specFileSuffix = inputs.find((option) => option.name === 'specFileSuffix');
|
|
37
38
|
const collection = schematics_1.CollectionFactory.create(collectionOption || configuration.collection || schematics_1.Collection.NESTJS);
|
|
38
39
|
const schematicOptions = mapSchematicOptions(inputs);
|
|
39
40
|
schematicOptions.push(new schematics_1.SchematicOption('language', configuration.language));
|
|
@@ -42,10 +43,12 @@ const generateFiles = (inputs) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
42
43
|
? (0, get_value_or_default_1.getValueOrDefault)(configuration, 'sourceRoot', appName)
|
|
43
44
|
: configuration.sourceRoot;
|
|
44
45
|
const specValue = spec.value;
|
|
45
|
-
const flatValue = !!flat;
|
|
46
|
+
const flatValue = !!(flat === null || flat === void 0 ? void 0 : flat.value);
|
|
47
|
+
const specFileSuffixValue = specFileSuffix.value;
|
|
46
48
|
const specOptions = spec.options;
|
|
47
49
|
let generateSpec = (0, project_utils_1.shouldGenerateSpec)(configuration, schematic, appName, specValue, specOptions.passedAsInput);
|
|
48
50
|
let generateFlat = (0, project_utils_1.shouldGenerateFlat)(configuration, appName, flatValue);
|
|
51
|
+
let generateSpecFileSuffix = (0, project_utils_1.getSpecFileSuffix)(configuration, appName, specFileSuffixValue);
|
|
49
52
|
// If you only add a `lib` we actually don't have monorepo: true BUT we do have "projects"
|
|
50
53
|
// Ensure we don't run for new app/libs schematics
|
|
51
54
|
if ((0, project_utils_1.shouldAskForProject)(schematic, configurationProjects, appName)) {
|
|
@@ -67,11 +70,13 @@ const generateFiles = (inputs) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
67
70
|
// Only overwrite if the appName is not the default- as it has already been loaded above
|
|
68
71
|
generateSpec = (0, project_utils_1.shouldGenerateSpec)(configuration, schematic, answers.appName, specValue, specOptions.passedAsInput);
|
|
69
72
|
generateFlat = (0, project_utils_1.shouldGenerateFlat)(configuration, answers.appNames, flatValue);
|
|
73
|
+
generateSpecFileSuffix = (0, project_utils_1.getSpecFileSuffix)(configuration, appName, specFileSuffixValue);
|
|
70
74
|
}
|
|
71
75
|
}
|
|
72
76
|
schematicOptions.push(new schematics_1.SchematicOption('sourceRoot', sourceRoot));
|
|
73
77
|
schematicOptions.push(new schematics_1.SchematicOption('spec', generateSpec));
|
|
74
78
|
schematicOptions.push(new schematics_1.SchematicOption('flat', generateFlat));
|
|
79
|
+
schematicOptions.push(new schematics_1.SchematicOption('specFileSuffix', generateSpecFileSuffix));
|
|
75
80
|
try {
|
|
76
81
|
const schematicInput = inputs.find((input) => input.name === 'schematic');
|
|
77
82
|
if (!schematicInput) {
|
|
@@ -86,7 +91,7 @@ const generateFiles = (inputs) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
86
91
|
}
|
|
87
92
|
});
|
|
88
93
|
const mapSchematicOptions = (inputs) => {
|
|
89
|
-
const excludedInputNames = ['schematic', 'spec', 'flat'];
|
|
94
|
+
const excludedInputNames = ['schematic', 'spec', 'flat', 'specFileSuffix'];
|
|
90
95
|
const options = [];
|
|
91
96
|
inputs.forEach((input) => {
|
|
92
97
|
if (!excludedInputNames.includes(input.name) && input.value !== undefined) {
|
|
@@ -29,6 +29,7 @@ class GenerateCommand extends abstract_command_1.AbstractCommand {
|
|
|
29
29
|
.option('--spec', 'Enforce spec files generation.', () => {
|
|
30
30
|
return { value: true, passedAsInput: true };
|
|
31
31
|
}, true)
|
|
32
|
+
.option('--spec-file-suffix [suffix]', 'Use a custom suffix for spec files.')
|
|
32
33
|
.option('--skip-import', 'Skip importing', () => true, false)
|
|
33
34
|
.option('--no-spec', 'Disable spec files generation.', () => {
|
|
34
35
|
return { value: false, passedAsInput: true };
|
|
@@ -51,6 +52,10 @@ class GenerateCommand extends abstract_command_1.AbstractCommand {
|
|
|
51
52
|
: command.spec.passedAsInput,
|
|
52
53
|
},
|
|
53
54
|
});
|
|
55
|
+
options.push({
|
|
56
|
+
name: 'specFileSuffix',
|
|
57
|
+
value: command.specFileSuffix,
|
|
58
|
+
});
|
|
54
59
|
options.push({
|
|
55
60
|
name: 'collection',
|
|
56
61
|
value: command.collection,
|
|
@@ -6,6 +6,7 @@ export declare function shouldAskForProject(schematic: string, configurationProj
|
|
|
6
6
|
}, appName: string): boolean;
|
|
7
7
|
export declare function shouldGenerateSpec(configuration: Required<Configuration>, schematic: string, appName: string, specValue: boolean, specPassedAsInput?: boolean): any;
|
|
8
8
|
export declare function shouldGenerateFlat(configuration: Required<Configuration>, appName: string, flatValue: boolean): boolean;
|
|
9
|
+
export declare function getSpecFileSuffix(configuration: Required<Configuration>, appName: string, specFileSuffixValue: string): string;
|
|
9
10
|
export declare function askForProjectName(promptQuestion: string, projects: string[]): Promise<Answers>;
|
|
10
11
|
export declare function moveDefaultProjectToStart(configuration: Configuration, defaultProjectName: string, defaultLabel: string): string[];
|
|
11
12
|
export declare function hasValidOptionFlag(queriedOptionName: string, options: Input[], queriedValue?: string | number | boolean): boolean;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.hasValidOptionFlag = exports.moveDefaultProjectToStart = exports.askForProjectName = exports.shouldGenerateFlat = exports.shouldGenerateSpec = exports.shouldAskForProject = void 0;
|
|
12
|
+
exports.hasValidOptionFlag = exports.moveDefaultProjectToStart = exports.askForProjectName = exports.getSpecFileSuffix = exports.shouldGenerateFlat = exports.shouldGenerateSpec = exports.shouldAskForProject = void 0;
|
|
13
13
|
const inquirer = require("inquirer");
|
|
14
14
|
const get_value_or_default_1 = require("../compiler/helpers/get-value-or-default");
|
|
15
15
|
const questions_1 = require("../questions/questions");
|
|
@@ -60,6 +60,18 @@ function shouldGenerateFlat(configuration, appName, flatValue) {
|
|
|
60
60
|
return flatValue;
|
|
61
61
|
}
|
|
62
62
|
exports.shouldGenerateFlat = shouldGenerateFlat;
|
|
63
|
+
function getSpecFileSuffix(configuration, appName, specFileSuffixValue) {
|
|
64
|
+
// CLI parameters have the highest priority
|
|
65
|
+
if (specFileSuffixValue) {
|
|
66
|
+
return specFileSuffixValue;
|
|
67
|
+
}
|
|
68
|
+
const specFileSuffixConfiguration = (0, get_value_or_default_1.getValueOrDefault)(configuration, 'generateOptions.specFileSuffix', appName || '', undefined, undefined, 'spec');
|
|
69
|
+
if (typeof specFileSuffixConfiguration === 'string') {
|
|
70
|
+
return specFileSuffixConfiguration;
|
|
71
|
+
}
|
|
72
|
+
return specFileSuffixValue;
|
|
73
|
+
}
|
|
74
|
+
exports.getSpecFileSuffix = getSpecFileSuffix;
|
|
63
75
|
function askForProjectName(promptQuestion, projects) {
|
|
64
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
77
|
const questions = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/cli",
|
|
3
|
-
"version": "9.4.
|
|
3
|
+
"version": "9.4.1",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@cli)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -62,16 +62,16 @@
|
|
|
62
62
|
"webpack-node-externals": "3.0.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@commitlint/cli": "17.
|
|
66
|
-
"@commitlint/config-angular": "17.
|
|
65
|
+
"@commitlint/cli": "17.6.1",
|
|
66
|
+
"@commitlint/config-angular": "17.6.1",
|
|
67
67
|
"@types/inquirer": "8.2.6",
|
|
68
|
-
"@types/jest": "29.5.
|
|
69
|
-
"@types/node": "18.15.
|
|
68
|
+
"@types/jest": "29.5.1",
|
|
69
|
+
"@types/node": "18.15.12",
|
|
70
70
|
"@types/node-emoji": "1.8.2",
|
|
71
71
|
"@types/shelljs": "0.8.12",
|
|
72
72
|
"@types/webpack-node-externals": "3.0.0",
|
|
73
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
74
|
-
"@typescript-eslint/parser": "5.
|
|
73
|
+
"@typescript-eslint/eslint-plugin": "5.59.0",
|
|
74
|
+
"@typescript-eslint/parser": "5.59.0",
|
|
75
75
|
"delete-empty": "3.0.0",
|
|
76
76
|
"eslint": "8.38.0",
|
|
77
77
|
"eslint-config-prettier": "8.8.0",
|