@purple/lerna-smart-run

0.5.1 • Public • Published

lerna-smart-run

Lerna add-on for only running npm scripts for packages changed since previous tag

Background

This package is a glorified wrapper around ordinary lerna run <script> commands, but it implements a system to control the order of execution and an automated, opionated tagging system (based on git branches) that takes advantage of lerna's --since option.

This package is intended for use in CI and CD pipelines, especially where sequential deploys are necessary, i.e., where one serverless resource needs to be deployed before the rest.

Usage

Invoke with smartRun <npm script>, where <npm script> is a script from the scripts section of the package.json of one of your lerna packages.

Example:

smartRun test

Optional arguments

Pass --tagOnSuccess to generate a tag from the successful execution of the smart run. This tag will be used on the following execution.

Pass --deleteTagOnSuccess to delete the previous tag on the successful execution of the smart run. If there was no previous tag this has no effect.

Pass --runFirst to run a package's script before any others. If multiple packages are passed to this option, they're run in sequence as well. Supports glob patterns.

Pass --runLast to run a package's script after any others. If multiple packages are passed to this option, they're run in sequence as well. Supports glob patterns.

Pass --scope if you want to run the command for a package even if it hasn't changed, but one of its dependencies has.

Pass --ignore if you want to ignore a package, but you still want to run the command for any of its dependents if they've changed.

Special arguments

If --deleteTag is passed, this simply looks for the most recent tag generated by this package and deletes it. After which the script exists. Example:

smartRun --deleteTag

Disclaimer

This package is in an early, experimental stage, and is likely to change dramatically between different versions.

Readme

Keywords

Package Sidebar

Install

npm i @purple/lerna-smart-run

Weekly Downloads

175

Version

0.5.1

License

MIT

Unpacked Size

17.2 kB

Total Files

9

Last publish

Collaborators

  • porwolikt
  • pnetusil37
  • skurbanov
  • sfajfr-purple
  • mturza
  • zakve
  • jzemek
  • atesarova
  • janziemba
  • pvolf
  • jmedek
  • pnemecekpurple
  • pmessineo
  • okaziya
  • albertvasatko
  • vskupien
  • jakubmed
  • xurban42
  • tomzaoral
  • vaclavgabriel
  • jancervinka
  • pyrek
  • fekecrad
  • pjediny
  • xurban46
  • rgrec
  • mkubicekp
  • chorobin
  • bsedlak
  • samuelg0rd0n