Version check tool
Due to the uncertainty of the installed version of dependencies, Midway provides a version check tool midway-version
, which can quickly check compatibility errors between versions.
Check compatibility
You can use the following command to execute the check in the project root directory.
The following command will check the version actually installed in node_modules
, not the version written in package.json
.
- npm
- pnpm
- yarn
$ npx midway-version@latest
$ pnpx midway-version@latest
$ yarn add midway-version@latest
$ yarn midway-version
Upgrade to the latest version
You can use the following command to execute the upgrade in the project root directory.
The -u
parameter will check all midway modules and upgrade them to the latest
version according to the actual installed version in node_modules
and the version written in package.json
.
If the currently installed component version is 3.16.2
and the latest version is 3.18.0
, you will be prompted to upgrade to 3.18.0
.
When using the -u -w
parameter:
- Update the version of
package.json
and keep the prefix, for example,^3.16.0
will become^3.18.0
- Write the
3.18.0
version to the lock file (if exists)
- npm
- pnpm
- yarn
$ npx midway-version@latest -u
After confirming that the output is correct, you can use the -w
parameter to write the package.json
and package-lock.json
files (if exists).
$ npx midway-version@latest -u -w
$ pnpx midway-version@latest -u
After the output is confirmed to be correct, you can use the -w
parameter to write package.json
and pnpm-lock.yaml
files (if exists).
$ pnpx midway-version@latest -u -w
$ yarn add midway-version@latest
$ yarn midway-version -u
After the output is confirmed to be correct, you can use the -w
parameter to write package.json
and yarn.lock
files (if exists).
$ yarn midway-version -u -w
Upgrade to the latest compatible version
The -m
parameter will check all midway modules and upgrade them to the latest compatible
version according to the actual installed version in node_modules
and the version written in package.json
.
If the currently installed component version is 3.16.0
, the latest version is 3.18.0
, and the compatible versions are 3.16.1
and 3.16.2
, it will prompt to upgrade to 3.16.2
.
The -m
parameter is generally used to fix the lower version and check the wrong component version, so the strategy is different from -u
.
When using the -m -w
parameter:
-
Update the version of
package.json
-
If there is a lock file, the prefix will be retained, such as
^3.16.0
will become^3.16.2
-
If there is no lock file, the prefix will be removed and the version will be fixed, such as
^3.16.0
will become3.16.2
-
Write the
3.16.2
version to the lock file (if any)
- npm
- pnpm
- yarn
$ npx midway-version@latest -m
After confirming that the output is correct, you can use the -w
parameter to write the package.json
and package-lock.json
files (if exists).
$ npx midway-version@latest -m -w
$ pnpx midway-version@latest -m
After the output is confirmed to be correct, you can use the -w
parameter to write package.json
and pnpm-lock.yaml
files (if exists).
$ pnpx midway-version@latest -m -w
$ yarn add midway-version@latest
$ yarn midway-version -m
After the output is confirmed to be correct, you can use the -w
parameter to write package.json
and yarn.lock
files (if exists).
$ yarn midway-version -m -w