Skip to content

Commit 499e4a7

Browse files
feat(cli): expose build/deploy internals via trigger.dev/internal
Mirror the pattern @trigger.dev/build already uses: a dedicated `./internal` subpath export for downstream tooling that wants to drive the build / deploy pipeline programmatically without going through the `trigger` CLI binary. Adds packages/cli-v3/src/internal.ts re-exporting: - loadConfig (trigger.config.ts loader) - buildWorker + BuildWorkerOptions (esbuild bundling) - buildImage + BuildImageOptions + BuildImageResults (docker buildx orchestration) - generateContainerfile + parseGenerateOptions + GenerateContainerfileOptions (Containerfile templating) - CliApiClient (typed wrapper around the deploy / register / finalize endpoints) These modules already existed; this commit just makes them addressable from outside the CLI package. Also widens the visibility of three buildImage result types (BuildImageSuccess, BuildImageFailure, BuildImageResults) from file-private to exported so consumers can statically discriminate the result union. No behavior change. The CLI binary continues to import the same modules internally; nothing on the runtime path is affected. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent e01cdf5 commit 499e4a7

3 files changed

Lines changed: 31 additions & 4 deletions

File tree

packages/cli-v3/package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
],
4646
"exports": {
4747
"./package.json": "./package.json",
48-
".": "./src/index.ts"
48+
".": "./src/index.ts",
49+
"./internal": "./src/internal.ts"
4950
}
5051
},
5152
"devDependencies": {
@@ -159,6 +160,12 @@
159160
"types": "./dist/esm/index.d.ts",
160161
"default": "./dist/esm/index.js"
161162
}
163+
},
164+
"./internal": {
165+
"import": {
166+
"types": "./dist/esm/internal.d.ts",
167+
"default": "./dist/esm/internal.js"
168+
}
162169
}
163170
}
164171
}

packages/cli-v3/src/deploy/buildImage.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,20 +182,20 @@ export interface DepotBuildImageOptions {
182182
onLog?: (log: string) => void;
183183
}
184184

185-
type BuildImageSuccess = {
185+
export type BuildImageSuccess = {
186186
ok: true;
187187
imageSizeBytes: number;
188188
logs: string;
189189
digest?: string;
190190
};
191191

192-
type BuildImageFailure = {
192+
export type BuildImageFailure = {
193193
ok: false;
194194
error: string;
195195
logs: string;
196196
};
197197

198-
type BuildImageResults = BuildImageSuccess | BuildImageFailure;
198+
export type BuildImageResults = BuildImageSuccess | BuildImageFailure;
199199

200200
async function remoteBuildImage(options: DepotBuildImageOptions): Promise<BuildImageResults> {
201201
const buildArgs = Object.entries(options.buildEnvVars || {})

packages/cli-v3/src/internal.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Public API surface for downstream tooling that wants to drive the
2+
// build / deploy pipeline programmatically without going through the
3+
// `trigger` CLI binary.
4+
//
5+
// Mirrors the pattern used by `@trigger.dev/build`'s `./internal` subpath:
6+
// the modules exported here are stable enough to be consumed by adjacent
7+
// packages, but they sit *below* the documented CLI command surface, so
8+
// consumers should pin to a specific version of this package.
9+
10+
export { loadConfig } from "./config.js";
11+
export { buildWorker, type BuildWorkerOptions } from "./build/buildWorker.js";
12+
export {
13+
buildImage,
14+
generateContainerfile,
15+
parseGenerateOptions,
16+
type BuildImageOptions,
17+
type BuildImageResults,
18+
type GenerateContainerfileOptions,
19+
} from "./deploy/buildImage.js";
20+
export { CliApiClient } from "./apiClient.js";

0 commit comments

Comments
 (0)