Skip to content

Commit e66da34

Browse files
committed
Revert back to put config in dist/package.json
1 parent 6226644 commit e66da34

File tree

5 files changed

+33
-28
lines changed

5 files changed

+33
-28
lines changed

packages/ember-cli-fastboot/lib/broccoli/fastboot-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports = class FastBootConfig extends Plugin {
3737
} else {
3838
this.htmlFile = 'index.html';
3939
}
40-
40+
4141
this.prepareConfig();
4242
this.prepareDependencies();
4343
}

packages/fastboot/src/html-entrypoint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { JSDOM } = require('jsdom');
44
const fs = require('fs');
55
const path = require('path');
66

7-
function htmlEntrypoint(appName, distPath, htmlPath, config) {
7+
function htmlEntrypoint(appName, distPath, htmlPath, config = {}) {
88
let html = fs.readFileSync(path.join(distPath, htmlPath), 'utf8');
99
let dom = new JSDOM(html);
1010
let scripts = [];

packages/fastboot/test/fixtures/html-entrypoint/package.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,30 @@
44
"fastboot": {
55
"schemaVersion": 5,
66
"moduleWhitelist": [],
7-
"htmlEntrypoint": "index.html"
7+
"htmlEntrypoint": "index.html",
8+
"config": {
9+
"fastboot-test": {
10+
"modulePrefix": "fastboot-test",
11+
"environment": "development",
12+
"rootURL": "/",
13+
"locationType": "auto",
14+
"EmberENV": {
15+
"FEATURES": {},
16+
"EXTEND_PROTOTYPES": {
17+
"Date": false
18+
},
19+
"_APPLICATION_TEMPLATE_WRAPPER": false,
20+
"_DEFAULT_ASYNC_OBSERVERS": true,
21+
"_JQUERY_INTEGRATION": false,
22+
"_TEMPLATE_ONLY_GLIMMER_COMPONENTS": true
23+
},
24+
"APP": {
25+
"name": "fastboot-test",
26+
"version": "0.0.0+e168a770",
27+
"autoboot": false
28+
},
29+
"exportApplicationGlobal": true
30+
}
31+
}
832
}
933
}

packages/fastboot/test/fixtures/onerror-per-visit/assets/onerror-per-visit.js

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/fastboot/test/html-entrypoint-test.js

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -219,36 +219,18 @@ describe('htmlEntrypoint', function() {
219219
expect(scripts).to.deep.equal([]);
220220
});
221221

222-
it('extracts configs from meta', function() {
223-
let tmpobj = tmp.dirSync();
224-
let tmpLocation = tmpobj.name;
225-
226-
let project = {
227-
'index.html': `
228-
<html>
229-
<meta name="my-app/config/environment" content="%7B%22rootURL%22%3A%22%2Fcustom-root-url%2F%22%7D" >
230-
<body>
231-
<script src="/custom-root-url/bar.js"></script>
232-
</body>
233-
</html>
234-
`,
235-
};
236-
237-
fixturify.writeSync(tmpLocation, project);
238-
let { config } = htmlEntrypoint('my-app', tmpLocation, 'index.html');
239-
expect(config).to.deep.equal({
240-
'my-app': { APP: { autoboot: false }, rootURL: '/custom-root-url/' },
241-
});
242-
});
243-
244222
it('understands customized rootURL', function() {
245223
let tmpobj = tmp.dirSync();
246224
let tmpLocation = tmpobj.name;
225+
let config = {
226+
'my-app': {
227+
rootURL: '/custom-root-url/',
228+
},
229+
};
247230

248231
let project = {
249232
'index.html': `
250233
<html>
251-
<meta name="my-app/config/environment" content="%7B%22rootURL%22%3A%22%2Fcustom-root-url%2F%22%7D" >
252234
<body>
253235
<script src="/custom-root-url/bar.js"></script>
254236
</body>
@@ -258,7 +240,7 @@ describe('htmlEntrypoint', function() {
258240

259241
fixturify.writeSync(tmpLocation, project);
260242

261-
let { scripts } = htmlEntrypoint('my-app', tmpLocation, 'index.html');
243+
let { scripts } = htmlEntrypoint('my-app', tmpLocation, 'index.html', config);
262244
expect(scripts).to.deep.equal([`${tmpLocation}/bar.js`]);
263245
});
264246
});

0 commit comments

Comments
 (0)