Skip to content

chore: update the interactive create descriptions based on the DevRel feedback. #4013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/commands/create-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ export class CreateProjectCommand implements ICommand {
}

private async interactiveFlavorSelection(adverb: string) {
const flavorSelection = await this.$prompter.promptForDetailedChoice(`${adverb}, which flavor would you like to use?`, [
{ key: constants.NgFlavorName, description: "Learn more at https://angular.io/" },
{ key: constants.VueFlavorName, description: "Learn more at https://vuejs.org/" },
{ key: constants.TsFlavorName, description: "Learn more at https://www.typescriptlang.org/" },
{ key: constants.JsFlavorName, description: "Learn more at https://www.javascript.com/" },
const flavorSelection = await this.$prompter.promptForDetailedChoice(`${adverb}, which style of NativeScript project would you like to use:`, [
{ key: constants.NgFlavorName, description: "Learn more at https://nativescript.org/angular" },
{ key: constants.VueFlavorName, description: "Learn more at https://nativescript.org/vue" },
{ key: constants.TsFlavorName, description: "Learn more at https://nativescript.org/typescript" },
{ key: constants.JsFlavorName, description: "Use NativeScript without any framework" },
]);
return flavorSelection;
}
Expand Down Expand Up @@ -130,7 +130,7 @@ or --js flags.)
const templateChoices = selectedFlavorTemplates.map((template) => {
return { key: template.key, description: template.description };
});
const selectedTemplateKey = await this.$prompter.promptForDetailedChoice(`${adverb}, which template would you like to start from?`, templateChoices);
const selectedTemplateKey = await this.$prompter.promptForDetailedChoice(`${adverb}, which template would you like to start from:`, templateChoices);
selectedTemplate = selectedFlavorTemplates.find(t => t.key === selectedTemplateKey).value;
} else {
selectedTemplate = selectedFlavorTemplates[0].value;
Expand Down
2 changes: 1 addition & 1 deletion lib/common/prompter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class Prompter implements IPrompter {
const longestKeyLength = choices.concat().sort(function (a, b) { return b.key.length - a.key.length; })[0].key.length;
const inquirerChoices = choices.map((choice) => {
return {
name: `${_.padEnd(choice.key, longestKeyLength)} ${this.descriptionSeparator} ${choice.description}`,
name: `${_.padEnd(choice.key, longestKeyLength)} ${choice.description ? this.descriptionSeparator : ""} ${choice.description}`,
short: choice.key
};
});
Expand Down
12 changes: 6 additions & 6 deletions test/project-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ let createProjectCalledWithForce: boolean;
let validateProjectCallsCount: number;
const dummyArgs = ["dummyArgsString"];
const expectedFlavorChoices = [
{ key: "Angular", description: "Learn more at https://angular.io/" },
{ key: "Vue.js", description: "Learn more at https://vuejs.org/" },
{ key: "Plain TypeScript", description: "Learn more at https://www.typescriptlang.org/" },
{ key: "Plain JavaScript", description: "Learn more at https://www.javascript.com/" }
{ key: "Angular", description: "Learn more at https://nativescript.org/angular" },
{ key: "Vue.js", description: "Learn more at https://nativescript.org/vue" },
{ key: "Plain TypeScript", description: "Learn more at https://nativescript.org/typescript" },
{ key: "Plain JavaScript", description: "Use NativeScript without any framework" }
];
const expectedTemplateChoices = [
{ key: "Hello World", description: "A Hello World app" },
Expand Down Expand Up @@ -85,12 +85,12 @@ describe("Project commands tests", () => {
answers["First, what will be the name of your app?"] = opts.projectNameAnswer;
}
if (opts.flavorAnswer) {
const flavorQuestion = opts.projectNameAnswer ? "Next" : "First" + ", which flavor would you like to use?";
const flavorQuestion = opts.projectNameAnswer ? "Next" : "First, which style of NativeScript project would you like to use:";
answers[flavorQuestion] = opts.flavorAnswer;
questionChoices[flavorQuestion] = expectedFlavorChoices;
}
if (opts.templateAnswer) {
const templateQuestion = opts.projectNameAnswer ? "Finally" : "Next" + ", which template would you like to start from?";
const templateQuestion = opts.projectNameAnswer ? "Finally" : "Next, which template would you like to start from:";
answers[templateQuestion] = opts.templateAnswer;
questionChoices[templateQuestion] = expectedTemplateChoices;
}
Expand Down