Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install as devDependency #69

Open
mhofman opened this issue Apr 19, 2019 · 3 comments
Open

Install as devDependency #69

mhofman opened this issue Apr 19, 2019 · 3 comments

Comments

@mhofman
Copy link
Contributor

mhofman commented Apr 19, 2019

I'd like to use jsvu to help run some tests on various engines for a package I'm writing.
For that I wouldn't install jsvu globally but instead would have it as a devDependency.

In that case I want jsvu to install engines in a specific folder inside the project's root, instead of in the user's home.

@mathiasbynens
Copy link
Member

Could you unpack this use case a little bit for me?

The unstated assumption in your request is that jsvu-installed binaries suffer from the same versioning/collision problems that npm packages do, but that’s not the case.

If two local projects I’m working on both depend different versions of lodash, then of course the project-specific version must be installed within the relevant project directory’s node_modules folder.

jsvu-installed binaries however are always “the latest version” by default, or explicitly versioned in their binary name in case of a specific engine version being installed. That is:

# This is the “latest” V8 version, updated whenever `jsvu` runs.
~/.jsvu/v8
# This is V8 v7.4.288, as installed by running `jsvu [email protected]`.
~/.jsvu/v8-7.4.288

Would your project depend on the latest available engine versions? In that case, it seems fine to install globally to ~/.jsvu/v8, since that’s where other projects could also expect the latest V8 binary to live.

Or would your project depend on specific engine versions, e.g. V8 v7.4.288? In that case, it also seems fine to install globally to ~/.jsvu/v8-7.4.288, since no project would refer to that path while expecting a different version.

@mhofman
Copy link
Contributor Author

mhofman commented Apr 19, 2019

I guess my main issue is a conceptual one. If my package uses jsvu internally, it feels weird for it to rely on external files.

One impact of that is what if the user doesn't have jsvu installed, in particular didn't setup it's $PATH.
I guess installing as a devDependency, and invoking jsvu [email protected] && ~/.jsvu/v8-7.4.288 in an npm script would do the trick.

@mathiasbynens
Copy link
Member

One impact of that is what if the user doesn't have jsvu installed, in particular didn't setup its $PATH.
I guess installing as a devDependency, and invoking jsvu [email protected] && ~/.jsvu/v8-7.4.288 in an npm script would do the trick.

Exactly! Alternatively, you could set the PATH as part of the npm script. (It would only alter the PATH for that particular command.)

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

No branches or pull requests

2 participants