tcb app deploy
Deploys a single static hosting app. It automatically runs install dependencies → build → upload artifacts → bind routes, and overwrites the previous deployment.
- Frontend projects with install + build steps (React / Vue / Next.js / Vite / Angular / Nuxt, etc.)
- Pure static projects
- Automated deployment in CI/CD pipelines
Usage
tcb app deploy [serviceName] [options]
Flags
| Flag | Required | Description | Default |
|---|---|---|---|
[serviceName] | No | App name; reads from package.json or prompts interactively if omitted | — |
-e, --env-id <envId> | No | Target environment ID | envId in the config file |
--framework <type> | No | Framework type: react / vue / vite / next / nuxt / angular / static | — |
--install-command <cmd> | No | Install command; leave empty to skip install | npm install |
--build-command <cmd> | No | Build command; leave empty to skip build, suitable for pure static projects | — |
--output-dir <dir> | No | Build output directory, resolved relative to the app directory; use ./ when no build is needed | Auto-detect |
--deploy-path <path> | No | Static hosting mount path | /${serviceName} |
--ignore <patterns> | No | File patterns to ignore, comma-separated, appended after app.ignore | — |
--enable-git-ignore | No | Merge project .gitignore rules | Disabled |
-f, --force | No | Skip confirmation and overwrite when app name already exists | — |
Example
# Deploy a Vite project (run from the project directory)
tcb app deploy --framework vite -e my-env-id
# Interactive guided deployment
tcb app deploy
# Specify the project directory (monorepo scenario)
tcb app deploy --cwd ./frontend -e my-env-id
# Deploy a Next.js project with custom output directory
tcb app deploy --framework next --output-dir .next -e my-env-id
# Pure static project (skip build step)
tcb app deploy --framework static --build-command "" --output-dir ./public -e my-env-id
# CI scenario: skip confirmation, overwrite existing app
tcb app deploy --framework react --force -e my-env-id
# Append ignore patterns (comma-separated), appended after app.ignore
tcb app deploy --ignore "dist/test,.env.local"
# Merge project .gitignore rules (disabled by default, enable explicitly)
tcb app deploy --enable-git-ignore
# Use both: merge .gitignore + append CLI ignore patterns
tcb app deploy --enable-git-ignore --ignore "*.map"
Ignore rule syntax
Both the --ignore option and .gitignore merging (with --enable-git-ignore) follow glob wildcard syntax:
| Syntax | Example | Description |
|---|---|---|
| Wildcard | *.log | Matches file names (* does not cross directory levels) |
| Any level | **/temp | Matches temp at any depth |
| Whole directory | dist/ | Ignores the dist directory and all its contents |
| Root anchored | /build | Matches build only under the upload root |
| Relative path | src/test | Path anchored relative to the upload root |
| Single char / char class | ?.log, [ab].log | Supports single-character wildcard and character classes |
Negation (!): Not supported. Negation rules (e.g. !important.log) in .gitignore or --ignore take no effect; a one-time notice is printed at runtime and the rule is ignored.
Merge priority: default rules (node_modules, .git) > .gitignore (when enabled) > app.ignore > --ignore, all accumulated.
Configure deployment in cloudbaserc.json
In addition to specifying deployment options via CLI parameters, you can configure the app field in cloudbaserc.json for a zero-parameter deployment.
Configuration file structure:
{
"envId": "my-env-id",
"app": {
"serviceName": "my-app",
"root": "./packages/web",
"framework": "react",
"installCommand": "npm install",
"buildCommand": "npm run build",
"outputDir": "build",
"deployPath": "/my-app",
"envVariables": {
"API_URL": "https://api.example.com"
}
}
}
Configuration fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
serviceName | String | No | package.json name or directory name | Static hosting app service name |
root | String | No | Project directory | App root directory (relative to the project directory), for specifying sub-project paths in monorepo scenarios |
framework | String | No | Auto-detect | Frontend framework type, supported values: react, vue, vite, next, nuxt, angular, static |
installCommand | String | No | npm install | Install dependencies command, empty string to skip the install step. Ignored by tcb deploy (that command never builds) |
buildCommand | String | No | Auto-detect based on framework | Build command, empty string to skip the build step (for pure static projects). Ignored by tcb deploy — use tcb app build for a local build instead |
outputDir | String | No | ./dist (./ when no build command) | Build output directory. tcb deploy never builds and uses it only to pick the upload directory: when unset it is inferred from buildCommand / framework / package.json (pure-static items fall back to the project root and the CLI prints the resolved directory; see the declarative deployment FAQ); a missing or empty directory fails with BUILD_OUTPUT_NOT_FOUND |
deployPath | String | No | /${serviceName} | Deployment path (static hosting mount path). A missing leading / is added automatically (web → /web) with a terminal notice; whitespace or shell special characters (semicolons, pipes, redirection operators, $, backticks, wildcards, etc.), ../, or a leading - fail with INVALID_PARAM |
envVariables | Object | No | — | Environment variables (non-sensitive), key-value pairs, injected during cloud build |
ignore | String/Array | No | — | Glob patterns for files/directories to ignore during packaging and upload; see Ignore rule syntax for merge order |
General priority rule: Explicit specification > Declarative configuration > Auto-inference > Interactive prompt
Priority for each parameter:
| Parameter | Priority |
|---|---|
serviceName | CLI positional argument > cloudbaserc.json configuration > Interactive selection > Auto-infer (package.json or directory name) |
root | app.root in cloudbaserc.json > Project directory (set by --cwd) |
framework | --framework option > cloudbaserc.json configuration > Auto-detect (package.json dependencies) > Undefined |
installCommand | --install-command option > cloudbaserc.json configuration > Auto-infer (npm install or empty) > Interactive input |
buildCommand | --build-command option > cloudbaserc.json configuration > Auto-detect (framework defaults or package.json scripts) > Interactive input > Empty string |
outputDir | --output-dir option > cloudbaserc.json configuration > Auto-detect (framework defaults) > Interactive input > ./dist (with build) or ./ (without build) |
deployPath | --deploy-path option > cloudbaserc.json configuration > Interactive input (default: /{serviceName}) |
envVariables | Only read from cloudbaserc.json (no CLI parameter) |
ignore | Default rules (node_modules, .git) > .gitignore (with --enable-git-ignore) > cloudbaserc.json app.ignore > --ignore option, all accumulated |
Special notes:
--cwdonly sets the project directory;config.app.rootis resolved one level below it. The two are combined, not overridden. For example,--cwd apps/shopwithapp.root: ./frontendmakes the app directoryapps/shop/frontend. See Global Options- When
--yesor--jsonis specified, all interactive input is skipped and auto-inferred values are used instead - Framework auto-detection follows this priority: Next.js > Nuxt > Angular > Vite > Vue CLI > React (CRA) > Static HTML
Auto-save: After the first successful deployment, if no app configuration exists in cloudbaserc.json under the project directory, CLI writes the deployment parameters to that file. Subsequent deployments require no repeated input. root is recorded as a sub-path relative to the project directory; the field is omitted when the app directory equals the project directory. deployPath is recorded as the completed absolute path (--deploy-path web is written back as /web), and omitted when it equals the default /{serviceName}.
See the configuration file for the full field reference.
Notes
The tcb app command is available since v3.0.0. Changes in v3.9.0:
tcb deployis no longer an alias for this command —tcb deploy <serviceName>and eight app-only options such as--framework,--build-command,--output-dirfail withINVALID_PARAM; usetcb app deployinstead. See Declarative deployment · Notestcb app buildbuilds bothappandhosting[]— earlier versions built onlyhosting[]
Related commands
- List apps: confirm the result with
tcb app listafter deploying - App details: access domain
- Version list: versions created by each deployment
- Build app: build locally without uploading