-
Notifications
You must be signed in to change notification settings - Fork 190
Expand file tree
/
Copy pathinit-script-version-solana.ts
More file actions
33 lines (32 loc) · 1.03 KB
/
init-script-version-solana.ts
File metadata and controls
33 lines (32 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { log } from '@clack/prompts'
import { bold, yellow } from 'picocolors'
import { getVersion } from './get-version'
import { validateVersion } from './validate-version'
export async function initScriptVersionSolana(required?: string, verbose = false) {
if (!required) {
return
}
try {
const { valid, version } = validateVersion({ required, version: getVersion('solana') })
if (verbose) {
log.warn(`initScriptVersionSolana: required: ${required}, version: ${version ?? '*none*'}, valid: ${valid}`)
}
if (!version) {
log.warn(
[
bold(yellow(`Could not find Solana version. Please install Solana.`)),
'https://docs.solana.com/cli/install-solana-cli-tools',
].join(' '),
)
} else if (!valid) {
log.warn(
[
yellow(`Found Solana version ${version}. Expected Solana version ${required}.`),
'https://docs.solana.com/cli/install-solana-cli-tools',
].join(' '),
)
}
} catch (error_) {
log.warn(`Error ${error_}`)
}
}