Skip to content

Commit

Permalink
Update build system for ember-resolver from NPM.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed Nov 4, 2015
1 parent 5d08533 commit 3fc82f0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/services/ember-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ function contentForAppBoot (content, config) {
// doesn't recognize them properly...
var monkeyPatchModules = [
'ember',
'ember/load-initializers'
'ember/load-initializers',
'ember-resolver/resolver'
];

if ("ember-data" in config.dependencies) {
Expand Down
22 changes: 20 additions & 2 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = function() {
var concat = require('broccoli-concat');
var mergeTrees = require('broccoli-merge-trees');
var pickFiles = require('broccoli-static-compiler');
var babelTranspiler = require('broccoli-babel-transpiler');
var env = EmberApp.env();
var isProductionLikeBuild = ['production', 'staging'].indexOf(env) > -1;
var prepend = null;
Expand Down Expand Up @@ -58,12 +59,23 @@ module.exports = function() {
destDir: '/assets'
});

var twiddleVendorTree = concat(funnel('bower_components'),{
var bowerTree = funnel('bower_components');
var baseResolverTree = funnel('node_modules/ember-resolver/addon', {
destDir: 'ember-resolver'
});

var transpiledResolverTree = babelTranspiler(baseResolverTree, {
loose: true,
moduleIds: true,
modules: 'amdStrict'
});

var twiddleVendorTree = concat(mergeTrees([bowerTree, transpiledResolverTree]), {
inputFiles: [
'loader.js/loader.js',
'ember-resolver/dist/modules/ember-resolver.js',
'ember-cli-shims/app-shims.js',
'ember-load-initializers/ember-load-initializers.js',
'ember-resolver/**/*.js'
],
outputFile: '/assets/twiddle-deps.js',
});
Expand Down Expand Up @@ -96,6 +108,12 @@ function getEmberCLIBlueprints() {
fileMap[blueprintName] = fs.readFileSync(filePath).toString();
}

// ember-cli 1.13.x uses ember/resolver
fileMap['app'] = fileMap.app.replace('\'ember/resolver\'', '\'ember-resolver/resolver\'');

// ember-cli 2.x uses ember-resolver
fileMap['app'] = fileMap.app.replace('\'ember-resolver\'', '\'ember-resolver/resolver\'');

fileMap['twiddle.json'] = fs.readFileSync('blueprints/twiddle.json').toString();
fileMap['initializers/router'] = fs.readFileSync('blueprints/router_initializer.js').toString();
fileMap['initializers/mouse-events'] = fs.readFileSync('blueprints/mouse_events_initializer.js').toString();
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"license": "MIT",
"devDependencies": {
"broccoli-asset-rev": "^2.1.2",
"broccoli-babel-transpiler": "^5.4.5",
"broccoli-concat": "0.0.13",
"broccoli-funnel": "0.2.8",
"broccoli-merge-trees": "0.2.3",
Expand Down

0 comments on commit 3fc82f0

Please sign in to comment.