目录

ohpm dependency-check

Queries the version update information of third-party libraries (supported since ohpm 6.1.1.830).

Command Format

ohpm dependency-check [options] [<@group>/<pkg>]
  • @group: namespace of the third-party library. This parameter is optional.
  • pkg: name of the third-party library. This parameter is optional.

Description

Checks for version updates of the currently imported third-party libraries.

Options

[h2]registry

You can append the --registry <registry> parameter to the ohpm dependency-check command to specify the repository address. If this parameter is not manually configured, the command will use the repository address from the configuration file.

[h2]fetch_timeout

You can append the --ft <number> or --fetch_timeout <number> parameter to the ohpm dependency-check command to set the timeout period for the query operation (unit: ms). If this parameter is not set, the timeout period is 60000 ms.

[h2]strict_ssl

If no parameter is appended to the ohpm dependency-check command, or the --strict_ssl or --strict_ssl true parameter is appended, HTTPS certificate verification is enabled.

In ohpm 26.0.0.630 and later versions, to disable verification, append --no-strict_ssl (recommended) or --strict_ssl false to the command.

[h2]retry_times

You can append the --rt <number> or --retry_times <number> parameter to the ohpm dependency-check command to set the number of retries upon a failure. If this parameter is not set, the default value 1 is used.

[h2]retry_interval

You can append the --ri <number> or --retry_interval <number> parameter to the ohpm dependency-check command to set the retry interval (unit: ms). If this parameter is not set, the default interval is 1000 ms.

[h2]all-modules

You can append the --all or --all-modules parameter to the ohpm dependency-check command to obtain the version update information of third-party libraries in all modules (including those in the project root directory).

[h2]modules

You can append the -m <string> or --modules<string> parameter to the ohpm dependency-check command to obtain the version update information of third-party libraries in the specified modules. string can be one or more module names separated by commas (,).

[h2]project

You can append the -p or --project parameter to the ohpm dependency-check command to obtain the version update information of third-party libraries in the project-level directory.

[h2]dev

You can append the -d or --dev parameter to the ohpm dependency-check command to obtain the version update information of third-party libraries in devDependencies of the oh-package.json5 file. By default, the command obtains the update information from the dependencies field.

[h2]json

You can append the -j or --json parameter to the ohpm dependency-check command to output the obtained version update information in JSON format to the console and save it to the dependency-check-output.json file in the project-level directory. If this parameter is not set, the information is output in table format to the console or to the dependency-check-output.txt file.

[h2]long

You can append the -l or --long parameter to the ohpm dependency-check command to obtain detailed version update information of third-party libraries. If this parameter is not set, the brief version update information is obtained. For details about the detailed and brief update information, see Examples.

[h2]console

You can append the -c or --console parameter to the ohpm dependency-check command. By default, the obtained update information is output to the dependency-check-output.txt file in the project-level directory. With this parameter, the information is also output to the console.

Rules for querying the version update information of third-party libraries:

  • If you specify a package name (pkg) when querying all modules, the command checks for updates of that library in all modules (including those in the project root directory). If no package name is specified, the command checks all third-party libraries in all modules (including those in the project root directory).
  • If you specify a package name (pkg) when querying specified modules, the command checks for updates of that library in the specified modules. If no package name is specified, the command checks all third-party libraries in the specified modules.
  • If you specify a package name (pkg) when querying the specified project, the command checks for updates of that library in the project. If no package name is specified, the command checks all third-party libraries in the specified project.
  • If all-modules, modules, project are configured simultaneously, the query scope follows the priority: all-modules > modules > project. If none are configured, the query scope defaults to project.

Examples

[h2]Example 1

To obtain the detailed version update information of third-party libraries, run the following command:

ohpm dc --all -c -l

Example output:

package                installed   wanted      latest  type   description     dependedBy  dependencyType  homepage                                                 
----------------------------------------------------------------------------------------------------------------------
checkupdate_pkgc3      1.2.0       1.2.0       1.2.0   match  update to date  library     prod            http://a.c
checkupdate_pkgc5      0.1.1       0.1.1       0.1.2   match  update to date  library     prod            http://a.c
checkupdate_pkgc2      2.0.0       2.0.0       2.0.0   match  update to date  library     prod            http://a.c
checkupdate_pkgea4     1.0.0       1.0.0       1.0.0   match  update to date  project     prod
@js-joda/core          5.5.2       5.5.2       5.6.0   match  update to date  project     prod            https://c.d
test-check-update      3.8.9-beta  3.8.9-beta  4.0.0   match  update to date  project     prod            https://a.y
Here are the recommended replacement packages for the following dependent packages :
checkupdate_pkgea4->checkupdate_test@2.0.0-beta, third-party test library
checkupdate_pkgea4->@fdddd/test@1.1.5, third-party test library
@js-joda/core->checkupdate_test@2.0.0-beta, third-party test library
@js-joda/core->@fdddd/test@1.1.5, third-party test library
test-check-update->checkupdate_test@2.0.0, third-party test library
Here is the security update information: 2 package container 2 vulnerabilities,2 malwares
checkupdate_pkgea4@1.0.0, CVE-xxxx-xxxx test, cross-site scripting (XSS) vulnerability,
checkupdate_pkgea4@1.0.0, asfasdf
test-check-update@3.8.9-beta, CVE-xxxx-xxxxx test, XSS vulnerability
test-check-update@3.8.9-beta, virusxxx

[h2]Example 2

To obtain the brief version update information of third-party libraries, run the following command:

ohpm dc --all -c

Example output:

package                installed   wanted      latest  type     dependedBy                                                   
----------------------------------------------------------------------------
checkupdate_pkgc3      1.2.0       1.2.0       1.2.0   match    library     
checkupdate_pkgc5      0.1.1       0.1.1       0.1.2   match    library     
checkupdate_pkgc2      2.0.0       2.0.0       2.0.0   match    library     
checkupdate_pkgea4     1.0.0       1.0.0       1.0.0   match    project     
@js-joda/core          5.5.2       5.5.2       5.6.0   match    project     
test-check-update      3.8.9-beta  3.8.9-beta  4.0.0   match    project     
Here are the recommended replacement packages for the following dependent packages :
checkupdate_pkgea4->checkupdate_test@2.0.0-beta, third-party test library
checkupdate_pkgea4->@fdddd/test@1.1.5, third-party test library
@js-joda/core->checkupdate_test@2.0.0-beta, third-party test library
@js-joda/core->@fdddd/test@1.1.5, third-party test library
test-check-update->checkupdate_test@2.0.0, third-party test library
Here is the security update information: 2 package container 2 vulnerabilities,2 malwares
checkupdate_pkgea4@1.0.0, CVE-xxxx-xxxx test, XSS vulnerability,
checkupdate_pkgea4@1.0.0, asfasdf
test-check-update@3.8.9-beta, CVE-xxxx-xxxxx test, XSS vulnerability
test-check-update@3.8.9-beta, virusxxx