duojs / duo

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

Rewrite of duo-ls #490

Closed dominicbarnes closed 8 years ago

dominicbarnes commented 9 years ago

All right, I've been wanting to do this for a while, so finally took the time to get it done! I've rewritten duo-ls and changed a number of key things about how it operates:

Under the hood, it now uses the duo.install() method (and the fact that it returns the mapping) to determine the output. This means that it also needs any build-level configuration such as plugins in order to successfully run. There is also a "stale" mode, which simply returns the mapping as it exists in the cache, rather than re-resolving the entire build. (also eliminates the need for plugins)

Some examples: (all using dominicbarnes/slider)

$ duo ls index.js
screen shot 2015-07-25 at 10 22 53 pm

Main differences in the output:

$ duo ls index.js --no-remotes
screen shot 2015-07-25 at 10 26 58 pm
$ duo ls index.js --no-remotes --flat
screen shot 2015-07-25 at 10 28 18 pm

This particular mode is going to be useful in things like a Makefile, in order to automatically construct a list of prerequisites!

build/index.js: component.json $(shell duo-ls index.js --no-remotes --flat)
    duo $<

Any feedback is much appreciated. :)

matthewmueller commented 9 years ago

niceee lgtm!

dominicbarnes commented 9 years ago

Looks like this feature is gonna have to wait a bit longer. When playing around with this in a few components, I've come across a few problems.

I'm getting "call stack size exceeded" errors on certain components. I'm not sure if there's some circular dependencies or what, but I'll need to investigate further.

The results look confusing when a remote has multiple files. My initial tests all seemed to have components with a single index.js, which looks fine. However, with remotes that have multiple files (such as a lib/ dir) the results look pretty bad. (looks like deps are duplicated)

I think I'll need to construct my tree by chunking entire remotes together, rather than processing each individual file. Either way, hold off on merging this right now.

RobLoach commented 8 years ago

Anything going on with this one? Last action was in July.

dominicbarnes commented 8 years ago

Yeah, this PR should probably be closed then. It's got issues as I mentioned in the last comment, and I've not had the time to dedicate to finding a fix.