@@ -4,6 +4,7 @@ import * as shelljs from "shelljs";
4
4
import { format } from "util" ;
5
5
import { exported } from "../common/decorators" ;
6
6
import { Hooks , TemplatesV2PackageJsonKeysToRemove } from "../constants" ;
7
+ import * as temp from "temp" ;
7
8
8
9
export class ProjectService implements IProjectService {
9
10
@@ -131,14 +132,16 @@ export class ProjectService implements IProjectService {
131
132
132
133
private async ensureAppResourcesExist ( projectDir : string ) : Promise < void > {
133
134
const projectData = this . $projectDataService . getProjectData ( projectDir ) ;
134
- const appPath = projectData . getAppDirectoryPath ( projectDir ) ;
135
135
const appResourcesDestinationPath = projectData . getAppResourcesDirectoryPath ( projectDir ) ;
136
136
137
137
if ( ! this . $fs . exists ( appResourcesDestinationPath ) ) {
138
138
this . $fs . createDirectory ( appResourcesDestinationPath ) ;
139
-
139
+ const tempDir = temp . mkdirSync ( "ns-default-template" ) ;
140
140
// the template installed doesn't have App_Resources -> get from a default template
141
- await this . $pacoteService . extractPackage ( constants . RESERVED_TEMPLATE_NAMES [ "default" ] , appPath , { filter : ( name : string , entry : any ) => entry . path . indexOf ( constants . APP_RESOURCES_FOLDER_NAME ) !== - 1 } ) ;
141
+ await this . $pacoteService . extractPackage ( constants . RESERVED_TEMPLATE_NAMES [ "default" ] , tempDir ) ;
142
+ const templateProjectData = this . $projectDataService . getProjectData ( tempDir ) ;
143
+ const templateAppResourcesDir = templateProjectData . getAppResourcesDirectoryPath ( tempDir ) ;
144
+ this . $fs . copyFile ( path . join ( templateAppResourcesDir , "*" ) , appResourcesDestinationPath ) ;
142
145
}
143
146
}
144
147
0 commit comments