duojs / duo

A next-generation package manager for the front-end
3.42k stars 118 forks source link

Adding duo-install #468

Closed dominicbarnes closed 9 years ago

dominicbarnes commented 9 years ago

This adds a duo-install command, with semantics almost identical to the normal duo command. It's purpose is to take entry files and install all their dependencies. This is useful in cases where you are building a project for the first time and want to have all the deps available w/o necessarilly wanting to build right away.

For instance we're using a middleware to auto-compile each request, but downloading deps on that first request is painfully slow. It feels worse since you're waiting in your browser, so by offloading that work to before you start the server, a lot of that perception of slowness can be addressed.

It's really important to note that this does not behave like component install, npm install or anything else like that. You can't pass arbitrary packages and have it install them. As such, maybe this will remain an under-documented/advanced feature. (since it's not required to use duo normally)

# install dependencies for index.js/css
duo install index.{js,css}

# include plugins if needed
duo install --use duo-babel --use duo-myth index.{js,css}
dominicbarnes commented 9 years ago

The commit history got weird/bloated while trying to get CI passing, so I've gone ahead and squashed everything into a single commit.

matthewmueller commented 9 years ago

i'm +1 to this change, I think it ended up being a mistake to merge these two commands. it was an interesting experiment though :-P

dominicbarnes commented 9 years ago

@matthewmueller yeah, I don't think the merging is necessarily bad, I am glad that just running duo index.js just works. This is mostly just a helpful separation for CI and testing. :)