From a1c9dc8a4becb180a429e4a0e953980d48375ed9 Mon Sep 17 00:00:00 2001 From: DimitarTachev Date: Tue, 6 Nov 2018 14:23:17 +0200 Subject: [PATCH] fix: use the specified template version while extracting its package --- lib/services/project-service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/services/project-service.ts b/lib/services/project-service.ts index dad691ebf2..900e034ea7 100644 --- a/lib/services/project-service.ts +++ b/lib/services/project-service.ts @@ -21,7 +21,7 @@ export class ProjectService implements IProjectService { private $staticConfig: IStaticConfig, private $npmInstallationManager: INpmInstallationManager) { } - public async validateProjectName(opts: { projectName: string, force: boolean, pathToProject: string }) : Promise { + public async validateProjectName(opts: { projectName: string, force: boolean, pathToProject: string }): Promise { let projectName = opts.projectName; if (!projectName) { this.$errors.fail("You must specify when creating a new project."); @@ -133,7 +133,8 @@ export class ProjectService implements IProjectService { shelljs.cp('-R', path.join(templateData.templatePath, "*"), destinationDirectory); break; case constants.TemplateVersions.v2: - await this.$pacoteService.extractPackage(templateData.templateName, projectDir); + const fullTemplateName = templateData.version ? `${templateData.templateName}@${templateData.version}` : templateData.templateName; + await this.$pacoteService.extractPackage(fullTemplateName, projectDir); break; default: this.$errors.failWithoutHelp(format(constants.ProjectTemplateErrors.InvalidTemplateVersionStringFormat, templateData.templateName, templateData.templateVersion));