Skip to content

Installers for Yeoman #1262

Open
addyosmani opened this Issue Jan 9, 2014 · 28 comments

10 participants

@addyosmani
Yeoman member

The problem

Our users have regularly told us is it takes a while (minutes) to install all of the dependencies needed to use us - both during npm install -g yo and yo foo.

Despite knowing how to use npm and local high-speed mirrors, this is still a challenge for many and questionably reduces how quickly you can start working on a Yeoman project.

In addition, if you're on Windows it can be a time-consuming getting all of the deps you need setup. Especially for Compass and PhantomJS, to name but a few.

The solution

One thing we can do is make installing and using Yeoman (and at least, our official generators) as fast and easy as it is to install Node itself. This might be possible by means of either packaging dependencies or creating a one-click, cross-platform installer that gives you everything you need.

How can we do it?

There are a number of projects which have attempted to offer a way to achieve this in the past. Some of the ones I'm aware of:

  • nexe - creates a single executable from a Node.js application including all of its modules - unclear if Windows is supported
  • node-wekit - app runtime based on Chromium and node.js. You can write native apps in HTML and Javascript with node-webkit. It also lets you call Node.js modules directly from the DOM.
  • appjs or deskshell

Note: we're not saying, bundle Node + all deps into an installer here. We're talking about bundling yo/grunt/bower/generators + their deps.

@danielchatfield

Can we not do what npm does and package the dependencies with the module?

Disclaimer: not actually looked into this so there may well be a reason why this won't work

@sindresorhus
Yeoman member

@danielchatfield we could, but we don't want that by default. Could be a build-step for a separate package though.

@addyosmani
Yeoman member

@danielchatfield Do you mean bundle along the node_modules required a la https://github.com/npm/npm/tree/master/node_modules?

@danielchatfield

That is what I meant, yes. Although I can already see that that makes updating problematic.

@addyosmani
Yeoman member

I could imagine having a package which has yo, generator-webapp etc as dependencies where as part of it's build-step we pre-bundle the node_modules required. One would still need a way to handle the extra deps for Windows users.

@SBoudrias
Yeoman member

What is long? NPM install or the nodejs dev environment setup?

@addyosmani
Yeoman member

Primarily npm install for yo and the follow-up npm install post-scaffold.

@danielchatfield

Yeoman is actually quite large now with all its dependencies, I wonder if anything could be done to try and reduce that. For example, 5 distinct versions of lodash get installed (there may well be a more extreme case, that was the first one I checked). 4 3 of which are dependencies of either yeoman repos or repos by team members.

@danielchatfield

Configstore uses 2.4.1
Inquirer uses 1.2.1
Insight uses 1.3.1

Perhaps we should make a push to update to latest dependencies?

https://david-dm.org/yeoman

@sindresorhus
Yeoman member

@danielchatfield it's on the list: #1263

npm dedupe should also help.

@danielchatfield

@addyosmani Just done the calculations:

Currently yo with all its dependencies (excluding multiple copies of the same version of a module) is 13.7MB. If all the dependencies could be updated so that there isn't any more than one version of each module installed this would be reduced to 7.78MB. That is a significant reduction and would instantly cut the installation time down by loads.

Going forward I think more emphasis should be put on keeping the dependencies up to date.

@sindresorhus
Yeoman member

@danielchatfield thanks for doing that! totally agree.

@SBoudrias
Yeoman member

Still, this is putting lipstick on a pig. Versions will get out of sync in the future too, this is how Node handle dependencies.

IMO, if we're to find a solution, we need to find something that'll work with the context in which we're working.

@sindresorhus
Yeoman member

@SBoudrias i know, but doesn't hurt to do it once.

@danielchatfield
@SBoudrias
Yeoman member

How about we create packages for Homebrew and Chocolatey? (there's an old yeoman package on Chocolatey that we could try to update)

I don't feel creating .exe and .app really are good ideas as they'll make it hard to update the project.

@eddiemonge
Yeoman member

Have other things around that been considered like uninstalling or upgrading?

@sindresorhus
Yeoman member

@SBoudrias homebrew will probably not accept as they don't allow packages available in other package managers.

@robwierzbowski

Last time I checked it takes a similar amount of time or longer to download Rails. But it's a one time cost.

I think the intention is good, but moving away from the standard way of doing things, and maintaining that new way, takes a continual expense of energy. It also distances users from node, which in my opinion is a bad thing. Yeoman is a great gateway drug to doing more with node.js and Grunt.

@sindresorhus
Yeoman member

Is this still something you want to pursue?

@jbnicolai

homebrew will probably not accept as they don't allow packages available in other package managers.

I've just confirmed over at irc.freenode.net#machomebrew, and they would be willing to accept Yeoman - as it's a CLI tool that is globally installed, not a locally in-project used node module.

If I can get an okay from this side as well I'll get started on creating a homebrew yeoman installer 😄

@SBoudrias
Yeoman member

@jbnicolai Wow that would be pretty cool!

@addyosmani
Yeoman member
@Martinspire

Decreasing the download-size per say isn't a big deal. Decreasing the number of things to download (packages and thus connections) is. Plus it needs to compile some things or extract them which takes up most of the time.

Perhaps cut some dependencies by including the directly in the project might be better (not including them in node_modules but in the files itself. It might be a bit more difficult to handle all the versions, but will keep the project simple and small (and as long as you document it properly)

Another thing i noticed is that a lot of dependencies also have documentation and source included, which shouldn't really be needed if you aren't contributing to Yeoman or those dependencies.

@Munter
Munter commented Oct 28, 2014

@Martinspire README.md is by default included by npm for any module, no matter what ignores you have set up for the package. If you see any files that you think shouldn't be there in a package, then I highly encourage you to make a pull request against that packages repository, which adds the superfluous files to .npmignore

@Martinspire

The readme.md is no problem but the fact that both Dist and Src folders for dependencies are sent, could be an issue for it being very large. So if you would package those dependencies with yeoman (without using npm) you would save not only a few connections, but some unneeded source files as well.

But perhaps this is more an NPM issue than Yeoman, as there is no way of stating you require the distribution version, not the source.

@Munter
Munter commented Oct 28, 2014

npm packages are the distribution version by default. They should only contain the things needed to run the module, not anything else. If you find packages where this is not true, open a pull request on their repositories that puts the unneeded files in .npmignore

@kevva
Yeoman member
kevva commented Oct 28, 2014

Or even better, only put the needed files inside the files property in package.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.