@@ -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