@@ -66,9 +66,11 @@ export class ProjectService implements IProjectService {
66
66
this . $logger . trace ( "Copying custom app into %s" , projectAppDirectory ) ;
67
67
appPath = customAppPath ;
68
68
} 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 ;
72
74
}
73
75
74
76
try {
@@ -78,7 +80,7 @@ export class ProjectService implements IProjectService {
78
80
this . $npm . install ( projectDir , projectDir , { "ignore-scripts" : this . $options . ignoreScripts } ) . wait ( ) ;
79
81
selectedTemplate = selectedTemplate || "" ;
80
82
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 ( ) ;
82
84
83
85
// TODO: plamen5kov: remove later (put only so tests pass (need to fix tests))
84
86
this . $logger . trace ( `Using NativeScript verified template: ${ templateName } with version undefined.` ) ;
0 commit comments