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
petebacondarwin wants to merge 2 commits into
angular:masterfrom
petebacondarwin:pr-389
Closed

chore(*): switch from bower to npm for frontend dependencies#390
petebacondarwin wants to merge 2 commits into
angular:masterfrom
petebacondarwin:pr-389

Conversation

@petebacondarwin

Copy link
Copy Markdown
Contributor

A tweak to #389

@googlebot

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Member

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)

Comment thread package.json Outdated
"karma-junit-reporter": "^0.4.1",
"protractor": "^4.0.9"
"protractor": "^4.0.9",
"shelljs": "^0.7.5"

Copy link
Copy Markdown
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
Copy Markdown
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 :-)

Comment thread package.json
"devDependencies": {
"angular-mocks": "^1.5.9",
"bower": "^1.7.7",
"cpx": "^1.5.0",

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread package.json
"update-deps": "npm update",
"postupdate-deps": "bower update",

"postupdate-deps": "npm run copy-libs",

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@gkalpak gkalpak Dec 8, 2016

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown

Is this ready to be merged?

@gkalpak

gkalpak commented Dec 16, 2016

Copy link
Copy Markdown
Member

Not yet (but it's close) 😃

@alexandernst

Copy link
Copy Markdown

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

@Natanagar

Copy link
Copy Markdown

I use your code to create templates in my project, I hope you allow?

Comment thread package.json Outdated
},
"devDependencies": {
"angular-mocks": "^1.5.9",
"bower": "^1.7.7",

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

I guess we should switch it to yarn not npm?

@gkalpak

gkalpak commented Oct 13, 2017

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor Author

I have tweaked and squashed. PTAL

Comment thread package.json
"postupdate-deps": "bower update",

"postupdate-deps": "npm run copy-libs",
"copy-libs": "cpx \"node_modules/{angular,angular-*,html5-boilerplate}/**/*\" app/lib -C",

Copy link
Copy Markdown

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
Copy Markdown
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.

@gkalpak gkalpak left a comment

Copy link
Copy Markdown
Member

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 👍

Comment thread 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

Copy link
Copy Markdown
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).

Comment thread 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
Copy Markdown
Member

Choose a reason for hiding this comment

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

fronted --> frontend

Comment thread e2e-tests/protractor.conf.js Outdated
baseUrl: 'http://localhost:8000/',

framework: 'jasmine',
framework: 'jasmine2',

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

binki commented Aug 31, 2018

Copy link
Copy Markdown

As asked earlier, is this ready now?

@petebacondarwin

Copy link
Copy Markdown
Contributor Author

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

@gkalpak

gkalpak commented Oct 26, 2018

Copy link
Copy Markdown
Member

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