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

support any semver value for install or use #192

Closed
tjwebb opened this issue Jul 18, 2014 · 5 comments
Closed

support any semver value for install or use #192

tjwebb opened this issue Jul 18, 2014 · 5 comments
Milestone

Comments

@tjwebb
Copy link
Collaborator

tjwebb commented Jul 18, 2014

Being able to, for example, use n to support automatic compatibility with any engines.node version in a package.json would be amazing. e.g.

$ n 0.10.x
$ n ">=0.10.0 <= 0.10.28"

Would be more convincing for programmatic-type usage, i.e. with n-api or similar:

var n = require('n-api');
n.use(pkg.engines.node, 'index.js');
@ghost
Copy link

ghost commented Mar 26, 2015

I am going to assume that you would want n to install the latest of the wildcard version similar to the way npm installs from package.json? If so, I would like to give this a shot.

@ghost ghost removed the 1.3.x label Jul 22, 2015
@ghost ghost added this to the 2.1.0 milestone Jul 22, 2015
@maxrimue maxrimue mentioned this issue Sep 17, 2015
5 tasks
@bitdivine
Copy link

+1. This is exactly what I had in mind. Happy to help if needed.

@bitdivine
Copy link

Thoughts on how this might be used in practice, especially on the context of package.json:
Note: On the command line, wherever one can use, say "latest" as the version of node, one might use "engine":

n use engine ./server.js

Note: I know of no way of making npm use a specific version of node apart from putting that node at the front of the path. That one can do, with PATH="$(dirname "$(bin 5.0.0)"):$PATH" npm install. We might make this easy:

n with <version> npm install

or, shorter but less general:

n npm <version> install

Here are implementations to play with:

@bitdivine
Copy link

Note: The sketch implementation uses the node modules semver and n-api. Of those, semver is what npm uses for its semantic versioning, so if npm is installed on a machine, so is semver. It doesn't add a new dependency and using the same code to do the comparison ensures that we always get the same answers. However n-api is not included in n or npm, so that dependency should probably be eliminated. The shell functions in n itself should be able to provide the n-api. ;-)

Note: Installing a new version with n engine will require a different logic from the one in the sketch. semantic_version() looks for a compatible version amongst all the installed versions. This needs another function that finds a compatible version among all versions that exist.

@shadowspawn
Copy link
Collaborator

This issue has not had any activity in over six months. It isn't likely to get acted on due to this report.

Feel free to open a new issue if it comes up again, with new information and renewed interest.

Thank you for your contributions.

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

No branches or pull requests

3 participants