Skip to content

Commit

Permalink
[BUGFIX release] Enable linking ember-source without prod files.
Browse files Browse the repository at this point in the history
Prior to these changes, in order to `npm link ember-source` you must
run a production build of Ember. This is because of the list of files
that we provide to `stew.find` (now `Funnel`) includes `ember.prod.js`
and `ember.min.js`.

This commit does two main things:

* Remove usage of `stew.find` (and therefore remove `broccoli-stew` as a dep).
  It is likely that `stew.find` will be deprecated (stefanpenner/broccoli-stew#122).
* Only provide the list of files that are present to the `Funnel` `files` listing.

Before this change the following would throw an error:

```
git clone [email protected]:emberjs/ember.js.git ember-canary
cd ember-canary
yarn install
./node_modules/.bin/ember build --environment=development
yarn link

cd ..
ember new test-app --yarn
cd test-app
yarn link ember-source
ember s
```

(cherry picked from commit 1a24de8)
  • Loading branch information
rwjblue authored and chadhietala committed Mar 2, 2017
1 parent c0e1e56 commit 974379e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
36 changes: 21 additions & 15 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* jshint node: true */
'use strict';

var fs = require('fs');
var path = require('path');
var resolve = require('resolve');

Expand Down Expand Up @@ -33,7 +35,8 @@ module.exports = {
absolutePaths: absolutePaths,

treeForVendor: function() {
var stew = require('broccoli-stew');
var Funnel = require('broccoli-funnel');
var MergeTrees = require('broccoli-merge-trees');

var jqueryPath;
try {
Expand All @@ -42,26 +45,29 @@ module.exports = {
jqueryPath = path.dirname(require.resolve('jquery/package.json'));
}

var jquery = stew.find(jqueryPath + '/dist', {
var jquery = new Funnel(jqueryPath + '/dist', {
destDir: 'ember/jquery',
files: [ 'jquery.js' ]
});

var ember = stew.find(__dirname + '/dist', {
var emberFiles = [
'ember-runtime.js',
'ember-template-compiler.js',
'ember-testing.js',
'ember.debug.js',
'ember.min.js',
'ember.prod.js'
].filter(function(file) {
var fullPath = path.join(__dirname, 'dist', file);

return fs.existsSync(fullPath);
});

var ember = new Funnel(__dirname + '/dist', {
destDir: 'ember',
files: [
'ember-runtime.js',
'ember-template-compiler.js',
'ember-testing.js',
'ember.debug.js',
'ember.min.js',
'ember.prod.js'
]
files: emberFiles
});

return stew.find([
ember,
jquery
]);
return new MergeTrees([ember, jquery]);
}
};
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"test:testem": "testem -f testem.dist.json"
},
"dependencies": {
"broccoli-stew": "^1.2.0",
"broccoli-funnel": "^1.0.6",
"broccoli-merge-trees": "^1.1.4",
"ember-cli-get-component-path-option": "^1.0.0",
"ember-cli-normalize-entity-name": "^1.0.0",
"ember-cli-path-utils": "^1.0.0",
Expand All @@ -53,8 +54,6 @@
"babel-plugin-filter-imports": "~0.2.0",
"backburner.js": "^0.3.1",
"bower": "~1.7.7",
"broccoli-funnel": "^1.0.6",
"broccoli-merge-trees": "^1.1.4",
"broccoli-rollup": "^1.0.3",
"broccoli-string-replace": "^0.1.1",
"broccoli-uglify-sourcemap": "^1.4.2",
Expand Down

0 comments on commit 974379e

Please sign in to comment.