Skip to content

Commit 3f32bb9

Browse files
refactor(schematics): derive the empty-features warning from the prompt message
The empty-features warning duplicated the checkbox prompt's message as a second string literal, so a reworded prompt would leave the warning pointing at text the user never sees. Export the message as a shared constant and reference it in both places, matching the shared-constant pattern used for the firebase-tools version message in 59c8a2f.
1 parent 0027ef2 commit 3f32bb9

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/schematics/setup/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
parseDataConnectConfig,
1717
setupTanstackDependencies,
1818
} from '../utils';
19-
import { appPrompt, featuresPrompt, projectPrompt, userPrompt } from './prompts';
19+
import { appPrompt, featuresPrompt, featuresPromptMessage, projectPrompt, userPrompt } from './prompts';
2020

2121
// FirebaseOptions keys — apps.sdkconfig responses include management-API extras that initializeApp() rejects.
2222
const firebaseOptionsKeys = [
@@ -65,7 +65,7 @@ export const ngAddSetupProject = (
6565
if (features.length === 0) {
6666
context.logger.warn(
6767
'No features were selected, so there is nothing to set up. ' +
68-
'At the "What features would you like to setup?" prompt, use the arrow keys to move, ' +
68+
`At the "${featuresPromptMessage}" prompt, use the arrow keys to move, ` +
6969
'press Space to select each feature you want, then Enter to confirm. ' +
7070
'Re-run ng add @angular/fire to try again.'
7171
);

src/schematics/setup/prompts.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,14 @@ type Prompt = <K extends string, U= unknown>(questions: { name: K, source: (...a
7979
const autocomplete: Prompt = (questions) => inquirer.prompt(questions);
8080

8181

82+
export const featuresPromptMessage = 'What features would you like to setup?';
83+
8284
export const featuresPrompt = async (): Promise<FEATURES[]> => {
8385
const { features } = await inquirer.prompt({
8486
type: 'checkbox',
8587
name: 'features',
8688
choices: featureOptions,
87-
message: 'What features would you like to setup?',
89+
message: featuresPromptMessage,
8890
default: [],
8991
}) as { features: FEATURES[] };
9092
return features;

0 commit comments

Comments
 (0)