@@ -4,6 +4,7 @@ import * as shelljs from "shelljs";
44import { format } from "util" ;
55import { exported } from "../common/decorators" ;
66import { Hooks , TemplatesV2PackageJsonKeysToRemove } from "../constants" ;
7+ import * as temp from "temp" ;
78
89export class ProjectService implements IProjectService {
910
@@ -131,14 +132,16 @@ export class ProjectService implements IProjectService {
131132
132133 private async ensureAppResourcesExist ( projectDir : string ) : Promise < void > {
133134 const projectData = this . $projectDataService . getProjectData ( projectDir ) ;
134- const appPath = projectData . getAppDirectoryPath ( projectDir ) ;
135135 const appResourcesDestinationPath = projectData . getAppResourcesDirectoryPath ( projectDir ) ;
136136
137137 if ( ! this . $fs . exists ( appResourcesDestinationPath ) ) {
138138 this . $fs . createDirectory ( appResourcesDestinationPath ) ;
139-
139+ const tempDir = temp . mkdirSync ( "ns-default-template" ) ;
140140 // 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 ) ;
142145 }
143146 }
144147
0 commit comments