Skip to content

Commit

Permalink
Prevent setting up watchers on moment timezone and momentjs node paths
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmit committed Jun 27, 2017
1 parent 3186959 commit ad0b8cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 8 additions & 6 deletions index.js
@@ -1,6 +1,7 @@
/* globals require, module, process, __dirname */
'use strict';

const UnwatchedDir = require('broccoli-source').UnwatchedDir;
const mergeTrees = require('broccoli-merge-trees');
const defaults = require('lodash.defaults');
const funnel = require('broccoli-funnel');
Expand Down Expand Up @@ -140,7 +141,7 @@ module.exports = {

if (options.localeOutputPath) {
trees.push(
funnel(options.momentPath, {
funnel(new UnwatchedDir(options.momentPath), {
srcDir: 'locale',
destDir: options.localeOutputPath
})
Expand Down Expand Up @@ -184,15 +185,15 @@ module.exports = {
}

trees.push(
funnel(options.momentPath, {
funnel(new UnwatchedDir(options.momentPath), {
destDir: 'moment',
include: [new RegExp(/\.js$/)],
exclude: ['tests', 'ender', 'package'].map(key => new RegExp(key + '\.js$'))
})
);

if (Array.isArray(options.includeLocales) && options.includeLocales.length) {
let localeTree = funnel(options.momentPath, {
let localeTree = funnel(new UnwatchedDir(options.momentPath), {
srcDir: 'locale',
destDir: 'moment/locales',
include: options.includeLocales.map(locale => new RegExp(locale + '.js$'))
Expand All @@ -202,7 +203,6 @@ module.exports = {
}

if (options.includeTimezone) {
let momentTimezonePath = path.dirname(require.resolve('moment-timezone'));
let timezonePath;
let timezoneMinPath;

Expand Down Expand Up @@ -233,16 +233,18 @@ module.exports = {
);
}

const timezoneDir = new UnwatchedDir(path.dirname(require.resolve('moment-timezone')));

trees.push(
rename(
funnel(momentTimezonePath, { include: [timezonePath] }),
funnel(timezoneDir, { include: [timezonePath] }),
() => 'moment-timezone/tz.js'
)
);

trees.push(
rename(
funnel(momentTimezonePath, { include: [timezoneMinPath] }),
funnel(timezoneDir, { include: [timezoneMinPath] }),
() => 'moment-timezone/tz.min.js'
)
);
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -29,6 +29,7 @@
"dependencies": {
"broccoli-funnel": "^1.1.0",
"broccoli-merge-trees": "^2.0.0",
"broccoli-source": "^1.1.0",
"broccoli-stew": "^1.4.0",
"chalk": "^1.1.3",
"ember-cli-babel": "^5.1.7",
Expand Down

0 comments on commit ad0b8cf

Please sign in to comment.