-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CLI versions to workspace Cargo.toml and Solana check scripts (#75)
- Loading branch information
1 parent
2e17eb9
commit 4adf466
Showing
12 changed files
with
142 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"create-solana-program": patch | ||
--- | ||
|
||
Add CLI versions to workspace Cargo.toml and Solana check scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env zx | ||
import 'zx/globals'; | ||
import { getInstalledSolanaVersion, getSolanaVersion } from './utils.mjs'; | ||
|
||
const expectedVersion = getSolanaVersion(); | ||
const installedVersion = await getInstalledSolanaVersion(); | ||
|
||
if (installedVersion !== expectedVersion) { | ||
echo( | ||
chalk.yellow('[ WARNING ]'), | ||
`The installed Solana version ${installedVersion} does not match the expected version ${expectedVersion}.` | ||
); | ||
} else { | ||
echo( | ||
chalk.green('[ SUCCESS ]'), | ||
`The expected Solana version ${expectedVersion} is installed.` | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env zx | ||
{% if programFramework === 'anchor' %} | ||
import { getCargoMetadata, getSolanaVersion, getToolchain } from '../utils.mjs'; | ||
{% else %} | ||
import { getSolanaVersion, getToolchain } from '../utils.mjs'; | ||
{% endif %} | ||
|
||
{% if programFramework === 'anchor' %} | ||
await $`echo "ANCHOR_VERSION=${getCargoMetadata()?.cli?.anchor}" >> $GITHUB_ENV`; | ||
{% endif %} | ||
await $`echo "SOLANA_VERSION=${getSolanaVersion()}" >> $GITHUB_ENV`; | ||
await $`echo "TOOLCHAIN_FORMAT=${getToolchain('format')}" >> $GITHUB_ENV`; | ||
await $`echo "TOOLCHAIN_LINT=${getToolchain('lint')}" >> $GITHUB_ENV`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env zx | ||
import 'zx/globals'; | ||
import { getInstalledSolanaVersion, getSolanaVersion } from './utils.mjs'; | ||
|
||
const installedVersion = await getInstalledSolanaVersion(); | ||
const expectedVersion = getSolanaVersion(); | ||
|
||
if (installedVersion === expectedVersion) { | ||
echo( | ||
chalk.green('[ SUCCESS ]'), | ||
`The expected Solana version ${expectedVersion} is installed.` | ||
); | ||
process.exit(0); | ||
} | ||
|
||
const installPath = path.join( | ||
os.homedir(), | ||
'.local', | ||
'share', | ||
'solana', | ||
'install' | ||
); | ||
const releasePath = path.join( | ||
installPath, | ||
'releases', | ||
expectedVersion, | ||
'solana-release' | ||
); | ||
const activeReleasePath = path.join(installPath, 'active_release'); | ||
const hasRelease = await fs.exists(releasePath); | ||
|
||
if (hasRelease) { | ||
await $`rm -f "${activeReleasePath}"`; | ||
await $`ln -s "${releasePath}" "${activeReleasePath}"`; | ||
echo( | ||
chalk.green('[ SUCCESS ]'), | ||
`Successfully switched from Solana version ${installedVersion} to ${expectedVersion} to match the project's requirements.` | ||
); | ||
process.exit(0); | ||
} | ||
|
||
echo( | ||
chalk.yellow('[ WARNING ]'), | ||
`Cannot switch from Solana version ${installedVersion} to ${expectedVersion} because it is not installed.` | ||
); | ||
|
||
const installRelease = await question('Should we install it now? [y/N] '); | ||
if (installRelease === 'y') { | ||
echo(`Installing Solana ${expectedVersion}...`); | ||
await $`sh -c "$(curl -sSfL https://release.solana.com/v${expectedVersion}/install)"`; | ||
} | ||
|
||
echo( | ||
chalk.green('[ SUCCESS ]'), | ||
`Successfully switched from Solana version ${installedVersion} to ${expectedVersion} to match the project's requirements.` | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters