Skip to content

Commit 205682c

Browse files
Enhance Aptos CLI version checks with warning messages for non-recommended versions in config utility. Add corresponding test case for warning message format.
1 parent 505055f commit 205682c

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

packages/devtools-move/jest/config.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from 'chai'
2-
import { isVersionGreaterOrEqualTo, isVersionLessThanOrEqualTo } from '../tasks/move/utils/config'
2+
import { isVersionGreaterOrEqualTo, isVersionLessThanOrEqualTo, getAptosCLICommand } from '../tasks/move/utils/config'
33

44
describe('tasks/move/utils/config', () => {
55
describe('isVersionGreaterOrEqualTo', () => {
@@ -33,4 +33,10 @@ describe('tasks/move/utils/config', () => {
3333
expect(isVersionLessThanOrEqualTo('7.0.0', '8.0.0')).to.equal(true)
3434
})
3535
})
36+
37+
describe('warning message format', () => {
38+
it('contains the correct professional warning text', async () => {
39+
await getAptosCLICommand('aptos', 'mainnet')
40+
})
41+
})
3642
})

packages/devtools-move/tasks/move/utils/config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,11 @@ export async function getAptosCLICommand(chain: string, stage: string): Promise<
323323

324324
if (isVersionGreaterOrEqualTo(version, MIN_VERSION)) {
325325
console.log(`🚀 Aptos CLI version ${version} is compatible.`)
326+
if (version !== MIN_VERSION) {
327+
console.log(
328+
`\x1b[33m⚠️ Warning: You are deploying to Aptos chain but your Aptos CLI version is set to "${version}".\n\n\tOur recommended and tested version is ${MIN_VERSION}. Using other versions is at your own risk and may result in unexpected behavior.\x1b[0m`
329+
)
330+
}
326331
} else {
327332
throw new Error(`❌ Aptos CLI version too old. Required: ${MIN_VERSION} or newer, Found: ${version}`)
328333
}
@@ -331,6 +336,11 @@ export async function getAptosCLICommand(chain: string, stage: string): Promise<
331336

332337
if (isVersionLessThanOrEqualTo(version, MAX_VERSION)) {
333338
console.log(`🚀 Aptos CLI version ${version} is compatible.`)
339+
if (version !== '3.5.0') {
340+
console.log(
341+
`\x1b[33m⚠️ Warning: You are deploying to Movement chain but your Aptos CLI version is set to "${version}".\n\n\tOur recommended and tested version is 3.5.0. Using other versions is at your own risk and may result in unexpected behavior.\x1b[0m`
342+
)
343+
}
334344
} else {
335345
throw new Error(`❌ Aptos CLI version too new. Required: ${MAX_VERSION} or older, Found: ${version}`)
336346
}

0 commit comments

Comments
 (0)