A command-line tool to verify if a package has been released in a repository (such as Nexus, Artifactory, ...).
- So simple to use
- Example of usage from command-line
- Example-of-usage from continuous integration
- Future features or improvements
- Contributing
The npm-package-checker command utility has been designed to...
The first step (and my own advice) is to install it globally:
$> npm install -g npm-package-checker
In order to be able to execute it, write the following command:
$> npm-package-checker
npm-package-checker has some parameters, which two of them are mandatories and the rest are optionals.
The required parameters are:
Parameter | Short form | Purpose |
---|---|---|
--repoUrl | -r | The URL of NPM repository (Nexus, Artifactory...) |
--tag | -t | The TAG of component to be checked if it has been published or not |
The optionals parameters are:
Parameter | Short form | Purpose |
---|---|---|
--debug | -d | Show detailed info about the progress |
--colors | -c | Show color traces |
Other parameters are:
Parameter | Short form | Purpose |
---|---|---|
--help | -h | Show command-util help |
--version | Show version number |
After installing it (at the moment is only focused to use it from the terminal), choose from the following modes:
-
Simple usage, wrong usage:
$> npm-package-checker
-
Simple usage, tag published:
$> npm-package-checker --repoUrl 'http://registry.npmjs.org/npm-package-checker' --tag '1.0.0' -c
-
Simple usage, tag inexistent:
$> npm-package-checker --repoUrl 'http://registry.npmjs.org/npm-package-checker' --tag '0.0.1'
-
Enabling traces.
$> npm-package-checker --repoUrl 'http://registry.npmjs.org/npm-package-checker' --tag '0.0.1' --debug
-
Enabling colors.
$> npm-package-checker --repoUrl 'http://registry.npmjs.org/npm-package-checker' --tag '0.0.1' --debug --colors
-
Component published, enabled colors.
$> npm-package-checker --repoUrl 'http://registry.npmjs.org/npm-package-checker' --tag '1.0.0' --colors
To take advantage of that use, you could integrate this powerful script into your CI server (for instance, Jenkins, Travis, Go...). If you are publishing frontend components (not necessarily web components) in a repository (Nexus, Artifactory or even in npmjs repo), one step before of that could be the check if the current version of its package.json has been upgraded correctly (useful when the policy is to avoid override the same version; instead of that, the developer always have to increment, at least, the patch version).
That script, in a few words, will check if the version that you are trying to publish exists or not in the repo, stopping the process. The steps to integrate it are:
- Add "Execute from the command line (shell)" in the desired job.
- Call the script directly (if it was installed globally) with specific params (in future versions this script could automatically search the package.json in order to extract the version of the component).
- Save and execute it!
Failed execution:
Successful execution:
That feature list will be populated with comments, suggestions and requests of the community.
- Initial version: check if a version has been released in a repo.
- Search and extract automatically the version of package.json.
If you are interested to contribute with that project, you could perform it via:
- Opening an issue.
- Pull Request.
- Writing me.