From 67417465ad56707f77f072767ab36825b441d0c4 Mon Sep 17 00:00:00 2001 From: plamen5kov Date: Fri, 25 Nov 2016 10:26:23 +0200 Subject: [PATCH] fixed installed module name when uninstalling module --- lib/services/project-service.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/services/project-service.ts b/lib/services/project-service.ts index 472c3ba003..e8d91b427b 100644 --- a/lib/services/project-service.ts +++ b/lib/services/project-service.ts @@ -66,9 +66,11 @@ export class ProjectService implements IProjectService { this.$logger.trace("Copying custom app into %s", projectAppDirectory); appPath = customAppPath; } else { - let defaultTemplatePath = this.$projectTemplatesService.prepareTemplate(selectedTemplate, projectDir).wait(); - this.$logger.trace(`Copying application from '${defaultTemplatePath}' into '${projectAppDirectory}'.`); - appPath = defaultTemplatePath; + let templatePath = this.$projectTemplatesService.prepareTemplate(selectedTemplate, projectDir).wait(); + this.$logger.trace(`Copying application from '${templatePath}' into '${projectAppDirectory}'.`); + let templatePackageJson = this.$fs.readJson(path.join(templatePath, "package.json")).wait(); + selectedTemplate = templatePackageJson.name; + appPath = templatePath; } try { @@ -78,7 +80,7 @@ export class ProjectService implements IProjectService { this.$npm.install(projectDir, projectDir, { "ignore-scripts": this.$options.ignoreScripts }).wait(); selectedTemplate = selectedTemplate || ""; let templateName = (constants.RESERVED_TEMPLATE_NAMES[selectedTemplate.toLowerCase()] || selectedTemplate/*user template*/) || constants.RESERVED_TEMPLATE_NAMES["default"]; - this.$npm.uninstall(templateName, {save: true}, projectDir).wait(); + this.$npm.uninstall(selectedTemplate, {save: true}, projectDir).wait(); // TODO: plamen5kov: remove later (put only so tests pass (need to fix tests)) this.$logger.trace(`Using NativeScript verified template: ${templateName} with version undefined.`);