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 #389

Closed
wants to merge 2 commits into from

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Dec 7, 2016

This is an alternative to #385.

// Copy lib files
shx.rm('-rf', baseDstDir);

files.forEach(relPath => {
Copy link
Member

Choose a reason for hiding this comment

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

I'd use for-of here but it doesn't really matter. :)

const shx = require('shelljs');

// Copy lib files
shx.rm('-rf', baseDstDir);
Copy link
Member

Choose a reason for hiding this comment

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

If all you need is a cross-platform rm -rf then rimraf.

Copy link
Member Author

Choose a reason for hiding this comment

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

I also need a cross-platform mkdir -p 😃

Copy link
Member

Choose a reason for hiding this comment

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

https://www.npmjs.com/package/mkdirp ;)

But I see your point now.

Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect it would be easier to ditch this file and use https://www.npmjs.com/package/cpx or something similar.

Copy link
Member Author

Choose a reason for hiding this comment

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

Wouldn't we need another pretty long npm script for that?

Copy link
Member

Choose a reason for hiding this comment

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

We could save some space in the part that iterates over files but the biggest part would probably be listing the files so it seems you're right; we wouldn't save that much.

@mgol
Copy link
Member

mgol commented Dec 7, 2016

I have some suggestions but LGTM with or without them.

// Copy lib files
shx.rm('-rf', baseDstDir);

for (let relPath of files) {
Copy link
Member

Choose a reason for hiding this comment

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

const would be better here. :-)

Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

Can we just reuse an existing library to do the copying?

@@ -42,27 +42,27 @@ The `depth=1` tells git to only pull down one commit worth of historical data.
We have two kinds of dependencies in this project: tools and Angular framework code. The tools help
us manage and test the application.

* We get the tools we depend upon via `npm`, the [Node package manager][npm].
* We get the Angular code via `bower`, a [client-side code package manager][bower].
* We get the tools we depend upon and the Angular code via `npm`, the [Node package manager][npm].
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey, I know! Why don't we switch this to yarn :-)

Copy link
Member

Choose a reason for hiding this comment

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

npm is not "Node Package Manager", it's just "npm". The name should be changed.

"angular-loader": "^1.5.9",
"angular-route": "^1.5.9",
"html5-boilerplate": "0.0.1",
"shelljs": "^0.7.5"
Copy link
Contributor

Choose a reason for hiding this comment

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

shelljs is strictly a devDependency

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently it is necessary in production, because we are not committing app/lib/. So it is needed to copy the files to app/lib/ in production as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

We need grunt in the angular 1 project to generate the production distribution but that doesn't stop grunt from being a devDependency. Unless we ship shelljs as part of the application I don't think I would call is a dependency.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, since we copy every frontend asset to app/lib/, nothing here should be a dependency. Were we to publish an npm package from this project it would have included the built app/lib/ and no deps.

Copy link
Contributor

Choose a reason for hiding this comment

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

true :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, not true (afaict). Because app/lib/ is ignored (in .gitignore). In the angular.js repo, it is different, because we have publish script that does all sorts of stuff.

Also, using git for deployment (especially for small to medium apps) is a viable approach (and one I've used several times). It is handy to be able to git pull && npm install --production.

Anyway, I don't feel too strongly about it (although I do think it is better to have them as dependencies).

const shx = require('shelljs');

// Copy lib files
shx.rm('-rf', baseDstDir);
Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect it would be easier to ditch this file and use https://www.npmjs.com/package/cpx or something similar.

@gkalpak
Copy link
Member Author

gkalpak commented Oct 26, 2018

Superceded by #390.

@gkalpak gkalpak closed this Oct 26, 2018
@gkalpak gkalpak deleted the chore-replace-bower-with-npm branch October 26, 2018 14:42
gkalpak added a commit to gkalpak/angular-seed that referenced this pull request Oct 26, 2018
gkalpak added a commit to gkalpak/angular-seed that referenced this pull request Oct 26, 2018
gkalpak added a commit that referenced this pull request Oct 30, 2018
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.

3 participants