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

Install yo/bower/grunt-cli dependencies for you. #305

Closed
addyosmani opened this Issue Jun 23, 2013 · 20 comments

Comments

Projects
None yet
7 participants
@addyosmani
Member

addyosmani commented Jun 23, 2013

I'm wondering if there's a reason we couldn't make it so that npm install -g generator-angular etc. installed the yo/grunt-cli/bower deps for you.

e.g

npm install -g yo grunt-cli bower generator-angular
mkdir app
cd app
yo angular

down to

npm install -g generator-angular
mkdir app
cd app
yo angular

From @sindresorhus: We already do that with yo, where bower an grunt-cli are installed automagically. We've just chosen not to document it, since people didn't read the npm requirement and opened ticket complaining. But when thinking about it, having bower and grunt-cli as peerDeps on the generators would make more sense than on yo. since not all generators would need bower or grunt-cli.

The generator have to be installed globally for it to work though since peerDeps will be installed on the same level as the generators.

Note: we used to avoid the mkdir app && cd app step too. Wonder if we should re-explore that as well.

Maybe..

yo angular == scaffold in current directory
yo angular app == scaffold in a new 'app' directory
@SBoudrias

This comment has been minimized.

Show comment
Hide comment
@SBoudrias

SBoudrias Jun 23, 2013

Member

+1! Yeah, good idea!

For the scaffholding, on generator-bbb we let user specify the folder in which the init occurs (it also create the folder if it does not exist).

yo bbb app/

That was rather trivial to add. Maybe it should be added by default to generator-generator so people use it out of the box?

Member

SBoudrias commented Jun 23, 2013

+1! Yeah, good idea!

For the scaffholding, on generator-bbb we let user specify the folder in which the init occurs (it also create the folder if it does not exist).

yo bbb app/

That was rather trivial to add. Maybe it should be added by default to generator-generator so people use it out of the box?

@sindresorhus

This comment has been minimized.

Show comment
Hide comment
@sindresorhus

sindresorhus Jun 23, 2013

Member

Note: we used to avoid the mkdir app && cd app step too. Wonder if we should re-explore that as well.

No, it adds unnecessary bloat and complicates the argument list. There's already a much more explicit system-wide way to do this. Let's not get obsorbed by idiotic comparisons ;)

It's not even that much longer:

mkdir app && cd app && yo angular
vs
yo angular app && cd app

Member

sindresorhus commented Jun 23, 2013

Note: we used to avoid the mkdir app && cd app step too. Wonder if we should re-explore that as well.

No, it adds unnecessary bloat and complicates the argument list. There's already a much more explicit system-wide way to do this. Let's not get obsorbed by idiotic comparisons ;)

It's not even that much longer:

mkdir app && cd app && yo angular
vs
yo angular app && cd app

@ryanflorence

This comment has been minimized.

Show comment
Hide comment
@ryanflorence

ryanflorence Jun 23, 2013

Idiotic comparisons?

Tone it down, please; you assume far to much from a tweet.

You also assume users are as comfortable with the command line as you. It's a very, very scary place for what I assume to be a large portion of the target audience.

There is also precedent with rails new my-app and express my-app for this behavior. My idiotic comparisons have led addy to think more deeply about user experience, which is worth every ounce of "bloat" in my experience.

ryanflorence commented Jun 23, 2013

Idiotic comparisons?

Tone it down, please; you assume far to much from a tweet.

You also assume users are as comfortable with the command line as you. It's a very, very scary place for what I assume to be a large portion of the target audience.

There is also precedent with rails new my-app and express my-app for this behavior. My idiotic comparisons have led addy to think more deeply about user experience, which is worth every ounce of "bloat" in my experience.

@addyosmani

This comment has been minimized.

Show comment
Hide comment
@addyosmani

addyosmani Jun 23, 2013

Member

