Skip to content
This repository has been archived by the owner on Dec 24, 2018. It is now read-only.

Prevent ember-cli watcher being assigned to node_modules #62

Merged
merged 3 commits into from
Aug 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ You can supply a tree if you want finer control:
// ember-cli-build.js

var Funnel = require('broccoli-funnel');

var UnwatchedDir = require('broccoli-source').UnwatchedDir;
// ...

var app = new EmberApp(defaults, {
nodeModulesToVendor: [
new Funnel('node_modules/some-package/dist/js', {
/* UnwatchedDir is optional, but it is rare to need a watcher assigned to a node_modules dependencies */
new Funnel(new UnwatchedDir('node_modules/some-package/dist/js'), {
destDir: 'some-package',
files: ['only-this-file.js']
})
Expand Down
Empty file removed addon/.gitkeep
Empty file.
Empty file removed app/.gitkeep
Empty file.
11 changes: 10 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,26 @@
'use strict';

const mergeTrees = require('broccoli-merge-trees');
const UnwatchedDir = require('broccoli-source').UnwatchedDir;

module.exports = {
name: 'ember-cli-node-modules-to-vendor',

included(app) {
this._super.included.apply(this, arguments);
this.app = app;
},

treeForVendor() {
let app = this.app;
let nodeModulesToVendor = app.options.nodeModulesToVendor || [];
return mergeTrees(nodeModulesToVendor);

return mergeTrees(nodeModulesToVendor.map(function(asset) {
if (typeof asset === 'string') {
return new UnwatchedDir(asset);
}

return asset;
}));
}
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"mocha": "cross-env DEBUG=ember-cli-addon-tests mocha"
},
"dependencies": {
"broccoli-merge-trees": "^2.0.0"
"broccoli-merge-trees": "^2.0.0",
"broccoli-source": "^1.1.0"
},
"devDependencies": {
"broccoli-funnel": "^1.0.0",
Expand Down