title = "Managing Templates" template = "main" date = "2023-11-04T00:00:01Z" enable_shortcodes = true [extra] url = "https://github.com/spinframework/spin-docs/blob/main/content/v3/managing-templates.md"
- Installing Templates
- Viewing Your Installed Templates
- Uninstalling Templates
- Upgrading Templates
- Next Steps
Templates are a Spin tool for scaffolding new applications and components. You can use them via the spin new and spin add commands. For more information about creating applications with templates, see Writing Spin Applications.
This section covers general principles for installing templates. For information about installing templates for specific languages, see Writing Spin Applications.
To install templates, use the spin templates install command. You can install templates from a Git repository, or while authoring templates you can install them from a local directory.
To install templates from the Spin Git repository, run spin templates install --git:
$ spin templates install --git https://github.com/spinframework/spinIf you prefer a shorter command, you can just pass the repository id instead of the full URL:
$ spin templates install --git fermyon/spinThe above command installs all templates in the repository.
Language SDKs often ship templates in their repositories; see the relevant language guide to find out where to get its templates.
By default, if you install templates from a Git repository, Spin tries to find a repo tag that matches the version of Spin, and installs from that tag. Failing this, it installs from HEAD. If you would like to install from a specific tag or branch, pass the --branch option:
$ spin templates install --git https://github.com/spinframework/spin --branch spin/templates/v0.8To install templates from your local file system, run spin templates install --dir.
The directory you pass must be one that contains a
templatesdirectory. Don't pass thetemplatesdirectory itself!
# Expects to find a directory ~/dev/spin-befunge-sdk/templates
$ spin templates install --dir ~/dev/spin-befunge-sdkSee Template Authoring for more details on this layout.
To install templates from a remote tarball, run spin templates install --tar.
The tarball must have a
/templatesdirectory at its root, or have a single root directory and have atemplatesdirectory within that. This slightly complicated rule is so that it works correctly with a GitHub release tarball, which always has a root directory named after the release.
$ spin templates install --tar https://github.com/spinframework/spin/archive/refs/tags/v9.8.7.tar.gzTo see what templates you have installed, run spin templates list.
You can use the --verbose option to see additional information such as where they were installed from.
You can uninstall templates using spin templates uninstall with the template name:
$ spin templates uninstall redis-befungeSpin doesn't currently support uninstalling a whole repo-worth of templates, only individual templates.
When you upgrade Spin, you will typically want to upgrade your templates to match. This means new applications and components will get dependencies that match the Spin version you are using. To do this, run spin templates upgrade:
$ spin templates upgrade
Select repos to upgrade. Use Space to select/deselect and Enter to confirm selection.
[x] https://github.com/spinframework/spin-python-sdk
[ ] https://github.com/spinframework/spin (at spin/templates/v1.0)
> [x] https://github.com/spinframework/spin-js-sdkUse the cursor keys and the space bar to select the repositories you want to upgrade, then hit Enter to upgrade the selected repositories.
Upgrading happens at the repo level, not the individual template level. If you've uninstalled templates, upgrading the repo they came from will bring them back.
If you want to upgrade all repositories without being prompted, run spin templates upgrade --all.
As mentioned above, if you want to check which templates come from which repositories use --verbose i.e. spin templates list --verbose.
spin templates upgrade only upgrades from Git repositories. If you want to upgrade and your templates are in a local directory, run the spin templates install command with the --upgrade flag:
$ spin templates install --dir ~/dev/spin-befunge-sdk --upgrade