Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(version): highlight version prop required in lerna.json #486

Merged
merged 1 commit into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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