Skip to content

Commit

Permalink
Merge pull request #4101 from NativeScript/tachev/fix-v2-templates-ex…
Browse files Browse the repository at this point in the history
…traction

fix: use the specified template version while extracting its package
  • Loading branch information
Dimitar Tachev authored Nov 6, 2018
2 parents e601de0 + a1c9dc8 commit 8c24da0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/services/project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> {
public async validateProjectName(opts: { projectName: string, force: boolean, pathToProject: string }): Promise<string> {
let projectName = opts.projectName;
if (!projectName) {
this.$errors.fail("You must specify <App name> when creating a new project.");
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 8c24da0

Please sign in to comment.