Skip to content

Commit

Permalink
fix(version): highlight version prop required in lerna.json (#486)
Browse files Browse the repository at this point in the history
- highlight the fact that `version` is a required property to exist in the `lerna.json` config
- closes #485
  • Loading branch information
ghiscoding committed Feb 20, 2023
1 parent 32d06de commit 8720397
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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).

Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,10 @@ export class Command<T extends AvailableCommandOption> {
}

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()) {
Expand Down
2 changes: 2 additions & 0 deletions packages/version/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8720397

Please sign in to comment.