Skip to content

Commit 5d4a438

Browse files
authored
Merge pull request #2259 from NativeScript/plamen5kov/create_template_fix
fixed installed module name when uninstalling module
2 parents 19d24e5 + 6741746 commit 5d4a438

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/services/project-service.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ export class ProjectService implements IProjectService {
6666
this.$logger.trace("Copying custom app into %s", projectAppDirectory);
6767
appPath = customAppPath;
6868
} else {
69-
let defaultTemplatePath = this.$projectTemplatesService.prepareTemplate(selectedTemplate, projectDir).wait();
70-
this.$logger.trace(`Copying application from '${defaultTemplatePath}' into '${projectAppDirectory}'.`);
71-
appPath = defaultTemplatePath;
69+
let templatePath = this.$projectTemplatesService.prepareTemplate(selectedTemplate, projectDir).wait();
70+
this.$logger.trace(`Copying application from '${templatePath}' into '${projectAppDirectory}'.`);
71+
let templatePackageJson = this.$fs.readJson(path.join(templatePath, "package.json")).wait();
72+
selectedTemplate = templatePackageJson.name;
73+
appPath = templatePath;
7274
}
7375

7476
try {
@@ -78,7 +80,7 @@ export class ProjectService implements IProjectService {
7880
this.$npm.install(projectDir, projectDir, { "ignore-scripts": this.$options.ignoreScripts }).wait();
7981
selectedTemplate = selectedTemplate || "";
8082
let templateName = (constants.RESERVED_TEMPLATE_NAMES[selectedTemplate.toLowerCase()] || selectedTemplate/*user template*/) || constants.RESERVED_TEMPLATE_NAMES["default"];
81-
this.$npm.uninstall(templateName, {save: true}, projectDir).wait();
83+
this.$npm.uninstall(selectedTemplate, {save: true}, projectDir).wait();
8284

8385
// TODO: plamen5kov: remove later (put only so tests pass (need to fix tests))
8486
this.$logger.trace(`Using NativeScript verified template: ${templateName} with version undefined.`);

0 commit comments

Comments
 (0)