-
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
Set bowerDirectory for project #2287
Conversation
mind adding a quick test |
Sure. |
@stefanpenner done. |
Not sure here. Seems like we should just put the logic to determine the default bowerDirectory into the project.... |
My concern is that if we only add it to the project in the broccoli build, many many other hooks do not have access to it. I generally do not like having the same model (project) that has inconsistent properties. |
@rwjblue do you think that |
@rwjblue I will close this PR and move bowerDirectory logic inside project, then set it for the app when in app's constructor, are you OK with that? |
@quaertym - The changes sound good, but you do not need to close the PR. You can just amend your current commit and force push. |
@rwjblue @stefanpenner Can you guys review this?
|
@@ -19,6 +19,13 @@ function Project(root, pkg) { | |||
this.pkg = pkg; | |||
this.addonPackages = {}; | |||
this.liveReloadFilterPatterns = []; | |||
|
|||
var bowerrcPath = path.join(this.root, '.bowerrc'); |
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.
Can you move this into a function (perhaps setupBowerDirectory
or something) that is called from here instead of inlining it?
@quaertym - Looking good, we will also need some unit tests for this. |
4f8722f
to
a5798b7
Compare
@rwjblue Tests are in. I think it is good to merge. |
@rwjblue @stefanpenner Can you merge this? Travis is happy, appveyor is not. |
@@ -14,11 +14,21 @@ var forOwn = require('lodash-node/modern/objects/forOwn'); | |||
|
|||
var emberCLIVersion = require('../utilities/ember-cli-version'); | |||
|
|||
Project.prototype.setupBowerDirectory = function() { |
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.
While it is perfectly valid to put this method above the constructor, it is odd. Can you move it below?
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.
Tests do not run when it is below.
I'd like to see a few more project unit tests for the following scenarios:
You can use fixtures to setup the project under test with a custom root with the needed files from above. |
Will the bower directory be made available within the Brocfile so you can app.import your bower components from whatever path has been configured? It would also allow addons to do imports for you without making assumptions unless you already have this figured out. |
@ahacking You can still access it using |
Sweet! I just read another issue with someone using an old version of ember CLI and they were importing using an assumed location so I wasn't sure if the bower directory was available or not. This is good, I'm wondering if there would be value in say a bowerImport helper to save some string munging in our Brocfiles? |
Not in this PR, but I liked the idea. It can transform the code from this:
to this:
|
@rwjblue Can you review this PR one more time? |
Set bowerDirectory for project
Beautiful!! Thanks @quaertym! |
I'd say probably not. I do not want more public API for importing things ( Rules seem simple (we can publish them on the website or something), but here you go:
|
I need this for this addon https://github.com/quaertym/ember-cli-dependency-checker, but might be useful in other places. Project can know its bowerDirectory, right?