Introducing a new way to review your PRs.

Read the announcement

solana-foundation / create-solana-dapp

The fastest way to create Solana apps 🚀 Templates 👉 https://github.com/solana-foundation/templates

View on GitHub

18 documents · Updated Nov 6, 2026

docs / version-resolution-and-compatibility

Version resolution and compatibility

Version handling protects generated Solana projects from running with missing or too-old command-line tools. The system reads version requirements from a template, checks the matching local tools, and gives install or update guidance without changing the user's tool installation.

Version sources and tool scope

Template authors declare minimum tool versions in the create-solana-dapp init script. The version block is optional, and each supported requirement is optional, so a template can ask for only the tools that its setup needs. The schema currently accepts adb, anchor, and solana for template checks. src/…/init-script-schema.ts• L13-17 and README.md• L48-53.

The wider version list also covers avm and rust. These tools can be inspected by the installed-version report, but template compatibility checks currently run only for the three tools declared in the init-script flow. src/…/get-version-command.ts• L1-29 and src/…/init-script-version.ts• L5-15.

Version discovery and parsing

Version discovery maps a tool name to the command that reports its version and to the output pattern that identifies the semantic version. The system runs the command, reads standard output, and extracts the first matching version value. src/…/get-version-command.ts• L1-33 and src/…/parse-version.ts• L3-16.

The supported commands and output forms are:

ToolVersion commandExpected output marker
adbadb --versionVersion x.y.z
anchoranchor --versionanchor-cli x.y.z
avmavm --versionavm x.y.z
rustrustc --versionrustc x.y.z
solanasolana --versionsolana-cli x.y.z

The public lookup returns undefined when a known tool cannot run or its output does not match the expected form. An unknown tool name is a configuration or caller error and raises an error instead. src/…/get-version.ts• L4-14.

Compatibility validation

Compatibility means that the installed version is at least the template's required version. The validator uses semantic-version comparison with a >= rule, so an equal or newer version passes while a missing, malformed, or older version fails. src/…/validate-version.ts• L3-10.

The template init flow checks each declared requirement in sequence. A missing requirement causes no check. A missing tool or an incompatible tool produces a warning and a help link. A compatible tool produces no warning, and the check does not install or update anything. src/…/init-script-version-check.ts• L8-45 and src/…/init-script-version.ts• L5-18.

This diagram shows how a template requirement becomes a local compatibility result during project creation.

flowchart LR
    A[Template versions] --> B[Required tool and minimum version]
    B --> C[Select version command]
    C --> D[Read local tool output]
    D --> E[Parse semantic version]
    E --> F{Version >= requirement?}
    F -->|Yes| G[Continue without warning]
    F -->|No or missing| H[Warn with install or update guidance]

Release guidance and URL selection

Release guidance connects each tool check to documentation that can fix the problem. The URL table provides an install link and may provide a version-specific update link. When no separate update link exists, the install link serves both purposes; an {required} marker is replaced with the required version for links such as Anchor release notes. src/…/get-version-urls.ts• L3-29.

The current guidance is:

ToolMissing toolOlder tool
adbExpo Android setup guideExpo Android setup guide
anchorAnchor installation guideRequired Anchor release notes
solanaSolana installation guideSolana installation guide

If a check cannot resolve a tool's version, the warning asks the user to install it. If the version is present but too old, the warning reports the found and expected versions and points to update guidance. These are advisory warnings. The project setup flow does not resolve a tool by downloading a release. src/…/init-script-version-check.ts• L13-41.

Installed-version reporting

The --list-versions command gives a quick availability view for all known tools. It uses the same command and parsing rules as compatibility checks, then prints not installed when a version cannot be obtained. src/…/list-versions.ts• L1-10 and src/…/get-args.ts• L33-40.

