File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed
conditional-files/no-compat/app/config Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ < % if ( notMinimal ) { % >
2+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3+ // @ts -expect-error
4+ import { getGlobalConfig } from '@embroider/macros/src/addon/runtime' ;
5+ < % } % >
6+
7+ interface Config {
8+ isTesting ?: boolean ;
9+ environment : string ;
10+ modulePrefix : string ;
11+ podModulePrefix ?: string ;
12+ locationType : 'history' | 'hash' | 'none' | 'auto' ;
13+ rootURL : string ;
14+ EmberENV ?: Record < string , unknown > ;
15+ APP : Record < string , unknown > & { rootElement ?: string ; autoboot ?: boolean } ;
16+ }
17+
18+ const ENV : Config = {
19+ modulePrefix : '<%= name %>' ,
20+ environment : import . meta. env . DEV ? 'development' : 'production' ,
21+ rootURL : '/' ,
22+ locationType : 'history' ,
23+ EmberENV : { } ,
24+ APP : { } ,
25+ } ;
26+
27+ export default ENV ;
28+
29+ < % if ( notMinimal ) { % >
30+ export function enterTestMode ( ) {
31+ ENV . locationType = 'none' ;
32+ ENV . APP . rootElement = '#ember-testing' ;
33+ ENV . APP . autoboot = false ;
34+
35+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
36+ const config = getGlobalConfig ( ) [ '@embroider/macros' ] ;
37+
38+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
39+ if ( config ) config . isTesting = true ;
40+ }
41+ < % } % >
Original file line number Diff line number Diff line change @@ -24,6 +24,19 @@ function stringifyAndNormalize(contents) {
2424 * (see `conditional-files`)
2525 */
2626const replacers = {
27+ 'app/config/environment.ts' ( locals , contents ) {
28+ if ( locals . noCompat ) {
29+ let filePath = join (
30+ CONDITIONAL_FILES ,
31+ 'no-compat' ,
32+ 'app/config/environment.ts' ,
33+ ) ;
34+ let raw = readFileSync ( filePath ) . toString ( ) ;
35+ return ejs . render ( raw , locals ) ;
36+ }
37+
38+ return contents ;
39+ } ,
2740 'package.json' ( ...args ) {
2841 return this . updatePackageJson ( ...args ) ;
2942 } ,
You can’t perform that action at this time.
0 commit comments