npm-ensure
ensure your package is good to commit/publish:
Last updated a year ago by yibn2008 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install npm-ensure 
SYNC missed versions from official npm registry.

npm-ensure

Build Status Coverage Status

ensure your package is good to commit/publish:

  • ensure npm dependencies are complete
  • ensure changelog exists

Usage

You can use npm-ensure command under the package dir which you want to check.


  Usage: npm-ensure [options]

  Options:

    -h, --help           output usage information
    -V, --version        output the version number
    -t, --types <types>  ensure check types (e.g: deps,changelog)

Example:

$ cd path/to/some-package
$ npm-ensure -t deps
==> check dependencies
The following dependencies are not defined:

 - co
 - commander

total 2 packages

$ npm-ensure -t changelog
==> check changelog
changelog for current version is NOT exists

$ npm-ensure
==> check dependencies
The following dependencies are not defined:

 - co
 - commander

total 2 packages

==> check changelog
changelog for current version is NOT exists

Or you can add it as precommit/prepublish hook to check before commit/publish.

Configration

use ensure field in package.json to config npm-ensure:

{
  "name": "foobar",
  "version": "1.1.1",
  "scripts": {
    "precommit": "npm-ensure -t deps,changelog && npm test"
  },
  "ensure": {
    "deps": {
      "checkDirs": [
        "*.js",
        "src/**/*",
        "bin/**/*"
      ],
      "ignoreDirs": [
        "src/do-not-check/**/*"
      ],
      "ignores": [
        "babel-*"
      ]
    },
    "changelog": {
      "file": "HISTORY.md"
    }
  }
}

Tips

  • deps.checkDirs, specifies which dirs/files need to be checked for dependencies
  • deps.ignoreDirs, specifies which dirs/files do NOT check
  • deps.ignores, ignore these modules when check dependencies (support glob match syntax)
  • changelog.file, specifies which file is CHANGELOG file

Work with lint-staged

Only check git staged files with lint-staged:

{
  "lint-staged": {
    "*.js": [
      "eslint --fix",
      "npm-ensure -t deps",
      "git add"
    ]
  }
}

License

MIT

Current Tags

  • 1.2.0                                ...           latest (a year ago)

11 Versions

  • 1.2.0                                ...           a year ago
  • 1.1.3                                ...           a year ago
  • 1.1.2                                ...           2 years ago
  • 1.1.1                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 13
Last Day 0
Last Week 11
Last Month 27
Dependencies (7)
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |