@embeddables/deploy
v0.3.2
Published
Upload a built Worker app to Embeddables Hosting with a project deploy key.
Keywords
Readme
@embeddables/deploy
Upload a built Worker app to Embeddables Hosting with a project deploy key.
import { deployHostingApp } from '@embeddables/deploy'
const result = await deployHostingApp({
deployKey: process.env.EMBEDDABLES_DEPLOY_KEY!,
appSlug: 'storefront',
branch: 'main',
sha: process.env.GITHUB_SHA!,
serverDir: 'build/server',
clientDir: 'build/client',
})
console.log(result.branchUrl, result.commitUrl)Only static files the backend does not already have are uploaded, so redeploying an unchanged app sends no static file bytes. Each static file must be 25 MB or less.
Failures throw DeployError with the backend's status and code when it returned them.
Upload the project config
deployProjectConfig uploads a branch's deploy config, the same document em deploy sends
(embeddables/config.yaml with each form's schema.yaml merged). The backend validates it and
replaces that branch's stored config. It needs an unscoped project deploy key.
import { deployProjectConfig } from '@embeddables/deploy'
await deployProjectConfig({
deployKey: process.env.EMBEDDABLES_DEPLOY_KEY!,
branch: 'main',
configYaml,
})| Option | Required | Description |
| ------------ | -------- | -------------------------------------------------------- |
| deployKey | yes | Unscoped project deploy key (edk_…). |
| branch | yes | Git branch the config belongs to. |
| configYaml | yes | The deploy document, as YAML text. |
| projectId | no | When set, the backend checks that it owns the deploy key. |
| apiOrigin | no | Defaults to https://backend.embeddables.com. |
| fetch | no | Custom fetch. |
| sleep | no | Wait between retries. |
Network errors, 429, and 5xx are retried up to three times. Other failures throw DeployError.