I know @sindresorhus has seen first hand how this can complicate the argument list :) I personally think however there is a small, but subtle difference between yo angular app vs mkdir app && cd app && yo angular (note: I'm suggesting that we both mkdir and cd for you). We should simplify this if we can.

For my own day to day use I already have 'md' aliased to mkdir -p "$@" && cd "$@", but I don't think this is the case for most users.

Member

addyosmani commented Jun 23, 2013

I know @sindresorhus has seen first hand how this can complicate the argument list :) I personally think however there is a small, but subtle difference between yo angular app vs mkdir app && cd app && yo angular (note: I'm suggesting that we both mkdir and cd for you). We should simplify this if we can.

For my own day to day use I already have 'md' aliased to mkdir -p "$@" && cd "$@", but I don't think this is the case for most users.

@ryanflorence

This comment has been minimized.

Show comment
Hide comment
@ryanflorence

ryanflorence Jun 23, 2013

Fwiw ember tools takes an argument or defaults to cwd, doesn't seem too
complicated to me and decreases complexity for beginners. And again,
precedent with rails and express.

Most your users don't know what a bash profile is :)

On Sunday, June 23, 2013, Addy Osmani wrote:

I know @sindresorhus https://github.com/sindresorhus has seen first
hand how this can complicate the argument list :) I personally think
however there is a small, but subtle difference between yo angular app vs mkdir
app && cd app && yo angular (note: I'm suggesting that we both mkdir and
cd for you). We should simplify this if we can.

For my own day to day use I already have 'md' aliased to mkdir -p "$@" &&
cd "$@", but I don't think this is the case for most users.


Reply to this email directly or view it on GitHubhttps://github.com/yeoman/generator/issues/305#issuecomment-19877268
.

ryanflorence commented Jun 23, 2013

Fwiw ember tools takes an argument or defaults to cwd, doesn't seem too
complicated to me and decreases complexity for beginners. And again,
precedent with rails and express.

Most your users don't know what a bash profile is :)

On Sunday, June 23, 2013, Addy Osmani wrote:

I know @sindresorhus https://github.com/sindresorhus has seen first
hand how this can complicate the argument list :) I personally think
however there is a small, but subtle difference between yo angular app vs mkdir
app && cd app && yo angular (note: I'm suggesting that we both mkdir and
cd for you). We should simplify this if we can.

For my own day to day use I already have 'md' aliased to mkdir -p "$@" &&
cd "$@", but I don't think this is the case for most users.


Reply to this email directly or view it on GitHubhttps://github.com/yeoman/generator/issues/305#issuecomment-19877268
.

@sindresorhus

This comment has been minimized.

Show comment
Hide comment
@sindresorhus

sindresorhus Jun 23, 2013

Member

Tone it down, please; you assume far to much from a tweet.

Assume everyone on the internet is well intentioned. Even though I don't use emoticons on every sentence does not mean I'm exacerbated. I'm just stating my humble opinions, feel free to ignore or disagree. s/*/IMHO/. :)

You also assume users are as comfortable with the command line as you. It's a very, very scary place for what I assume to be a large portion of the target audience.

I don't. From experience I know far too well that most aren't. A couple of years ago that was me. But abstracting it away will not help them in the long run. The unknown is scary. But from a beginner perspective of both the command-line and yeoman, I don't see how either is more approachable. Stuff you don't know is hard. I prefer the approach of forcing people to learn useful things they can apply in many different situations (mkdir, bower, grunt, etc). In this case mkdir can be applied in so many other instances, while the path argument can not. I also prefer one way to do something and being explicit. I also don't like the Rails/Express argument. That some big projects does it doesn't mean it's a good practice.

Now, please tell me how I'm wrong ;)

Member

sindresorhus commented Jun 23, 2013

Tone it down, please; you assume far to much from a tweet.

Assume everyone on the internet is well intentioned. Even though I don't use emoticons on every sentence does not mean I'm exacerbated. I'm just stating my humble opinions, feel free to ignore or disagree. s/*/IMHO/. :)

You also assume users are as comfortable with the command line as you. It's a very, very scary place for what I assume to be a large portion of the target audience.

