CLI now tries to require local modules first #57

Merged
merged 1 commit into from May 19, 2014

Projects

None yet

2 participants

@RobinThrift

I wrapped the metalsmith CLI in node-liftoff. This allows the use of a global metalsmith installation with local metalsmith.jsons without the need to install all the plugin globally, which is more convenient than the old node_module/.bin/metalsmith. It basically works like gulp.js now, where we load a local version of metalsmith when calling metalsmith from the command line.

(tests didn't stage last time -.-)

@ianstormtaylor

Hmm, a little wary of this because it adds a lot of complexity to understanding how the CLI works with terms like configBase and all of that.

@RobinThrift

Those names come from liftoff. I could rename a few of them (as variables) and try to add a few explaining comments. I think it would make the CLI more useful.

@ianstormtaylor

I'd be curious to know how much code it would take to just get the "requiring plugins locally" part that we want, without having to do all of the env, extensions, config stuff. Just cuz it seems like liftoff is trying to do too many things at once and results in a weird API.

@RobinThrift

Shouldn't be too hard, I'l check that out. Liftoff is very powerful library, looking for config files in parent folders, etc, but it might be a better idea to just extract that functionality.

@RobinThrift

Okay, this change now just tries to find the modules in the CWD first, and falls back to the old behaviour, if the module is not found, so this is backwards compatible. @ianstormtaylor maybe it should try to require the local version of metalsmith too?

@RobinThrift RobinThrift changed the title from wrapped metalsmith CLI in liftoff to CLI now tries to require local modules first May 13, 2014
@ianstormtaylor ianstormtaylor merged commit dc4002a into metalsmith:master May 19, 2014
@ianstormtaylor

Ah damn, merged too soon. Can you add a test case for this?

@RobinThrift

Yep, I'll try to get around to that as soon as possible.

@ianstormtaylor

Cool, I'll wait to publish until then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment