Skip to main content

tcb app deploy

Deploys a single static hosting app. It automatically runs install dependencies → build → upload artifacts → bind routes, and overwrites the previous deployment.

When to use
  • 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​

FlagRequiredDescriptionDefault
[serviceName]NoApp name; reads from package.json or prompts interactively if omitted—
-e, --env-id <envId>NoTarget environment IDenvId in the config file
--framework <type>NoFramework type: react / vue / vite / next / nuxt / angular / static—
--install-command <cmd>NoInstall command; leave empty to skip installnpm install
--build-command <cmd>NoBuild command; leave empty to skip build, suitable for pure static projects—
--output-dir <dir>NoBuild output directory, resolved relative to the app directory; use ./ when no build is neededAuto-detect
--deploy-path <path>NoStatic hosting mount path/${serviceName}
--ignore <patterns>NoFile patterns to ignore, comma-separated, appended after app.ignore—
--enable-git-ignoreNoMerge project .gitignore rulesDisabled
-f, --forceNoSkip 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:

SyntaxExampleDescription
Wildcard*.logMatches file names (* does not cross directory levels)
Any level**/tempMatches temp at any depth
Whole directorydist/Ignores the dist directory and all its contents
Root anchored/buildMatches build only under the upload root
Relative pathsrc/testPath anchored relative to the upload root
Single char / char class?.log, [ab].logSupports 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:

FieldTypeRequiredDefaultDescription
serviceNameStringNopackage.json name or directory nameStatic hosting app service name
rootStringNoProject directoryApp root directory (relative to the project directory), for specifying sub-project paths in monorepo scenarios
frameworkStringNoAuto-detectFrontend framework type, supported values: react, vue, vite, next, nuxt, angular, static
installCommandStringNonpm installInstall dependencies command, empty string to skip the install step. Ignored by tcb deploy (that command never builds)
buildCommandStringNoAuto-detect based on frameworkBuild 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
outputDirStringNo./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
deployPathStringNo/${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
envVariablesObjectNo—Environment variables (non-sensitive), key-value pairs, injected during cloud build
ignoreString/ArrayNo—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:

ParameterPriority
serviceNameCLI positional argument > cloudbaserc.json configuration > Interactive selection > Auto-infer (package.json or directory name)
rootapp.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})
envVariablesOnly read from cloudbaserc.json (no CLI parameter)
ignoreDefault rules (node_modules, .git) > .gitignore (with --enable-git-ignore) > cloudbaserc.json app.ignore > --ignore option, all accumulated

Special notes:

  • --cwd only sets the project directory; config.app.root is resolved one level below it. The two are combined, not overridden. For example, --cwd apps/shop with app.root: ./frontend makes the app directory apps/shop/frontend. See Global Options
  • When --yes or --json is 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:

  1. tcb deploy is no longer an alias for this command — tcb deploy <serviceName> and eight app-only options such as --framework, --build-command, --output-dir fail with INVALID_PARAM; use tcb app deploy instead. See Declarative deployment · Notes
  2. tcb app build builds both app and hosting[] — earlier versions built only hosting[]