@@ -133,6 +133,10 @@ export class PlatformService implements IPlatformService {
133
133
frameworkPackageNameData . template = customTemplateOptions . selectedTemplate ;
134
134
}
135
135
this . $projectDataService . setValue ( platformData . frameworkPackageName , frameworkPackageNameData ) ;
136
+ let installedTemplateName = path . basename ( pathToTemplate ) ;
137
+ if ( coreModuleName !== installedTemplateName ) {
138
+ this . $npm . uninstall ( installedTemplateName , { save : true } ) . wait ( ) ;
139
+ }
136
140
137
141
return coreModuleName ;
138
142
@@ -149,7 +153,6 @@ export class PlatformService implements IPlatformService {
149
153
}
150
154
151
155
if ( selectedTemplate ) {
152
- let tempDir = temp . mkdirSync ( "platform-template" ) ;
153
156
try {
154
157
/*
155
158
* Output of npm.install is array of arrays. For example:
@@ -160,8 +163,8 @@ export class PlatformService implements IPlatformService {
160
163
* '..\\..\\..\\android-platform-template' ] ]
161
164
* Project successfully created.
162
165
*/
163
- let pathToTemplate = this . $npm . install ( selectedTemplate , tempDir ) . wait ( ) [ 0 ] ;
164
- return { selectedTemplate, pathToTemplate } ;
166
+ let templateName = this . $npm . install ( selectedTemplate , this . $projectData . projectDir , { save : true } ) . wait ( ) [ 0 ] ;
167
+ return { selectedTemplate, pathToTemplate : path . join ( this . $projectData . projectDir , constants . NODE_MODULES_FOLDER_NAME , templateName ) } ;
165
168
} catch ( err ) {
166
169
this . $logger . trace ( "Error while trying to install specified template: " , err ) ;
167
170
this . $errors . failWithoutHelp ( `Unable to install platform template ${ selectedTemplate } . Make sure the specified value is valid.` ) ;
0 commit comments