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

Make installable as an npm package #9

Merged
merged 1 commit into from
Aug 23, 2016
Merged

Conversation

jasonkarns
Copy link
Collaborator

Acknowledging that npm is typically thought of as a (and is primarily used for) javascript package manager, it can really be used as a package manager for anything.

npm itself has recognized and encouraged the use of npm (including the registry) as a place to publish non-javascript modules and packages. Indeed, I myself (and the entire nodenv organization),
leverage npm for managing dependencies, versioning, releases, and as a generic script/task runner for the nodenv tools and plugins (which are themselves bash/shell tools and scripts).

Which brings me to my point. The nodenv-package-json-engine nodenv plugin depends on sh-semver (thank you, by the way!).
At present, in order to "update" the sh-semver dependency, we curl down a copy from github and commit it to our repo as a vendored dependency. If sh-semver were to include a package.json manifest (as this PR provides),
then any tools that use npm to manage their dependencies (such as nodenv) would be able to easily list sh-semver as a dependency and allow npm to manage the installation of said dependency.

It is worth noting that, while one is encouraged to actually publish sh-semver to the npm registry, publishing the module is not necessary for others to gain the benefit of it having a package.json manifest (thereby becoming an actual npm package). One can depend on npm packages by pointing to their git repository. Indeed, if it is desired that sh-semver not be published, I would recommend adding "private": true to the package.json manifest to prevent it from accidentally being published at all.

Thoughts?

@jasonkarns
Copy link
Collaborator Author

jasonkarns commented Aug 19, 2016

I just went ahead and made the package private by default. If you end up wanting to publish to npm, just remove the "private": true property from package.json.

Also, if you're not already aware, making this an npm module would add the side benefit of getting a "release" script for free. npm version [major|minor|patch|<version> will bump the version in package.json, commit and tag the release via git all automatically. (Thus eliminating the need to manually bump the VERSION file, commit and tag as I've noticed resulted in at least one weird release: v1.0.0 tag isn't in the master branch.) It is also trivially easy to automate the tests being run before the release process: "preversion": "npm test". Just side benefits to be aware of. :)

@qzb
Copy link
Owner

qzb commented Aug 22, 2016

Funny, I've originally made this script for choosing node.js version basing on some config files. I guess your nodenv package would be prefect for this :)

I'm already maintaining one shell script in npm - is.sh so I'm aware of benefits. I'll publish it to npm.

@jasonkarns
Copy link
Collaborator Author

Removed private:true

@qzb qzb merged commit 6b10da1 into qzb:master Aug 23, 2016
@jasonkarns jasonkarns deleted the npm-package branch August 23, 2016 13:28
@jasonkarns
Copy link
Collaborator Author

sweet!

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

Successfully merging this pull request may close these issues.

2 participants