Skip to content

Commit bc175b6

Browse files
committed
Use conditional-files to clean up the no-compat variance
1 parent 5b97ac9 commit bc175b6

File tree

3 files changed

+36
-18
lines changed

3 files changed

+36
-18
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<% if (warpDrive) { %>import '@warp-drive/ember/install';
2+
import Application from 'ember-strict-application-resolver';
3+
import config from '<%= modulePrefix %>/config/environment';<% if (notMinimal) { %>
4+
import { importSync, isDevelopingApp, macroCondition } from '@embroider/macros';< } %>
5+
import setupInspector from '@embroider/legacy-inspector-support/ember-source-4.12';
6+
7+
<% if (notMinimal) { %>
8+
if (macroCondition(isDevelopingApp())) {
9+
importSync('./deprecation-workflow');
10+
}
11+
<% } %>
12+
13+
14+
export default class App extends Application {
15+
modules = {
16+
...import.meta.glob('./router.*', { eager: true }),
17+
...import.meta.glob('./templates/**/*', { eager: true }),
18+
...import.meta.glob('./services/**/*', { eager: true }),
19+
}
20+
}

files/app/app.ts

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,21 @@
1-
<% if (warpDrive) { %>import '@warp-drive/ember/install';<% } %><% if (compat) { %>
1+
<% if (warpDrive) { %>import '@warp-drive/ember/install';<% } %>
22
import Application from '@ember/application';
33
import compatModules from '@embroider/virtual/compat-modules';
44
import Resolver from 'ember-resolver';
5-
import loadInitializers from 'ember-load-initializers';<% } else { %>
6-
import Application from 'ember-strict-application-resolver';<% } %>
7-
import config from '<%= modulePrefix %>/config/environment';<% if (notMinimal) { %>
8-
import { importSync, isDevelopingApp, macroCondition } from '@embroider/macros';< } %>
5+
import loadInitializers from 'ember-load-initializers';
6+
import config from '<%= modulePrefix %>/config/environment';
7+
import { importSync, isDevelopingApp, macroCondition } from '@embroider/macros';
98
import setupInspector from '@embroider/legacy-inspector-support/ember-source-4.12';
109

11-
<% if (notMinimal) { %>
1210
if (macroCondition(isDevelopingApp())) {
1311
importSync('./deprecation-workflow');
1412
}
15-
<% } %>
16-
1713

1814
export default class App extends Application {
19-
<% if (compat) {%> modulePrefix = config.modulePrefix;
15+
modulePrefix = config.modulePrefix;
2016
podModulePrefix = config.podModulePrefix;
2117
Resolver = Resolver.withModules(compatModules);
22-
<% } %> inspector = setupInspector(this);
23-
<% if (noCompat) { %>
24-
modules = {
25-
...import.meta.glob('./router', { eager: true }),
26-
...import.meta.glob('./templates/**/*', { eager: true }),
27-
}
28-
<% } %>
18+
inspector = setupInspector(this);
2919
}
30-
<% if (compat) { %>
20+
3121
loadInitializers(App, config.modulePrefix, compatModules);
32-
<% } %>

index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ function stringifyAndNormalize(contents) {
2424
* (see `conditional-files`)
2525
*/
2626
const replacers = {
27+
'app/app.ts'(locals, contents) {
28+
if (locals.noCompat) {
29+
let filePath = join(CONDITIONAL_FILES, 'no-compat', 'app/app.ts');
30+
let raw = readFileSync(filePath).toString();
31+
return ejs.render(raw, locals);
32+
}
33+
34+
return contents;
35+
},
2736
'app/config/environment.ts'(locals, contents) {
2837
if (locals.noCompat) {
2938
let filePath = join(

0 commit comments

Comments
 (0)