Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

chore(*): switch from bower to npm for frontend dependencies #390

Closed
wants to merge 2 commits into from

Conversation

petebacondarwin
Copy link
Contributor

A tweak to #389

@googlebot
Copy link

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.

Copy link
Member

@gkalpak gkalpak left a 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
"http-server": "^0.9.0",
"jasmine-core": "^2.4.1",
"karma": "^0.13.22",
"karma-chrome-launcher": "^0.2.3",
"karma-firefox-launcher": "^0.1.7",
"karma-jasmine": "^0.3.8",
"karma-junit-reporter": "^0.4.1",
"protractor": "^4.0.9"
"protractor": "^4.0.9",
"shelljs": "^0.7.5"
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no - you're right :-)

package.json Outdated
},
"devDependencies": {
"angular-mocks": "^1.5.9",
"bower": "^1.7.7",
"cpx": "^1.5.0",
Copy link
Member

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 😃).

Copy link
Contributor Author

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",
Copy link
Contributor Author

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?

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

@gkalpak gkalpak Dec 8, 2016

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh right

@alexandernst
Copy link

Is this ready to be merged?

@gkalpak
Copy link
Member

gkalpak commented Dec 16, 2016

Not yet (but it's close) 😃

@alexandernst
Copy link

How about now? Is it ready? What is missing?

@Natanagar
Copy link

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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could go now 😃

@petebacondarwin
Copy link
Contributor Author

I guess we should switch it to yarn not npm?

@gkalpak
Copy link
Member

gkalpak commented Oct 13, 2017

I don't know. This adds an extra dependency (because npm typically comes "bundled" with node). Since this is a seed project, it might be better to be less opinionated.
So, I slightly lean towards npm, but don't feel too strongly about it. (Obviously, either is better than using bower 😁)

@petebacondarwin
Copy link
Contributor Author

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",

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?

Copy link
Contributor Author

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.

Copy link
Member

@gkalpak gkalpak left a 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

```
npm install
```

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
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fronted --> frontend

@@ -13,7 +13,7 @@ exports.config = {

baseUrl: 'http://localhost:8000/',

framework: 'jasmine',
framework: 'jasmine2',
Copy link
Member

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.

Copy link
Contributor Author

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.

@binki
Copy link

binki commented Aug 31, 2018

As asked earlier, is this ready now?

@petebacondarwin
Copy link
Contributor Author

I don't think this is going to land now that we are in LTS mode.

@gkalpak
Copy link
Member

gkalpak commented Oct 26, 2018

Rolled into #444.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants