Deploy a site
The leaf deploy command detects your framework, runs your project build, hashes generated assets, and deploys them to LeafCloud edge locations.
The deploy command
Section titled “The deploy command”Run leaf deploy from your project’s root folder:
leaf deployWhat happens during a deploy:
- Framework detection:
leafinspects your project files (package.json, configuration files, and lockfiles) to detect your static site framework and package manager. - Site build: If a build command is required,
leafexecutes the command (for examplebun run buildornpm run build), ensuring your localnode_modules/.bintools are in the execution path. - Asset hashing: The contents of your output directory are scanned and hashed using SHA-256.
- Differential upload: Only new or changed files are uploaded. Identical files from previous deployments are reused instantly.
- Instant activation: Once uploads complete, the new deployment is finalized and made live on Indian edge locations.
Preview with --dry-run
Section titled “Preview with --dry-run”The --dry-run flag tests framework detection, executes the build command, and hashes output files without authenticating or uploading anything:
leaf deploy --dry-runOutput:
Framework: AstroPackage manager: npmBuild command: npm run buildOutput directory: distFiles: 3Total size: 1716 bytesDry run: nothing was uploaded.With --json, --dry-run returns structured metadata:
leaf deploy --dry-run --json{ "schema": 1, "type": "dry_run", "data": { "framework": "Astro", "package_manager": "npm", "build": ["npm", "run", "build"], "output_dir": "dist", "files": 3, "bytes": 1716 }}Because --dry-run makes zero network requests and does not check for credentials, it is safe to use in local validation, pre-commit hooks, and CI checks.
Deploy scans the exact files in its upload manifest for private-key blocks (in the first 1 MB of each file) and credential filenames. A matching file refuses the whole deploy; remove it from the output folder. The CLI has an explicit --allow-secrets override for files you are certain are meant to be public. MCP deploys never expose this override.
Skip the build step with --no-build
Section titled “Skip the build step with --no-build”If you have already built your project or want to deploy pre-rendered static assets directly, pass --no-build:
leaf deploy --no-buildleaf will skip running the build command and immediately inspect the output folder.
Specify an output directory
Section titled “Specify an output directory”To deploy a specific folder instead of letting leaf auto-detect your framework output folder, use --dir or provide the path as a positional argument:
# Using the --dir flagleaf deploy --dir dist
# Or using a positional pathleaf deploy distNote: You cannot specify both a positional path and
--dir. Use one or the other.
Non-interactive deploys
Section titled “Non-interactive deploys”In CI/CD environments or scripts, pass --yes to suppress interactive prompts and --json for machine-readable output:
leaf deploy --yes --json