Skip to content

Commit

Permalink
move to embroider-safe implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Oct 18, 2021
1 parent 9ac0edb commit 7343459
Show file tree
Hide file tree
Showing 4 changed files with 300 additions and 53 deletions.
3 changes: 3 additions & 0 deletions addon/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { getOwnConfig } from '@embroider/macros';

export default getOwnConfig().config;
21 changes: 9 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

var FileCreator = require('broccoli-file-creator');

function findRoot(current) {
var app;

Expand All @@ -19,17 +17,16 @@ function findRoot(current) {
}

module.exports = {
name: require('./package').name,
options: {
'@embroider/macros': {
setOwnConfig: {},
},
},

treeForAddon: function () {
var modulePrefix = findRoot(this).project.config(process.env.EMBER_ENV)[
'modulePrefix'
];
var indexTree = new FileCreator(
'index.js',
"export { default } from '" + modulePrefix + "/config/environment';"
);
name: require('./package').name,

return this._super.treeForAddon.call(this, indexTree);
included(parent) {
this._super.included.apply(this, arguments);
this.options['@embroider/macros'].setOwnConfig.config = findRoot(this).project.config(process.env.EMBER_ENV)
},
};
Loading

0 comments on commit 7343459

Please sign in to comment.