Skip to content

feat: vue-ts-template #5453

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
Dec 29, 2020
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
9 changes: 9 additions & 0 deletions lib/commands/create-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export class CreateProjectCommand implements ICommand {
public allowedParameters: ICommandParameter[] = [this.$stringParameter];
private static BlankTemplateKey = "Blank";
private static BlankTemplateDescription = "A blank app";
private static BlankTsTemplateKey = "Blank Typescript";
private static BlankTsTemplateDescription = "A blank typescript app";
private static HelloWorldTemplateKey = "Hello World";
private static HelloWorldTemplateDescription = "A Hello World app";
private static DrawerTemplateKey = "SideDrawer";
Expand Down Expand Up @@ -57,6 +59,8 @@ export class CreateProjectCommand implements ICommand {
let selectedTemplate: string;
if (this.$options.js) {
selectedTemplate = constants.JAVASCRIPT_NAME;
} else if (this.$options.vue && this.$options.tsc) {
selectedTemplate = "@nativescript/template-blank-vue-ts";
} else if (this.$options.tsc) {
selectedTemplate = constants.TYPESCRIPT_NAME;
} else if (this.$options.ng) {
Expand Down Expand Up @@ -315,6 +319,11 @@ can skip this prompt next time using the --template option, or the --ng, --react
value: "@nativescript/template-blank-vue",
description: CreateProjectCommand.BlankTemplateDescription,
},
{
key: CreateProjectCommand.BlankTsTemplateKey,
value: "@nativescript/template-blank-vue-ts",
description: CreateProjectCommand.BlankTsTemplateDescription,
},
{
key: CreateProjectCommand.DrawerTemplateKey,
value: "@nativescript/template-drawer-navigation-vue",
Expand Down
40 changes: 33 additions & 7 deletions test/project-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ const expectedFlavorChoices = [
description: "Use NativeScript without any framework",
},
];
const templateChoises = {
const templateChoices = {
helloWorld: { key: "Hello World", description: "A Hello World app" },
blank: { key: "Blank", description: "A blank app" },
blankTypeScript: {
key: "Blank Typescript",
description: "A blank typescript app",
},
sideDrawer: {
key: "SideDrawer",
description:
Expand All @@ -59,14 +63,15 @@ const templateChoises = {
},
};
const expectedTemplateChoices = [
templateChoises.helloWorld,
templateChoises.sideDrawer,
templateChoises.tabs,
templateChoices.helloWorld,
templateChoices.sideDrawer,
templateChoices.tabs,
];
const expectedTemplateChoicesVue = [
templateChoises.blank,
templateChoises.sideDrawer,
templateChoises.tabs,
templateChoices.blank,
templateChoices.blankTypeScript,
templateChoices.sideDrawer,
templateChoices.tabs,
];

class ProjectServiceMock implements IProjectService {
Expand Down Expand Up @@ -202,6 +207,27 @@ describe("Project commands tests", () => {
assert.isTrue(createProjectCalledWithForce);
});

it("should not fail when using only --vue.", async () => {
options.vue = true;

await createProjectCommand.execute(dummyArgs);

assert.isTrue(isProjectCreated);
assert.equal(validateProjectCallsCount, 1);
assert.isTrue(createProjectCalledWithForce);
});

it("should not fail when using --vue and --tsc.", async () => {
options.vue = true;
options.tsc = true;

await createProjectCommand.execute(dummyArgs);

assert.isTrue(isProjectCreated);
assert.equal(validateProjectCallsCount, 1);
assert.isTrue(createProjectCalledWithForce);
});

it("should not fail when using only --tsc.", async () => {
options.tsc = true;

Expand Down