This report is broader than template compatibility. It includes Anchor, AVM, Rust, and Solana in its user-facing help, plus ADB in the shared command map. A tool that is absent or emits an unexpected version format is reported as unavailable rather than treated as a fatal project-creation error. src/…/get-version-command.ts• L1-36 and src/…/list-versions.ts• L4-9.

CLI release version checks

The CLI also checks whether the create-solana-dapp package itself is current. This check is separate from template tool compatibility: it compares the running package with the latest published package and builds the update command from the package manager selected for the run. src/…/run-version-check.ts• L9-35.

The check stays out of automated or non-interactive runs. It also skips the update failure path for canary builds. For an outdated stable release in an interactive terminal, it shows the package-manager-specific command and exits so the user can rerun with the current CLI. src/…/run-version-check.ts• L18-40.

The generated command uses @latest for npm, pnpm, and bun. Yarn uses its create command without that suffix. The check runs after package-manager flags are resolved and can be disabled with --skip-version-check. src/…/get-args.ts• L84-105 and src/…/run-version-check.ts• L22-36.

Compatibility check lifecycle

The version check runs as part of the generated project's init-script stage. It happens before template option actions, rename work, and deletion work, so version warnings appear before those later setup changes. src/…/create-app-task-run-init-script.ts• L18-48.

When project creation processes an init script, it follows this sequence:

  1. Read the optional versions block.
  2. Skip the version stage when the block is absent.
  3. Check the declared ADB, Anchor, and Solana requirements.
  4. Warn about missing or incompatible tools with the matching guidance URL.
  5. Continue with the remaining init-script actions.

Warnings do not block the remaining init-script actions. This lets a template explain its tool needs while leaving the user in control of installation and update decisions. src/…/init-script-version.ts• L5-18 and src/…/create-app-task-run-init-script.ts• L27-48.

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep each command map entry aligned with its output parser. A changed tool output format can silently turn an installed tool into undefined.
  • Keep template version keys aligned across the init-script schema and the version-check dispatch. A schema key without a dispatched check gives false confidence to template authors.
  • Keep install and update URL coverage aligned with the tools that can fail compatibility checks. Missing guidance leaves users with a warning but no repair path.
  • Keep package-manager command rules aligned with the package-manager selection rules. A mismatch can show a command that does not install the current CLI.
  • Keep the minimum-version contract clear when changing semver rules. Templates rely on newer versions being accepted without an exact-version match.

Important failure modes

TriggerConsequenceGuard
A tool command is absent or cannot executeThe tool appears unavailable and the template emits an install warningUse the tool-specific installation guidance and verify the command is on PATH
Tool output no longer matches its parser patternAn installed tool is treated as missingUpdate the command's output pattern with the tool's supported version format
Installed version is below the template minimumThe init stage warns and points to update guidance, but does not update the toolInstall a version that satisfies the >= requirement before rerunning setup
A template declares a version key that the init flow does not checkThe project can proceed without the intended compatibility warningAdd the key to both the schema and the dispatch set before publishing the template
A stable CLI release is older than the published release in an interactive terminalThe CLI prints an update command and exits before project creationRerun with the shown package-manager command or use --skip-version-check only when the check is not needed

Key files

FileWhy to read it
src/…/init-script-schema.tsDefines the template contract for minimum tool versions.
src/…/get-version-command.tsShows the supported tools, version commands, names, and output patterns.
src/…/get-version.ts and src/…/parse-version.tsExplain how local command output becomes a version value or an unavailable result.
src/…/validate-version.tsDefines the minimum-version compatibility rule.
src/…/init-script-version.ts and src/…/init-script-version-check.tsShow how template requirements are checked and reported during setup.
src/…/get-version-urls.tsMaps missing or old tools to install and update guidance.
src/…/list-versions.tsProvides the user-facing installed-version report.
src/…/run-version-check.tsDefines the separate check for updates to the create CLI itself.
src/…/create-app-task-run-init-script.tsPlaces template compatibility checks in the project creation lifecycle.