Skip to content

Commit 7cdaed7

Browse files
authored
feat: vue-ts-template (#5453)
1 parent a6b0e3c commit 7cdaed7

File tree

2 files changed

+42
-7
lines changed

2 files changed

+42
-7
lines changed

lib/commands/create-project.ts

+9
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export class CreateProjectCommand implements ICommand {
1212
public allowedParameters: ICommandParameter[] = [this.$stringParameter];
1313
private static BlankTemplateKey = "Blank";
1414
private static BlankTemplateDescription = "A blank app";
15+
private static BlankTsTemplateKey = "Blank Typescript";
16+
private static BlankTsTemplateDescription = "A blank typescript app";
1517
private static HelloWorldTemplateKey = "Hello World";
1618
private static HelloWorldTemplateDescription = "A Hello World app";
1719
private static DrawerTemplateKey = "SideDrawer";
@@ -57,6 +59,8 @@ export class CreateProjectCommand implements ICommand {
5759
let selectedTemplate: string;
5860
if (this.$options.js) {
5961
selectedTemplate = constants.JAVASCRIPT_NAME;
62+
} else if (this.$options.vue && this.$options.tsc) {
63+
selectedTemplate = "@nativescript/template-blank-vue-ts";
6064
} else if (this.$options.tsc) {
6165
selectedTemplate = constants.TYPESCRIPT_NAME;
6266
} else if (this.$options.ng) {
@@ -315,6 +319,11 @@ can skip this prompt next time using the --template option, or the --ng, --react
315319
value: "@nativescript/template-blank-vue",
316320
description: CreateProjectCommand.BlankTemplateDescription,
317321
},
322+
{
323+
key: CreateProjectCommand.BlankTsTemplateKey,
324+
value: "@nativescript/template-blank-vue-ts",
325+
description: CreateProjectCommand.BlankTsTemplateDescription,
326+
},
318327
{
319328
key: CreateProjectCommand.DrawerTemplateKey,
320329
value: "@nativescript/template-drawer-navigation-vue",

test/project-commands.ts

+33-7
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,13 @@ const expectedFlavorChoices = [
4545
description: "Use NativeScript without any framework",
4646
},
4747
];
48-
const templateChoises = {
48+
const templateChoices = {
4949
helloWorld: { key: "Hello World", description: "A Hello World app" },
5050
blank: { key: "Blank", description: "A blank app" },
51+
blankTypeScript: {
52+
key: "Blank Typescript",
53+
description: "A blank typescript app",
54+
},
5155
sideDrawer: {
5256
key: "SideDrawer",
5357
description:
@@ -59,14 +63,15 @@ const templateChoises = {
5963
},
6064
};
6165
const expectedTemplateChoices = [
62-
templateChoises.helloWorld,
63-
templateChoises.sideDrawer,
64-
templateChoises.tabs,
66+
templateChoices.helloWorld,
67+
templateChoices.sideDrawer,
68+
templateChoices.tabs,
6569
];
6670
const expectedTemplateChoicesVue = [
67-
templateChoises.blank,
68-
templateChoises.sideDrawer,
69-
templateChoises.tabs,
71+
templateChoices.blank,
72+
templateChoices.blankTypeScript,
73+
templateChoices.sideDrawer,
74+
templateChoices.tabs,
7075
];
7176

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

210+
it("should not fail when using only --vue.", async () => {
211+
options.vue = true;
212+
213+
await createProjectCommand.execute(dummyArgs);
214+
215+
assert.isTrue(isProjectCreated);
216+
assert.equal(validateProjectCallsCount, 1);
217+
assert.isTrue(createProjectCalledWithForce);
218+
});
219+
220+
it("should not fail when using --vue and --tsc.", async () => {
221+
options.vue = true;
222+
options.tsc = true;
223+
224+
await createProjectCommand.execute(dummyArgs);
225+
226+
assert.isTrue(isProjectCreated);
227+
assert.equal(validateProjectCallsCount, 1);
228+
assert.isTrue(createProjectCalledWithForce);
229+
});
230+
205231
it("should not fail when using only --tsc.", async () => {
206232
options.tsc = true;
207233

0 commit comments

Comments
 (0)