From 59cba6d8d5f320c512b358b993a231b2f0c071f0 Mon Sep 17 00:00:00 2001 From: Mike Nichols Date: Tue, 3 Dec 2013 07:11:41 -0700 Subject: [PATCH] added support for inheriting development from parent --- lib/builder.js | 1 + test/builder.js | 13 +++++++++++++ test/fixtures/dev-deps-local/component.json | 13 +++++++++++++ test/fixtures/dev-deps-local/other/component.json | 10 ++++++++++ test/fixtures/dev-deps-local/other/index.js | 1 + 5 files changed, 38 insertions(+) create mode 100644 test/fixtures/dev-deps-local/component.json create mode 100644 test/fixtures/dev-deps-local/other/component.json create mode 100644 test/fixtures/dev-deps-local/other/index.js diff --git a/lib/builder.js b/lib/builder.js index ee899b4..1a8a3e3 100644 --- a/lib/builder.js +++ b/lib/builder.js @@ -130,6 +130,7 @@ Builder.prototype.inherit = function(dep){ dep.prefixUrls(this.urlPrefix); dep.copyAssetsTo(this.assetsDest); dep.globalLookupPaths = this.globalLookupPaths; + if (this.dev) dep.development(true); if (this.sourceUrls) dep.addSourceURLs(); }; diff --git a/test/builder.js b/test/builder.js index 26c30aa..9dcdacc 100644 --- a/test/builder.js +++ b/test/builder.js @@ -323,6 +323,19 @@ describe('Builder', function(){ done(); }) }) + it('should include local dep development dependencies', function(done){ + var builder = new Builder('test/fixtures/dev-deps-local'); + builder.addLookup('test/fixtures'); + builder.addLookup('test/fixtures/dev-deps-local'); + builder.development(); + builder.build(function(err, res){ + if (err) return done(err); + res.js.should.include('component-emitter/index.js'); + res.js.should.include('component-jquery/index.js'); + res.js.should.include('component-dialog/index.js'); + done(); + }) + }) }) describe('.addSourceURLs()', function() { diff --git a/test/fixtures/dev-deps-local/component.json b/test/fixtures/dev-deps-local/component.json new file mode 100644 index 0000000..51bd44b --- /dev/null +++ b/test/fixtures/dev-deps-local/component.json @@ -0,0 +1,13 @@ +{ + "name": "popover", + "description": "popover component", + "dependencies": { + "component/emitter": "*" + }, + "development": { + "component/jquery": "*" + } + ,"local": [ + "other" + ] +} diff --git a/test/fixtures/dev-deps-local/other/component.json b/test/fixtures/dev-deps-local/other/component.json new file mode 100644 index 0000000..c24f7f3 --- /dev/null +++ b/test/fixtures/dev-deps-local/other/component.json @@ -0,0 +1,10 @@ +{ + "name": "other", + "description":"other component", + "development":{ + "component/dialog":"*" + } + ,"scripts":[ + "index.js" + ] +} diff --git a/test/fixtures/dev-deps-local/other/index.js b/test/fixtures/dev-deps-local/other/index.js new file mode 100644 index 0000000..a40bd61 --- /dev/null +++ b/test/fixtures/dev-deps-local/other/index.js @@ -0,0 +1 @@ +module.exports = 'other';