@@ -163,7 +163,7 @@ const openAngularEditor = async (code: string, options?: EditorOptions) => {
163
163
}
164
164
165
165
const openReactEditor = async ( code : string , options ?: EditorOptions ) => {
166
- let [ index_tsx , app_tsx , variables_css , ts_config_json , package_json , package_lock_json , index_html ] = await loadSourceFiles ( [
166
+ const defaultFiles = await loadSourceFiles ( [
167
167
'react/index.tsx' ,
168
168
options ?. includeIonContent ? 'react/app.withContent.tsx' : 'react/app.tsx' ,
169
169
'react/variables.css' ,
@@ -173,27 +173,30 @@ const openReactEditor = async (code: string, options?: EditorOptions) => {
173
173
'react/index.html' ,
174
174
] , options . version ) ;
175
175
176
- app_tsx = app_tsx . replace ( '{{ MODE }}' , options ?. mode ) ;
176
+ const appTsx = 'src/App.tsx' ;
177
+ const files = {
178
+ 'public/index.html' : defaultFiles [ 6 ] ,
179
+ 'src/index.tsx' : defaultFiles [ 0 ] ,
180
+ [ appTsx ] : defaultFiles [ 1 ] ,
181
+ 'src/main.tsx' : code ,
182
+ 'src/theme/variables.css' : defaultFiles [ 2 ] ,
183
+ 'tsconfig.json' : defaultFiles [ 3 ] ,
184
+ 'package.json' : defaultFiles [ 4 ] ,
185
+ 'package-lock.json' : defaultFiles [ 5 ] ,
186
+ ...options ?. files ,
187
+ '.stackblitzrc' : `{
188
+ "startCommand": "yarn run start"
189
+ }`
190
+ } ;
191
+
192
+ files [ appTsx ] = files [ appTsx ] . replace ( 'setupIonicReact()' , `setupIonicReact({ mode: '${ options ?. mode } ' })` ) ;
177
193
178
194
sdk . openProject ( {
179
195
template : 'node' ,
180
196
title : options ?. title ?? DEFAULT_EDITOR_TITLE ,
181
197
description : options ?. description ?? DEFAULT_EDITOR_DESCRIPTION ,
182
- files : {
183
- 'public/index.html' : index_html ,
184
- 'src/index.tsx' : index_tsx ,
185
- 'src/App.tsx' : app_tsx ,
186
- 'src/main.tsx' : code ,
187
- 'src/theme/variables.css' : variables_css ,
188
- 'tsconfig.json' : ts_config_json ,
189
- 'package.json' : package_json ,
190
- 'package-lock.json' : package_lock_json ,
191
- ...options ?. files ,
192
- '.stackblitzrc' : `{
193
- "startCommand": "yarn run start"
194
- }`
195
- }
196
- } )
198
+ files
199
+ } ) ;
197
200
}
198
201
199
202
const openVueEditor = async ( code : string , options ?: EditorOptions ) => {
0 commit comments