lerna-current-dir-updated
v0.2.0
Published
Check whether the current working directory is part of a lerna package that has been updated.
Downloads
7
Readme
lerna-current-dir-updated
lerna-current-dir-updated
provides a simple way to check whether the current working directory is part of a lerna package that has been updated.
This can be especially useful when you wish to naively determine whether to run tests from a given directory in CI environments.
Installation
$ npm install --global lerna-current-dir-updated
Note: lerna must already be in your path (installed globally) in order for this package to work.
Usage
lerna-current-dir-updated
and lerna-current-dir-not-updated
accept the same flags as the lerna list command.
lerna-current-dir-updated
Exits non-zero if the current directory has not been updated.
$ cd packages/my-package-name
$ lerna-current-dir-updated --since develop && npm test
my-package-name is not updated.
lerna-current-dir-not-updated
Exits non-zero if the current directory has been updated.
This command can be chained with another using an OR operator in order to avoid exiting non-zero in CI environments. In the below example tests are only run if the package has been updated, and nothing will show as a failure in CI unless npm test
fails to pass.
$ cd packages/my-package-name
$ lerna-current-dir-not-updated --since master || npm test
my-package-name is updated.
... # npm test output