-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split bower_components into it's own directory #1436
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"directory": "vendor" | ||
"directory": "bower_components" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
# dependencies | ||
/node_modules | ||
/vendor/* | ||
/bower_components/* | ||
|
||
# misc | ||
/.sass-cache | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,57 +78,57 @@ function EmberApp(options) { | |
compress: true | ||
} | ||
}, | ||
loader: 'vendor/loader/loader.js', | ||
loader: 'bower_components/loader/loader.js', | ||
trees: {}, | ||
jshintrc: {}, | ||
getEnvJSON: this.project.require(options.environment || './config/environment'), | ||
vendorFiles: {} | ||
}, defaults); | ||
|
||
this.vendorFiles = merge(options.vendorFiles, { | ||
'loader.js': 'vendor/loader/loader.js', | ||
'jquery.js': 'vendor/jquery/dist/jquery.js', | ||
'loader.js': 'bower_components/loader/loader.js', | ||
'jquery.js': 'bower_components/jquery/dist/jquery.js', | ||
'handlebars.js': { | ||
development: 'vendor/handlebars/handlebars.js', | ||
production: 'vendor/handlebars/handlebars.runtime.js' | ||
development: 'bower_components/handlebars/handlebars.js', | ||
production: 'bower_components/handlebars/handlebars.runtime.js' | ||
}, | ||
'ember.js': { | ||
development: 'vendor/ember/ember.js', | ||
production: 'vendor/ember/ember.prod.js' | ||
development: 'bower_components/ember/ember.js', | ||
production: 'bower_components/ember/ember.prod.js' | ||
}, | ||
'app-shims.js': [ | ||
'vendor/ember-cli-shims/app-shims.js', { | ||
'bower_components/ember-cli-shims/app-shims.js', { | ||
exports: { | ||
ember: ['default'] | ||
} | ||
} | ||
], | ||
'ember-resolver.js': [ | ||
'vendor/ember-resolver/dist/modules/ember-resolver.js', { | ||
'bower_components/ember-resolver/dist/modules/ember-resolver.js', { | ||
exports: { | ||
'ember/resolver': ['default'] | ||
} | ||
} | ||
], | ||
'ember-load-initializers.js': [ | ||
'vendor/ember-load-initializers/ember-load-initializers.js', { | ||
'bower_components/ember-load-initializers/ember-load-initializers.js', { | ||
exports: { | ||
'ember/load-initializers': ['default'] | ||
} | ||
} | ||
], | ||
'qunit.js' : [ | ||
'vendor/qunit/qunit/qunit.js', { | ||
'bower_components/qunit/qunit/qunit.js', { | ||
type: 'test ' | ||
} | ||
], | ||
'qunit.css': [ | ||
'vendor/qunit/qunit/qunit.css', { | ||
'bower_components/qunit/qunit/qunit.css', { | ||
type: 'test' | ||
} | ||
], | ||
'qunit-notifications.js': [ | ||
'vendor/qunit-notifications/index.js', { | ||
'bower_components/qunit-notifications/index.js', { | ||
type: 'test' | ||
} | ||
] | ||
|
@@ -142,8 +142,8 @@ function EmberApp(options) { | |
styles: unwatchedTree('app/styles'), | ||
templates: unwatchedTree('app/templates'), | ||
|
||
// do not watch vendor/ by default | ||
vendor: unwatchedTree('vendor'), | ||
// do not watch vendor/ or bower_components/ by default | ||
vendor: mergeTrees([unwatchedTree('vendor'), unwatchedTree('bower_components')]), | ||
}, defaults); | ||
|
||
this.options.jshintrc = merge(this.options.jshintrc, { | ||
|
@@ -389,7 +389,7 @@ EmberApp.prototype.javascript = memoize(function() { | |
var legacyFilesToAppend = this.legacyFilesToAppend; | ||
|
||
if (this.tests) { | ||
this.import('vendor/ember-qunit/dist/named-amd/main.js', { | ||
this.import('bower_components/ember-qunit/dist/named-amd/main.js', { | ||
exports: { | ||
'ember-qunit': [ | ||
'globalize', | ||
|
@@ -402,7 +402,7 @@ EmberApp.prototype.javascript = memoize(function() { | |
} | ||
}); | ||
|
||
this.import('vendor/ember-cli-shims/test-shims.js', { | ||
this.import('bower_components/ember-cli-shims/test-shims.js', { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above comment. |
||
exports: { | ||
'qunit': ['default'] | ||
} | ||
|
@@ -553,6 +553,8 @@ EmberApp.prototype.import = function(asset, options) { | |
return; | ||
} | ||
|
||
assetPath = assetPath.replace(/^bower_components\//, 'vendor/'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is what makes my above statement a non-issue here (because you are just replacing I suppose it makes sense to instruct folks to use "bower_components/foo-bar/baz.js" when the file is actually in that directory (it is easier to reason about that way) even though in reality at this stage of processing things have already been consolidated into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly my thinking 👍 |
||
|
||
if (assetPath.split('/').length < 2) { | ||
console.log(chalk.red('Using `app.import` with a file in the root of `vendor/` causes a significant performance penalty. Please move `'+ assetPath + '` into a subdirectory.')); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are merging
bower_components
andvendor
into thevendor
tree (in our constructor), then moving thevendor
tree into avendor/
destDir (in _processedVendorTree). So at this point shouldn't this still bevendor
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rwjblue It's kind of personal preference. Either one actually works fine. Though semantically I figured bower_components makes more sense as that's the actual location of the file on disk.