From 37e6ab5979abe6ca33fc08d27e3e9b7e044d6032 Mon Sep 17 00:00:00 2001 From: ghiscoding Date: Mon, 20 Feb 2023 13:39:22 -0500 Subject: [PATCH] fix(version): highlight version prop required in `lerna.json` - highlight the fact that `version` is a required property to exist in the `lerna.json` config - closes #485 --- README.md | 4 +++- packages/core/src/command.ts | 5 ++++- packages/version/README.md | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 76291909..bd346e36 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ changes and changelogs #### [Version](https://github.com/lerna-lite/lerna-lite/tree/main/packages/version) and [Publish](https://github.com/lerna-lite/lerna-lite/tree/main/packages/publish) commands (included with the CLI) -- Automate the rolling of new Versions (`independent` or `fixed`) of all your workspace packages. +- Automate the rolling of new Versions (`independent` or fixed version) of all your workspace packages. - it will automatically Commit/Tag your new Version & create new GitHub/GitLab Release (when enabled). - Automate, when enabled, the creation of Changelogs for all your packages by reading all [Conventional Commits](https://www.conventionalcommits.org/) and a merged one in the project root. - Automate, when enabled, the repository Publishing of your new version for all your packages (NPM or other platforms). @@ -177,6 +177,8 @@ Run the following commands to install Lerna-Lite in your project and/or install If you are new to Lerna-Lite, you could also run the [lerna init](https://github.com/lerna-lite/lerna-lite/tree/main/packages/init#readme) command which will create the `lerna.json` for you with a minimal setup. If you are using a different client other than npm, then make sure to update the `npmClient` property in `lerna.json` (for example: `"npmClient": "yarn"` or `"pnpm"`). +> **Note** please make sure that you have a `lerna.json` config file created and a `version` property defined with either a fixed or independent mode. An error will be thrown if you're missing any of them. + ### JSON Schema You can add the `$schema` property into your `lerna.json` to take advantage of Lerna-Lite [JSON Schema](https://json-schema.org/) (`lerna init` will automatically configure this for you). This will help with the developer experience, users will be able to see what properties are valid with a brief description of what they do (each description are pulled from their associated lerna command options documentation). diff --git a/packages/core/src/command.ts b/packages/core/src/command.ts index 44aa6595..a9881a23 100644 --- a/packages/core/src/command.ts +++ b/packages/core/src/command.ts @@ -288,7 +288,10 @@ export class Command { } if (!this.project.version) { - throw new ValidationError('ENOVERSION', 'Required property version does not exist in `lerna.json`'); + throw new ValidationError( + 'ENOVERSION', + 'Required property `version` does not exist in `lerna.json`, make sure to provide one of two modes (fixed or independent). For example "version": "independent" OR "version": "1.0.0"' + ); } if ((this.options as InitCommandOption).independent && !this.project.isIndependent()) { diff --git a/packages/version/README.md b/packages/version/README.md index 062f2fe7..9ca5c9c8 100644 --- a/packages/version/README.md +++ b/packages/version/README.md @@ -20,6 +20,8 @@ npm install @lerna-lite/cli -D -W lerna version ``` +> **Note** please make sure that you have a `lerna.json` config file and a `version` property defined with either a fixed or independent mode (for example: `"version": "independent"`). An error will be thrown if you're missing any of them. + ## Usage ```sh