carburo / lerna-lite

automate your workspace version & publish by using conventional-changelog-commits

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lerna-Lite πŸ‰

License: MIT TypeScript npm NPM downloads lerna--lite

PR jest codecov Actions Status

Lerna-Lite is a super light version of the original Lerna


License

MIT License

About Lerna-Lite

Lerna-Lite differs from the original Lerna in the sense that it only includes 3 commands (1 is optional) out of 15 commands that the original Lerna has. It also assume that you have already setup a workspace through NPM, Yarn Workspaces or any other technology that will take care of the symlinks and with that in mind Lerna-Lite does not include the bootstrap command, so make sure your workspace is properly setup before installing Lerna-Lite.

Why create this lib/fork?

Mainly for the following reasons:

  1. the original Lerna is no longer maintained (dependencies are out of date)
  2. create a lighter lib that still provide Lerna's approach of Versioning and Publishing by following the Conventional Commits and also automatically create Conventional-Changelog for each package of the workspace. We don't need all packages of Lerna anymore since NPM Workspaces came out.
  3. add some little extras while keeping the lib light.

This lib will help you with

Version & Publish commands

  • Automate the rolling of new Versions (independent or fixed) for all your workspace packages
    • it will automatically add Commit & Tag your new Version in Git & create new GitHub or GitLab Release when enabled
  • Automate the creation of Changelogs for all your packages by reading all Conventional Commits
    • each package will get its own changelog and a combined changelog will also be created in the root
  • Automate the repository Publish of your new versions for all your packages (NPM or other platform)

Run command (optional)

  • Run is an optional package that will help you run npm script in parallel and in topological order.

Lerna-Lite Packages

Package Name Version Description Changes
@lerna-lite/cli npm Lerna-Lite Version/Publish comands CLI changelog
@lerna-lite/core npm Lerna-Lite core & shared methods changelog
@lerna-lite/publish npm Publish packages in the current workspace changelog
@lerna-lite/run npm Run command and CLI to run npm scripts in the workspace changelog
@lerna-lite/version npm Bump Version & write Changelogs changelog

Project Demo?

You want to see a demo project? Sure, you're looking at it πŸ˜‰

Yes indeed, this lib was created as an NPM Workspace specifically for the purpose of demoing and testing of its own code. All changelogs and published versions were created by the lib itself, how sweet is that? You will also find that it has its own lerna.json config file just as well as you would when using the lib.

See it in Action 🎦

You can see a small video of a new version release on this Release Demo - Wiki - Confused with all the options? Consult the multiple links below.

References

README Badge

Using Lerna-Lite? Add a README badge to show it off: lerna--lite

[![lerna--lite](https://img.shields.io/badge/maintained%20with-lerna--lite-cc00ff)](https://github.com/ghiscoding/lerna-lite)

Installation

Command Install Description Included
πŸ“° version npm i @lerna-lite/cli create new version for each workspace package Yes
πŸ“° publish npm i @lerna-lite/cli publish each workspace package Yes
πŸƒ run npm i @lerna-lite/run run npm script in each workspace package Optional

Note: the default lerna CLI is only including 2 built-in commands which are the publish and version, while run command is optional and must be installed separately (see below).

# Lerna CLI which includes publish/version commands
npm install @lerna-lite/cli # OR yard add @lerna-lite/cli

# install optional `run` command
npm install @lerna-lite/run # OR yarn add @lerna-lite/run

Usage

Add custom NPM Scripts or simply run the following NodeJS commands in a shell.

// package.json / npm scripts
"scripts": {
  "new-version": "lerna version",
  "new-publish": "lerna publish from-package",
  "run-tests": "lerna run test", // optional `run` command
}

Configuration

You could configure Lerna via a lerna.json file, via a "lerna": {} property directly under your package.json or lastly by passing arguments directly when calling the shell commands. You can read the lerna.json - Wiki for more info.

Migration for Lerna Users

If you are migrating from Lerna, it should be fairly easy to just replace Lerna with Lerna-Lite and that should be it, the CLI commands are the same, take a look at the quick steps below:

  1. remove Lerna from your local & global dependencies
npm uninstall lerna # OR yarn remove lerna
npm uninstall -g lerna # OR yarn global remove lerna
  1. install Lerna-Lite CLI to get version and publish commands
    • run command is optional and can be installed separately as shown below
# Lerna CLI (`version`/`publish` commands)
npm install @lerna-lite/cli

# install optional `run` command
npm install @lerna-lite/run

Development / Contributions

If you wish to contribute to the project, please follow these steps

  1. clone the lib:
    • git clone https://github.com/ghiscoding/lerna-lite
  2. install with NPM:
    • npm install
  3. add/run Jest unit tests:
    • npm run jest # OR npm run jest:watch
  4. you can troubleshoot/debug the code via the VSCode debugger launch configs that are already setup

Contributions

Feel free to contribute any Pull Request, PRs are very welcome. πŸ‘·πŸ‘·β€β™€οΈ

Also please note that I'm just a simple developer & user of this lib, the same as you are, my knowledge of the library is also probably similar to yours but together we can make it better (and lighter).

Troubleshooting

If you have problems running the lib and your problems are with Git then you should first try the --git-dry-run option to see if that helps in finding the error. Another great, and possibly much more useful suggestion, is to search in the Lerna issues because most of the code came from that library. Lastly if it that is not enough and you wish to troubleshoot yourself, then read this Troubleshooting - Wiki

About

automate your workspace version & publish by using conventional-changelog-commits

License:MIT License


Languages

Language:TypeScript 79.0%Language:JavaScript 21.0%