-
Notifications
You must be signed in to change notification settings - Fork 6.9k
chore(*): switch from bower to npm for frontend dependencies
#390
Conversation
|
We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm. |
gkalpak
left a comment
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.
This copies a little more than necessary, but this was the case with bower as well.
LGTM (with a couple of comments addressed)
package.json
Outdated
| "karma-junit-reporter": "^0.4.1", | ||
| "protractor": "^4.0.9" | ||
| "protractor": "^4.0.9", | ||
| "shelljs": "^0.7.5" |
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.
Do we need shelljs any more?
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.
no - you're right :-)
| "devDependencies": { | ||
| "angular-mocks": "^1.5.9", | ||
| "bower": "^1.7.7", | ||
| "cpx": "^1.5.0", |
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.
I still consider this a non-dev dependency. We rely on it to copy the files to app/lib/ even in "production". Alternatively, we could add app/lib/ to the repository (but I am not a big fan of that 😃).
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.
I guess it comes down to what you mean by "production". In my view, the production stuff is what will be deployed to the web server. To be honest, since we are not using npm to do the deployment, it is irrelevant. I would be happy to move everything into either dependencies or devDependencies but I feel that putting the angular libraries (and the html5-boilerplate) into the dependencies, it is signalling to the developer what will eventually end up as part of the actually deployed application.
| "update-deps": "npm update", | ||
| "postupdate-deps": "bower update", | ||
|
|
||
| "postupdate-deps": "npm run copy-libs", |
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.
I wondered if we really need update-deps...
Can we not just have a postupdate hook that copies the libs?
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.
npm does not run postupdate after npm update. From reading this, I would expect it run postinstall (after it runs npm install under the hood), but it doesn't.
Another idea is to recommend using npm install even for updating in README.md.
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.
I think postinstall only runs when a module is being installed as a dependency, rather than when one is installing the dependencies of the current module.
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.
What I mean is, it does run when I execute npm install, but it doesn't when I execute npm update (which is supposed to run npm install <outdated deps> under the hood) from the exact same project state.
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.
oh right
|
Is this ready to be merged? |
|
Not yet (but it's close) 😃 |
|
How about now? Is it ready? What is missing? |
|
I use your code to create templates in my project, I hope you allow? |
package.json
Outdated
| }, | ||
| "devDependencies": { | ||
| "angular-mocks": "^1.5.9", | ||
| "bower": "^1.7.7", |
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.
This could go now 😃
|
I guess we should switch it to |
|
I don't know. This adds an extra dependency (because |
cfe5b4e to
41d089c
Compare
|
I have tweaked and squashed. PTAL |
| "postupdate-deps": "bower update", | ||
|
|
||
| "postupdate-deps": "npm run copy-libs", | ||
| "copy-libs": "cpx \"node_modules/{angular,angular-*,html5-boilerplate}/**/*\" app/lib -C", |
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.
This seems less than ideal to copy dependencies manually, having to update and maintain this inline script whenever a dependency is added, like bootstrap for instance. Perhaps it would be simpler to just go the route of using a build tool like webpack or brunch?
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.
I think that in any significant project you would end up with some tool like that, but for angular-seed we are trying to keep the complexity and number of tools to the minimum.
gkalpak
left a comment
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.
A couple of minor comments. LGTM otherwise 👍
README.md
Outdated
|
|
||
| Behind the scenes this will also call `bower install`. After that, you should find out that you have | ||
| two new folders in your project. | ||
| Behind the scenes this will also call `npm run copy-libs`, which runs a simple JS script that copies |
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.
Maybe remove the simple JS script part (this is no longer the case).
README.md
Outdated
| Behind the scenes this will also call `bower install`. After that, you should find out that you have | ||
| two new folders in your project. | ||
| Behind the scenes this will also call `npm run copy-libs`, which runs a simple JS script that copies | ||
| the AngularJS files and other fronted dependencies. After that, you should find out that you have two |
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.
fronted --> frontend
e2e-tests/protractor.conf.js
Outdated
| baseUrl: 'http://localhost:8000/', | ||
|
|
||
| framework: 'jasmine', | ||
| framework: 'jasmine2', |
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.
I don't think this is necessary in latest version, but not sure about the version of Protractor we are using here.
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.
you're right. Since Protractor v3 it is the same thing.
41d089c to
a41e802
Compare
|
As asked earlier, is this ready now? |
|
I don't think this is going to land now that we are in LTS mode. |
|
Rolled into #444. |
A tweak to #389