项目作者: nodesource

项目描述 :
NodeSource认证模块命令行实用程序
高级语言: JavaScript
项目地址: git://github.com/nodesource/nscm.git
创建时间: 2017-03-15T23:59:17Z
项目社区:https://github.com/nodesource/nscm

开源协议:MIT License

下载


nscm - the CLI Utility for NodeSource Certified Modules

nscm is a simple utility for NodeSource Certified Modules that can be used to easily authenticate with your Certified Modules registry, to whitelist pacakges that fail certification, and to generate a detailed report about current project and the modules it depends on.

Installation

You can install it from npm by running:

  1. $ npm install -g nscm

Usage

This tool is meant to be used in the root folder of an application where the package.json file exists.

  1. Usage: nscm [command] [options]
  2. Commands:
  3. config, c Configure nscm options
  4. help Display help
  5. report, r Get a report of your packages
  6. signin, s, login Sign in to nscm
  7. signout, o, logout Sign out of nscm
  8. verify Verify if all packages are certified
  9. whitelist, w Whitelist your packages
  10. Options:
  11. -C, --certified Shows only certified packages
  12. -c, --concurrency <n> Concurrency of requests (defaults to 15)
  13. -d, --dot Formats the report in Graphiz dot (disabled by default)
  14. -f, --failed Shows only packages that failed certification (disabled by default)
  15. -g, --github Sign in using GitHub SSO (disabled by default)
  16. -G, --google Sign in using Google SSO (disabled by default)
  17. -h, --help Output usage information
  18. -j, --json Formats the report in JSON (disabled by default)
  19. -o, --output Save report to file (disabled by default)
  20. -p, --production Only check production (disabled by default)
  21. -r, --registry Certified modules registry (defaults to "")
  22. -s, --svg Formats the report in SVG (disabled by default)
  23. -t, --token Token for registry authentication (defaults to "")
  24. -v, --version Output the version number
  25. Additional Help
  26. Add -h to the 'config' or 'whitelist' commands for additional help concerning those commands.
  27. nscm config -h
  28. nscm whitelist -h

nscm report (default)

Returns a report of matching certified packages and their certification scores.

  1. $ nscm report
  2. please wait while we process the information
  3. ┌────────────────────────────────────┬───────────────┬────────┐
  4. Package Version Score
  5. ├────────────────────────────────────┼───────────────┼────────┤
  6. body-parser 1.15.2 100
  7. ├────────────────────────────────────┼───────────────┼────────┤
  8. debug 2.2.0 70
  9. ├────────────────────────────────────┼───────────────┼────────┤
  10. ms 0.7.1 100
  11. ├────────────────────────────────────┼───────────────┼────────┤
  12. bytes 2.4.0 100
  13. ├────────────────────────────────────┼───────────────┼────────┤
  14. content-type 1.0.2 100
  15. ├────────────────────────────────────┼───────────────┼────────┤
  16. depd 1.1.0 100
  17. ├────────────────────────────────────┼───────────────┼────────┤
  18. http-errors 1.5.1 100
  19. ├────────────────────────────────────┼───────────────┼────────┤
  20. inherits 2.0.3 100
  21. ├────────────────────────────────────┼───────────────┼────────┤

You can also pass --json to return the report in JSON format,
--svg to return the report in SVG format, or
--dot to return the report in Graphviz DOT format.
Use --production to return only dependencies and not devDependencies and
--output to save a file (.json or .svg) for generated report.

