CLI version check (#3277)

### Description

Added version check functionality to CLI

### Backward compatibility

Yes

### Testing

Manual
pull/3280/head
Arman Aurobindo 9 months ago committed by GitHub
parent 6d4266ae93
commit 5f3d443e99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      typescript/cli/cli.ts
  2. 1
      typescript/cli/package.json
  3. 11
      typescript/cli/src/utils/version-check.ts
  4. 45
      yarn.lock

@ -8,6 +8,7 @@ import { configCommand } from './src/commands/config.js';
import { deployCommand } from './src/commands/deploy.js';
import { sendCommand } from './src/commands/send.js';
import { statusCommand } from './src/commands/status.js';
import { checkVersion } from './src/utils/version-check.js';
import { VERSION } from './src/version.js';
// From yargs code:
@ -15,6 +16,8 @@ const MISSING_PARAMS_ERROR = 'Not enough non-option arguments';
console.log(chalk.blue('Hyperlane'), chalk.magentaBright('CLI'));
await checkVersion();
try {
await yargs(process.argv.slice(2))
.scriptName('hyperlane')

@ -9,6 +9,7 @@
"bignumber.js": "^9.1.1",
"chalk": "^5.3.0",
"ethers": "^5.7.2",
"latest-version": "^8.0.0",
"terminal-link": "^3.0.0",
"yaml": "^2.3.1",
"yargs": "^17.7.2",

@ -0,0 +1,11 @@
import latestVersion from 'latest-version';
import { log } from '../../logger.js';
import { VERSION } from '../version.js';
export async function checkVersion() {
const currentVersion = await latestVersion('@hyperlane-xyz/cli');
if (VERSION < currentVersion) {
log(`Your CLI version: ${VERSION}, latest version: ${currentVersion}`);
}
}

@ -4249,6 +4249,7 @@ __metadata:
eslint: "npm:^8.43.0"
eslint-config-prettier: "npm:^8.8.0"
ethers: "npm:^5.7.2"
latest-version: "npm:^8.0.0"
mocha: "npm:^10.2.0"
prettier: "npm:^2.8.8"
terminal-link: "npm:^3.0.0"
@ -10649,6 +10650,25 @@ __metadata:
languageName: node
linkType: hard
"got@npm:^13.0.0":
version: 13.0.0
resolution: "got@npm:13.0.0"
dependencies:
"@sindresorhus/is": "npm:^5.2.0"
"@szmarczak/http-timer": "npm:^5.0.1"
cacheable-lookup: "npm:^7.0.0"
cacheable-request: "npm:^10.2.8"
decompress-response: "npm:^6.0.0"
form-data-encoder: "npm:^2.1.2"
get-stream: "npm:^6.0.1"
http2-wrapper: "npm:^2.1.10"
lowercase-keys: "npm:^3.0.0"
p-cancelable: "npm:^3.0.0"
responselike: "npm:^3.0.0"
checksum: 35ac9fe37daca3d0a4f90305d8e64626268ef5a42584f5bcb42eea3cb9bbeb691cf9041d5ea72133a7295d1291684789a3148ff89a95f3d3ce3d0ebb6fb2f680
languageName: node
linkType: hard
"got@npm:^7.1.0":
version: 7.1.0
resolution: "got@npm:7.1.0"
@ -12057,6 +12077,15 @@ __metadata:
languageName: node
linkType: hard
"latest-version@npm:^8.0.0":
version: 8.0.0
resolution: "latest-version@npm:8.0.0"
dependencies:
package-json: "npm:^9.0.0"
checksum: 8ef0ff0006a9df21a191991fbaee74b7bcd8f20d75dba0ac92932944a22625f1e76aadd33feb0ba1cfa45846a6238625ae603453189f71cf3c5c358989929aea
languageName: node
linkType: hard
"level-codec@npm:^9.0.0":
version: 9.0.2
resolution: "level-codec@npm:9.0.2"
@ -13913,6 +13942,18 @@ __metadata:
languageName: node
linkType: hard
"package-json@npm:^9.0.0":
version: 9.0.0
resolution: "package-json@npm:9.0.0"
dependencies:
got: "npm:^13.0.0"
registry-auth-token: "npm:^5.0.2"
registry-url: "npm:^6.0.1"
semver: "npm:^7.5.4"
checksum: 7c3847b521b221a7f80264880e0c8b0f290796072771fb1c1d0dc36d0c59141e8eff6aa2b05056f8e85f07d872e2e68032378b674be4252311e3328b02df3e01
languageName: node
linkType: hard
"pako@npm:^2.0.2":
version: 2.1.0
resolution: "pako@npm:2.1.0"
@ -14656,7 +14697,7 @@ __metadata:
languageName: node
linkType: hard
"registry-auth-token@npm:^5.0.1":
"registry-auth-token@npm:^5.0.1, registry-auth-token@npm:^5.0.2":
version: 5.0.2
resolution: "registry-auth-token@npm:5.0.2"
dependencies:
@ -14665,7 +14706,7 @@ __metadata:
languageName: node
linkType: hard
"registry-url@npm:^6.0.0":
"registry-url@npm:^6.0.0, registry-url@npm:^6.0.1":
version: 6.0.1
resolution: "registry-url@npm:6.0.1"
dependencies:

Loading…
Cancel
Save