Skip to content

purple-technology/lerna-smart-run

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lerna-smart-run

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

About: https://blog.purple-technology.com/make-your-lerna-smarter/

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published