Aller au contenu principal
Version: 3.0.0

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.

$ npx midway-version@latest

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)
$ 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

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 become 3.16.2

  • Write the 3.16.2 version to the lock file (if any)

$ 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