I don't. From experience I know far too well that most aren't. A couple of years ago that was me. But abstracting it away will not help them in the long run. The unknown is scary. But from a beginner perspective of both the command-line and yeoman, I don't see how either is more approachable. Stuff you don't know is hard. I prefer the approach of forcing people to learn useful things they can apply in many different situations (mkdir, bower, grunt, etc). In this case mkdir can be applied in so many other instances, while the path argument can not. I also prefer one way to do something and being explicit. I also don't like the Rails/Express argument. That some big projects does it doesn't mean it's a good practice.

Now, please tell me how I'm wrong ;)

@SBoudrias

This comment has been minimized.

Show comment
Hide comment
@SBoudrias

SBoudrias Jun 23, 2013

Member

From my point of view, even though mkdir is useful in other case, it is unnecessary overhead for a beginner just wanting to scaffold an application.

About implementation, I'm not sure how this can add much bloat to the code. On generator-bbb this is implemented in 2 lines + a conditionnal: https://github.com/backbone-boilerplate/generator-bbb/blob/master/lib/generators/init/index.js#L27-L32

Although, I don't think this functionnality should be added to yeoman-generator. That would complicate subgenerator and may bring unwanted behavior. It should be highly suggested as a best practice (so you can add it to any yeoman managed generators) and should be added by default by generator creation tools like generator-generator.

Member

SBoudrias commented Jun 23, 2013

From my point of view, even though mkdir is useful in other case, it is unnecessary overhead for a beginner just wanting to scaffold an application.

About implementation, I'm not sure how this can add much bloat to the code. On generator-bbb this is implemented in 2 lines + a conditionnal: https://github.com/backbone-boilerplate/generator-bbb/blob/master/lib/generators/init/index.js#L27-L32

Although, I don't think this functionnality should be added to yeoman-generator. That would complicate subgenerator and may bring unwanted behavior. It should be highly suggested as a best practice (so you can add it to any yeoman managed generators) and should be added by default by generator creation tools like generator-generator.

@passy

This comment has been minimized.

Show comment
Hide comment
@passy

passy Jun 23, 2013

Member

Back on the original point: I think moving the peer dependencies to the generators is a good idea. We should, however, consider dropping the version requirement on them, because of the way npm handles conflicting peer dependencies. If we bumped a generator to depend on bower ~0.10.0 while the user still had 0.9.2 installed, and installation or upgrade would just fail.

This is currently a problem with karma, grunt-karma and generator-angular.

Member

passy commented Jun 23, 2013

Back on the original point: I think moving the peer dependencies to the generators is a good idea. We should, however, consider dropping the version requirement on them, because of the way npm handles conflicting peer dependencies. If we bumped a generator to depend on bower ~0.10.0 while the user still had 0.9.2 installed, and installation or upgrade would just fail.

This is currently a problem with karma, grunt-karma and generator-angular.

@passy

This comment has been minimized.

Show comment
Hide comment
@passy

passy Jul 8, 2013

Member

Any new ideas on this, gents?

Member

passy commented Jul 8, 2013

Any new ideas on this, gents?

@addyosmani

This comment has been minimized.

Show comment
Hide comment
@addyosmani

addyosmani Jul 17, 2013

Member

We should, however, consider dropping the version requirement on them, because of the way npm handles conflicting peer dependencies.

My vote is a strong yes for this.

Member

addyosmani commented Jul 17, 2013

We should, however, consider dropping the version requirement on them, because of the way npm handles conflicting peer dependencies.

My vote is a strong yes for this.

@sindresorhus

This comment has been minimized.

Show comment
Hide comment
@sindresorhus
Member

sindresorhus commented Jul 17, 2013

👍

@passy

This comment has been minimized.

Show comment
Hide comment
@passy

passy Jul 21, 2013

Member

Implemented for generator-webapp.

Member

passy commented Jul 21, 2013

Implemented for generator-webapp.

@addyosmani

This comment has been minimized.

Show comment
Hide comment
@addyosmani

addyosmani Jul 21, 2013

Member

Yay

On Sun, Jul 21, 2013 at 10:29 PM, Pascal Hartig notifications@github.comwrote:

