zkochan / is-pkg-changed

Detects whether package has been changed since last publish

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is-pkg-changed

Detects whether package has been changed since last publish

npm version Build Status

Great for monorepos. Looks up the commit which was used to publish the last version of the package. The commit has to be marked with a tag in the format <pkg name>/<pkg version>. So if the last published package was 2.0.0 and the package name is foo, the foo/2.0.0 git tag is looked up.

Installation

npm i -S is-pkg-changed

Usage

const isPkgChanged = require('is-pkg-changed').default

isPkgChanged('/user/repo/pkg').then(isChanged => console.log(isChanged))
//> true or false or undefined

API

isPkgChanged(pkgPath, [options])

Arguments:

  • pkgPath - string - path to the package.
  • options.ignore - string[] - an array of filename patterns to ignore when analyzing the working tree for changes since last publish. The default value has: **/test/**, **/tests/** and **/*.md.

Returns:

  • true - if there were changes in non-ignored files since last publish
  • false - if there were no changes in non-ignored files since last publish
  • undefined - if no git tag was found to recognize the publish commit

License

MIT © Zoltan Kochan

About

Detects whether package has been changed since last publish

License:MIT License


Languages

Language:TypeScript 100.0%