CLI reference
Blueprints
Reference documentation for the Sanity CLI Blueprints command.
The blueprints
CLI command enables initializing, managing, and deploying Blueprints and resources like Functions.
usage: npx sanity blueprints [--default] [-v|--version] [-d|--debug] [-h|--help] <command> [<args>]
Commands:
add Add a Resource to a Blueprint
config View or edit local Blueprints configuration
deploy Deploy a Blueprint to create or update a Stack
destroy Destroy a Blueprint to undeploy the Stack
info Retrieve information about a Blueprint Stack
init Initialize a new Blueprint manifest file
logs Display logs for the current Blueprint Stack
plan Enumerate Resources to be deployed
stacks List all Blueprint Stacks for the current Project
See 'npx sanity help blueprints <command>' for specific information on a subcommand.
Commands
add
usage: npx sanity blueprints add <type> [--name <name>] [--fn-type <document-publish>] [--fn-lang <ts|js>] [--javascript]
Add a Resource to a Blueprint
Arguments
<type> Type of Resource to add (currently only 'function' is supported)
Options
--name, -n <name> Name of the Resource
--fn-type <type> Type of Function to add (e.g. document-publish)
--fn-language, --lang <ts|js> Language of the Function. Default: "ts"
--js, --javascript Shortcut for --fn-language=js
--fn-helpers, --helpers Add helpers to the Function
--no-fn-helpers Do not add helpers to the Function
--fn-installer, Package manager to use for Function helpers
--installer <npm|pnpm|yarn> sets --fn-helpers to true
--install, -i Shortcut for --fn-installer=npm
Examples:
# Add a Function (TypeScript by default)
sanity blueprints add function
# Add a Function with a specific name and install helpers with npm
sanity blueprints add function --name my-function -i
# Add a Function with a specific type
sanity blueprints add function --fn-type document-publish
# Add a JavaScript Function
sanity blueprints add function --js
# Add a Function without helpers
sanity blueprints add function --no-fn-helpers
# Add a document-publish .js Function with helpers and install with npm
sanity blueprints add function -n roboto --fn-type document-publish --js -i
config
usage: npx sanity blueprints config [--edit] [-e] [--test] [-t] [--project-id <id>]
View or edit local Blueprints configuration
Options
--edit, -e Edit the configuration
--test, -t Test the configuration
--project-id <id> Project ID to use
Examples:
# View current configuration
sanity blueprints config
# Edit configuration
sanity blueprints config --edit
# Test configuration
sanity blueprints config --test
# Edit and test configuration
sanity blueprints config -et
deploy
usage: npx sanity blueprints deploy [--no-wait]
Deploy a Blueprint to create or update a Stack
Options
--no-wait Do not wait for deployment to complete
Examples:
# Deploy the current blueprint
sanity blueprints deploy
# Deploy the current blueprint without waiting for completion
sanity blueprints deploy --no-wait
destroy
usage: npx sanity blueprints destroy [--force] [-f] [--no-wait]
Destroy a Blueprint deployment
Options
--force, -f Force destroy without confirmation
--no-wait Do not wait for destroy to complete
Examples:
# Destroy the current deployment
sanity blueprints destroy
# Force destroy without confirmation
sanity blueprints destroy --force
# Destroy without waiting for completion
sanity blueprints destroy --no-wait
info
usage: npx sanity blueprints info
Retrieve information about a Blueprint Stack
Examples:
# Retrieve information about the current Stack
sanity blueprints info
init
usage: npx sanity blueprints init [dir] [--blueprint-type <type>] [--project-id <id>]
Initialize a new Blueprint manifest file
Arguments
[dir] Path to initialize the Blueprint in
Options
--blueprint-type, --type <json> Type of Blueprint to create
--project-id <id> Project ID to use
Examples:
# Create a new Blueprint manifest file in the current directory
sanity blueprints init
# Create a new Blueprint manifest file in a specific directory
sanity blueprints init my-sanity-project --type json
logs
usage: npx sanity blueprints logs [--watch] [-w]
Display logs for the current Blueprint Stack
Options
--watch, -w Watch for new logs (streaming mode)
Examples:
# Show logs for the current Stack
sanity blueprints logs
# Watch for new logs (streaming mode)
sanity blueprints logs --watch
plan
usage: npx sanity blueprints plan
Enumerate Resources to be deployed
Safe to run at any time. Will not modify any Resources.
Examples:
# Show deployment plan for the current Blueprint
sanity blueprints plan
Was this page helpful?