Implemented for generator-webapp.


Reply to this email directly or view it on GitHubhttps://github.com/yeoman/generator/issues/305#issuecomment-21317394
.

Addy Osmani
Phone: +44 7771 334170

Member

addyosmani commented Jul 21, 2013

Yay

On Sun, Jul 21, 2013 at 10:29 PM, Pascal Hartig notifications@github.comwrote:

Implemented for generator-webapp.


Reply to this email directly or view it on GitHubhttps://github.com/yeoman/generator/issues/305#issuecomment-21317394
.

Addy Osmani
Phone: +44 7771 334170

@zenorocha

This comment has been minimized.

Show comment
Hide comment
@zenorocha

zenorocha Jul 22, 2013

Member

Should we go to every Yeoman Generator repo and add this peerDependency?

Member

zenorocha commented Jul 22, 2013

Should we go to every Yeoman Generator repo and add this peerDependency?

@addyosmani

This comment has been minimized.

Show comment
Hide comment
@addyosmani

addyosmani Jul 22, 2013

Member

I've been doing this for our internal ones (backbone, angular, ember, chromeapp etc) and a number of externals (pure, h5bp, mobile boilerplate, flight etc). I would look up what ones haven't yet had peerDeps added in the yeoman generator community page and file PRs :)

Member

addyosmani commented Jul 22, 2013

I've been doing this for our internal ones (backbone, angular, ember, chromeapp etc) and a number of externals (pure, h5bp, mobile boilerplate, flight etc). I would look up what ones haven't yet had peerDeps added in the yeoman generator community page and file PRs :)

@zenorocha

This comment has been minimized.

Show comment
Hide comment
@zenorocha

zenorocha Jul 22, 2013

Member

Pull requests sent for all generator-* repos under Yeoman's org.

Member

zenorocha commented Jul 22, 2013

Pull requests sent for all generator-* repos under Yeoman's org.

@passy

This comment has been minimized.

Show comment
Hide comment
@passy

passy Jul 22, 2013

Member

Great job! Thanks a ton, @zenorocha! 🍰 🍰

Member

passy commented Jul 22, 2013

Great job! Thanks a ton, @zenorocha! 🍰 🍰

@sindresorhus

This comment has been minimized.

Show comment
Hide comment
@sindresorhus

sindresorhus Jul 22, 2013

Member

Nice work!

We should also update the install instructions in the readme as installing yo manually is no longer needed.

Member

sindresorhus commented Jul 22, 2013

Nice work!

We should also update the install instructions in the readme as installing yo manually is no longer needed.

@addyosmani

This comment has been minimized.

Show comment
Hide comment
@addyosmani

addyosmani Jul 22, 2013

Member

Occurred to me we weren't doing the latter so big plus one on updating
readme.

Member

addyosmani commented Jul 22, 2013

Occurred to me we weren't doing the latter so big plus one on updating
readme.

@kevva

This comment has been minimized.

Show comment
Hide comment
@kevva

kevva Jul 28, 2013

Member

All our generators should be up to date with these changes now so I'll close this.

Member

kevva commented Jul 28, 2013

All our generators should be up to date with these changes now so I'll close this.

@kevva kevva closed this Jul 28, 2013

passy added a commit to passy/generator-canjs that referenced this issue Aug 8, 2013

Add `yo` as peerDependency
By adding `yo` as peer dependency, the user only has to `npm install -g generator-canjs` and is good to go.

I also added `npm >= 1.2.10` as engine requirement which shows a non-fatal warning in case the user is using an earlier version of npm, which doesn't support peer dependencies yet.

/ref yeoman/generator#305

passy added a commit to passy/generator-canjs that referenced this issue Aug 8, 2013

Add `yo` as peerDependency
By adding `yo` as peer dependency, the user only has to `npm install -g generator-canjs` and is good to go.

I also added `npm >= 1.2.10` as engine requirement which shows a non-fatal warning in case the user is using an earlier version of npm, which doesn't support peer dependencies yet.

/ref yeoman/generator#305
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment