@nestjs/cli 11.0.0-next.3 → 11.0.0-next.4
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
CHANGED
|
@@ -48,8 +48,8 @@ class AddAction extends abstract_action_1.AbstractAction {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
const projects = (0, project_utils_1.moveDefaultProjectToStart)(configuration, defaultProjectName, defaultLabel);
|
|
51
|
-
const
|
|
52
|
-
const project =
|
|
51
|
+
const selectedProject = (await (0, project_utils_1.askForProjectName)(ui_1.MESSAGES.LIBRARY_PROJECT_SELECTION_QUESTION, projects));
|
|
52
|
+
const project = selectedProject.replace(defaultLabel, '');
|
|
53
53
|
if (project !== configuration.sourceRoot) {
|
|
54
54
|
sourceRoot = configurationProjects[project].sourceRoot;
|
|
55
55
|
}
|
|
@@ -51,15 +51,15 @@ const generateFiles = async (inputs) => {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
const projects = (0, project_utils_1.moveDefaultProjectToStart)(configuration, defaultProjectName, defaultLabel);
|
|
54
|
-
const
|
|
55
|
-
const project =
|
|
54
|
+
const selectedProjectName = (await (0, project_utils_1.askForProjectName)(ui_1.MESSAGES.PROJECT_SELECTION_QUESTION, projects));
|
|
55
|
+
const project = selectedProjectName.replace(defaultLabel, '');
|
|
56
56
|
if (project !== configuration.sourceRoot) {
|
|
57
57
|
sourceRoot = configurationProjects[project].sourceRoot;
|
|
58
58
|
}
|
|
59
|
-
if (
|
|
59
|
+
if (selectedProjectName !== defaultProjectName) {
|
|
60
60
|
// Only overwrite if the appName is not the default- as it has already been loaded above
|
|
61
|
-
generateSpec = (0, project_utils_1.shouldGenerateSpec)(configuration, schematic,
|
|
62
|
-
generateFlat = (0, project_utils_1.shouldGenerateFlat)(configuration,
|
|
61
|
+
generateSpec = (0, project_utils_1.shouldGenerateSpec)(configuration, schematic, selectedProjectName, specValue, specOptions.passedAsInput);
|
|
62
|
+
generateFlat = (0, project_utils_1.shouldGenerateFlat)(configuration, selectedProjectName, flatValue);
|
|
63
63
|
generateSpecFileSuffix = (0, project_utils_1.getSpecFileSuffix)(configuration, appName, specFileSuffixValue);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
export declare const generateInput: (name: string, message: string) => (defaultAnswer: string) => any;
|
|
2
|
-
export declare const generateSelect: (name: string) => (
|
|
2
|
+
export declare const generateSelect: (name: string) => (message: string) => (choices: string[]) => {
|
|
3
|
+
name: string;
|
|
4
|
+
message: string;
|
|
5
|
+
choices: {
|
|
6
|
+
name: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}[];
|
|
9
|
+
};
|
package/lib/ui/messages.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.MESSAGES = {
|
|
|
8
8
|
PROJECT_SELECTION_QUESTION: 'Which project would you like to generate to?',
|
|
9
9
|
LIBRARY_PROJECT_SELECTION_QUESTION: 'Which project would you like to add the library to?',
|
|
10
10
|
DRY_RUN_MODE: 'Command has been executed in dry run mode, nothing changed!',
|
|
11
|
-
PROJECT_INFORMATION_START: `${emojis_1.EMOJIS.SPARKLES}
|
|
11
|
+
PROJECT_INFORMATION_START: `${emojis_1.EMOJIS.SPARKLES} We will scaffold your app in a few seconds..`,
|
|
12
12
|
RUNNER_EXECUTION_ERROR: (command) => `\nFailed to execute command: ${command}`,
|
|
13
13
|
PACKAGE_MANAGER_QUESTION: `Which package manager would you ${emojis_1.EMOJIS.HEART} to use?`,
|
|
14
14
|
PACKAGE_MANAGER_INSTALLATION_IN_PROGRESS: `Installation in progress... ${emojis_1.EMOJIS.COFFEE}`,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Answers } from 'inquirer';
|
|
2
1
|
import { Input } from '../../commands';
|
|
3
2
|
import { Configuration, ProjectConfiguration } from '../configuration';
|
|
4
3
|
export declare function shouldAskForProject(schematic: string, configurationProjects: {
|
|
@@ -7,6 +6,6 @@ export declare function shouldAskForProject(schematic: string, configurationProj
|
|
|
7
6
|
export declare function shouldGenerateSpec(configuration: Required<Configuration>, schematic: string, appName: string, specValue: boolean, specPassedAsInput?: boolean): any;
|
|
8
7
|
export declare function shouldGenerateFlat(configuration: Required<Configuration>, appName: string, flatValue: boolean): boolean;
|
|
9
8
|
export declare function getSpecFileSuffix(configuration: Required<Configuration>, appName: string, specFileSuffixValue: string): string;
|
|
10
|
-
export declare function askForProjectName(promptQuestion: string, projects: string[]): Promise<
|
|
9
|
+
export declare function askForProjectName(promptQuestion: string, projects: string[]): Promise<string | void>;
|
|
11
10
|
export declare function moveDefaultProjectToStart(configuration: Configuration, defaultProjectName: string, defaultLabel: string): string[];
|
|
12
11
|
export declare function hasValidOptionFlag(queriedOptionName: string, options: Input[], queriedValue?: string | number | boolean): boolean;
|
|
@@ -67,8 +67,8 @@ function getSpecFileSuffix(configuration, appName, specFileSuffixValue) {
|
|
|
67
67
|
return specFileSuffixValue;
|
|
68
68
|
}
|
|
69
69
|
async function askForProjectName(promptQuestion, projects) {
|
|
70
|
-
const
|
|
71
|
-
return (0, prompts_1.select)(
|
|
70
|
+
const projectNameSelect = (0, questions_1.generateSelect)('appName')(promptQuestion)(projects);
|
|
71
|
+
return (0, prompts_1.select)(projectNameSelect).catch(gracefully_exit_on_prompt_error_1.gracefullyExitOnPromptError);
|
|
72
72
|
}
|
|
73
73
|
function moveDefaultProjectToStart(configuration, defaultProjectName, defaultLabel) {
|
|
74
74
|
let projects = configuration.projects != null ? Object.keys(configuration.projects) : [];
|