[Front-end] Use lerna version to update the version number

lerna versionis a tool for management monorepo(multi-package repositories) that helps you coordinate version number updates and releases across multiple related packages. Here are the general steps for updating version numbers using lerna version:

  1. Install Lerna: First, you need to install Lerna in your project. You can install it using npm:
npm install -g lerna
  1. Initialize the Lerna repository: If your project does not yet have a Lerna repository, you can use the following command to initialize one:
lerna init
  1. Write code and update the version number: Before updating the version number, make sure you have modified and tested the code accordingly.

  2. Run lerna versionthe command: Use lerna versionthe command to update the version number. This command will:

You are prompted to select the type of version to update (major, minor, or patch).
Update the version number of the package, including making corresponding changes in the package.json file.
Generate a new git commit containing updated version number information.
Create git tags for each package as needed.
Run the following command to update the version number using interactive mode:

lerna version

Alternatively, you can specify the version type directly using the following command:

lerna version --semver major
lerna version --semver minor
lerna version --semver patch
  1. Confirm update: Lerna will display a summary before the version number is updated, showing the package and version number that will be updated. After confirming that it is correct, Lerna will perform a version update operation.

  2. Push updates: After updating the version number, you can push the modifications and new version number tags to the remote Git repository:

git push origin main
git push --tags
  1. Publish to npm (optional): If your package needs to be published to npm, you can use Lerna's lerna publish command to complete the publishing process. This will publish the updated package to the npm repository.
lerna publish

Guess you like

Origin blog.csdn.net/macaiyun0629/article/details/132593719