Skip to content

Commit 8c24da0

Browse files
author
Dimitar Tachev
authored
Merge pull request #4101 from NativeScript/tachev/fix-v2-templates-extraction
fix: use the specified template version while extracting its package
2 parents e601de0 + a1c9dc8 commit 8c24da0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/services/project-service.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class ProjectService implements IProjectService {
2121
private $staticConfig: IStaticConfig,
2222
private $npmInstallationManager: INpmInstallationManager) { }
2323

24-
public async validateProjectName(opts: { projectName: string, force: boolean, pathToProject: string }) : Promise<string> {
24+
public async validateProjectName(opts: { projectName: string, force: boolean, pathToProject: string }): Promise<string> {
2525
let projectName = opts.projectName;
2626
if (!projectName) {
2727
this.$errors.fail("You must specify <App name> when creating a new project.");
@@ -133,7 +133,8 @@ export class ProjectService implements IProjectService {
133133
shelljs.cp('-R', path.join(templateData.templatePath, "*"), destinationDirectory);
134134
break;
135135
case constants.TemplateVersions.v2:
136-
await this.$pacoteService.extractPackage(templateData.templateName, projectDir);
136+
const fullTemplateName = templateData.version ? `${templateData.templateName}@${templateData.version}` : templateData.templateName;
137+
await this.$pacoteService.extractPackage(fullTemplateName, projectDir);
137138
break;
138139
default:
139140
this.$errors.failWithoutHelp(format(constants.ProjectTemplateErrors.InvalidTemplateVersionStringFormat, templateData.templateName, templateData.templateVersion));

0 commit comments

Comments
 (0)