Skip to content
This repository was archived by the owner on Apr 7, 2021. It is now read-only.

feat(node-path): append temp packages to $NODE_PATH #1

Closed
wants to merge 1 commit into from

Conversation

knksmith57
Copy link

Fixes: zkat/npx#153
Ref: zkat/npx#160

This makes it so you can do npx -p lodash node -r lodash when lodash is not
already installed. One big downside of this patch is that because of the semantics
of that node feature, NODE_PATH will always be treated as a fallback. That is, if
you already have one version of lodash installed in a local npm project you're
currently in the directory of, you won't be able to override it with the
temporary install.

Fixes: #153
Ref: #160

This makes it so you can do `npx -p lodash node -r lodash` when lodash is not
already installed. One big downside of this patch is that because of the semantics
of that node feature, NODE_PATH will always be treated as a _fallback_. That is, if
you already have one version of lodash installed in a local npm project you're
currently in the directory of, you won't be able to override it with the
temporary install.
@knksmith57
Copy link
Author

This PR cherry-picks @zkat's original commit (zkat/npx@df053f9) to land support for require()ing no-install dependencies (see zkat/npx#180).

There's a lot of value in landing this change as, among other things, it enables one-off use of programmatic APIs. Library developers often provide programmatic APIs far richer than those exposed by CLIs (assuming a CLI is even provided).

@knksmith57
Copy link
Author

any interest in moving this forward, @isaacs?

please let me know if there's anything else I can do. thanks!

@darcyclarke
Copy link
Contributor

@knksmith57 thanks for this! Unfortunately, the npx codebase has been pulled back into the npm/cli repo as it ships with npm by default. We'll be archiving this separate repo shortly; Feel free to direct any changes/improvements you want to see to npx/npm exec there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running no-install with dependencies
3 participants