@@ -30,6 +30,19 @@ export class ProjectConfigService implements IProjectConfigService {
3030 return this . $injector . resolve ( "projectHelper" ) ;
3131 }
3232
33+ public getDefaultTSConfig ( appId : string = "org.nativescript.app" ) {
34+ return `import { NativeScriptConfig } from '@nativescript/core';
35+
36+ export default {
37+ id: '${ appId } ',
38+ appResourcesPath: 'App_Resources',
39+ android: {
40+ v8Flags: '--expose_gc',
41+ markingMode: 'none'
42+ }
43+ } as NativeScriptConfig;` . trim ( ) ;
44+ }
45+
3346 public detectInfo (
3447 projectDir ?: string
3548 ) : {
@@ -104,20 +117,13 @@ export class ProjectConfigService implements IProjectConfigService {
104117 return _ . get ( this . readConfig ( ) , key ) ;
105118 }
106119
107- // TODO: improve to set any value
108- // public setValue(projectDir?: string) {
109- public setAppId ( projectId : string , projectDir ?: string ) {
110- const { hasTS, configJSFilePath, configTSFilePath } = this . detectInfo (
111- projectDir
120+ public writeDefaultConfig ( projectDir : string , appId ?: string ) {
121+ const configTSFilePath = path . join (
122+ projectDir || this . projectHelper . projectDir ,
123+ CONFIG_FILE_NAME_TS
112124 ) ;
113125
114- const configPath = hasTS ? configTSFilePath : configJSFilePath ;
115-
116- const rawSource = this . $fs . readText ( configPath ) ;
117- this . $fs . writeFile (
118- configPath ,
119- rawSource . replace ( `org.nativescript.app` , projectId )
120- ) ;
126+ this . $fs . writeFile ( configTSFilePath , this . getDefaultTSConfig ( appId ) ) ;
121127 }
122128}
123129
0 commit comments