If you want to filter the output you can use
--certified to show only certified packages or
--failed to show only packages that failed certification.

  1. $ nscm report --production --json
  2. please wait while we process the information
  3. [
  4. {
  5. "name": "body-parser",
  6. "version": "1.15.2",
  7. "from": "1.15.2 <1.16.0",
  8. "score": 100
  9. },
  10. {
  11. "name": "debug",
  12. "version": "2.2.0",
  13. "from": ">=2.2.0 <2.3.0",
  14. "score": 70
  15. },
  16. {
  17. "name": "ms",
  18. "version": "0.7.1",
  19. "from": "0.7.1",
  20. "score": 100
  21. },
  22. {
  23. "name": "bytes",
  24. "version": "2.4.0",
  25. "from": "2.4.0",
  26. "score": 100
  27. },
  28. ...

nscm whitelist

Check which packages aren’t certified, and start an interactive prompt to add packages to the whitelist.

  1. $ nscm whitelist
  2. please wait while we process the information
  3. 37 packages aren't certified, do you want to add them to the whitelist?
  4. ? add debug@2.2.0 Yes
  5. ? add setprototypeof@1.0.2 Yes
  6. ? add statuses@1.3.1 No
  7. ? add ee-first@1.1.1 No
  8. ? add unpipe@1.0.0 (ynaH) All
  9. ┌────────────────────────────────────┬───────────────┬────────┐
  10. │ Package │ Version │ Score │
  11. ├────────────────────────────────────┼───────────────┼────────┤
  12. │ debug │ 2.2.0 │ 70 │
  13. ├────────────────────────────────────┼───────────────┼────────┤
  14. │ setprototypeof │ 1.0.2 │ │
  15. ├────────────────────────────────────┼───────────────┼────────┤
  16. ...
  17. ├────────────────────────────────────┼───────────────┼────────┤
  18. │ source-list-map │ 0.1.8 │ │
  19. ├────────────────────────────────────┼───────────────┼────────┤
  20. │ webpack-core │ 0.6.9 │ │
  21. └────────────────────────────────────┴───────────────┴────────┘
  22. 35 packages added to the whitelist

You can also pass --all to add all the packages to the whitelist and --json to return the packages in a JSON format.

nscm whitelist add

Add a package and its dependencies to the whitelist.

  1. $ nscm whitelist add debug@2.x

If you pass only the package name, nscm will use latest. You can also pass a semver range or a specific version. If a semver range is passed it will be resolved to the highest published version that matches the range.

nscm whitelist delete

Delete a package from the whitelist.

  1. $ nscm whitelist delete debug

nscm whitelist list

Lists all whitelisted packages.

  1. $ nscm whitelist list
  2. ┌────────────────────────────────────┬───────────────┬────────┐
  3. Package Version Score
  4. ├────────────────────────────────────┼───────────────┼────────┤
  5. acorn 4.0.1
  6. ├────────────────────────────────────┼───────────────┼────────┤
  7. isarray 2.0.1
  8. └────────────────────────────────────┴───────────────┴────────┘
  9. 2 packages in the whitelist

nscm whitelist reset

Removes all whitelisted packages.

nscm config

Configuration Options

  • token - Authentication Token. If not specified, it will be fetched from ~/.npmrc - required
  • registry - Private NodeSource Certified Modules registry URL. If not specified, it will be fetched from ~/.npmrc - required
  • concurrency - Concurrency of requests to package registry - default: 15

nscm config set <key> <value>

Modify the specified configuration option.

  1. $ nscm config set concurrency 10

nscm config get

Gets a configuration option

  1. $ nscm config get registry
  2. https://{registryId}.registry.nodesource.io

nscm config delete

Deletes a configuration option.

  1. $ nscm config delete token

nscm config list

List all configuration options.

  1. $ nscm config list
  2. concurrency = 15
  3. registry = https://{registryId}.registry.nodesource.io

nscm config reset

Reset all configuration options to default values.

  1. $ nscm config reset

Authors and Contributors








Nathan WhiteGitHub/nwTwitter/@nw
Julián DuqueGitHub/julianduqueTwitter/@julian_duque
Adrián EstradaGitHub/edsadrTwitter/@edsadr
Max HarrisGitHub/maxharris9Twitter/@maxharris9
Tierney CyrenGitHub/bnbTwitter/@bitandbang
Giovanny GongoraGitHub/GioyikTwitter/@Gioyik

Contributions are welcomed from anyone wanting to improve this project!

nscm is Copyright (c) 2017 NodeSource and licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.