Skip to content

dagger/typescript-sdk

Repository files navigation

typescript-sdk

A Dagger module for managing Dagger modules that use the TypeScript SDK.

The Dagger CLI ships without built-in module-management commands like init or develop. Those operations live in SDK-specific modules like this one, called through dagger call.

Backed by github.com/dagger/sdk-sdk/polyfill.

Install

From your workspace root:

dagger install github.com/dagger/typescript-sdk

After install, the module is available in dagger call as typescript-sdk.

Calls that return a Changeset will print the diff and prompt you to confirm before writing anything to your workspace.

Create a new module

Create a TypeScript SDK module under the nearest .dagger/modules/<name>/:

dagger call typescript-sdk init --name my-module

Pick a different location:

dagger call typescript-sdk init --name my-module --path some/dir/my-module

Pick a runtime (node is the default; bun and deno are also supported):

dagger call typescript-sdk init --name my-module --runtime BUN
dagger call typescript-sdk init --name my-module --runtime DENO

init seeds src/index.ts plus runtime-specific config files:

  • node / bunpackage.json, tsconfig.json
  • denodeno.json

If package.json, tsconfig.json, or deno.json already exist at the target path, init merges Dagger-required keys into them rather than overwriting — your scripts, path aliases, unstable flags, and other custom settings are preserved.

init only seeds template and config files. Run mod ... generate to produce the generated SDK.

Configure a module at creation

init accepts configuration flags written into the module's package.json (or deno.json for Deno modules):

dagger call typescript-sdk init --name my-module \
    --package-manager pnpm@8.15.4 \
    --base-image node:23.2.0-alpine

Both flags are optional. By default no packageManager field is written and no base image override is set.

--package-manager accepts the Node-standard name@version syntax (e.g. npm@10.7.0, pnpm@8.15.4, yarn@1.22.22). It is only valid with the Node runtime; Bun and Deno bundle their own.

Configure an existing module

Read current configuration:

dagger call typescript-sdk mod --path my-module config package-manager
dagger call typescript-sdk mod --path my-module config base-image

Change configuration with config set — pass either flag, or both in a single call. Each returns a Changeset so you confirm the diff before anything is written:

dagger call typescript-sdk mod --path my-module \
    config set --package-manager pnpm@8.15.4
dagger call typescript-sdk mod --path my-module \
    config set --base-image node:23.2.0-alpine
dagger call typescript-sdk mod --path my-module \
    config set --package-manager pnpm@8.15.4 --base-image node:23.2.0-alpine

Unset stays as separate commands:

dagger call typescript-sdk mod --path my-module config unset-package-manager
dagger call typescript-sdk mod --path my-module config unset-base-image

package-manager is only supported on Node modules; Bun and Deno bundle their own and the SDK rejects the flag on those runtimes. base-image writes to deno.json for Deno modules and to package.json otherwise — matching where the engine reads it from.

Generate SDK files

For a single module:

dagger call typescript-sdk mod --path my-module generate

For every TypeScript SDK module in the workspace (skipping any with a .dagger-typescript-sdk-skip-generate marker at or above the module root):

dagger call typescript-sdk generate-all

Manage dependencies

List:

dagger call typescript-sdk mod --path my-module deps list

Add (run mod ... generate after to refresh generated SDK files):

dagger call typescript-sdk mod --path my-module \
    deps add --source github.com/some/module

Add with a custom local name:

dagger call typescript-sdk mod --path my-module \
    deps add --source github.com/some/module --name alias

Remove by name or source:

dagger call typescript-sdk mod --path my-module deps remove --name alias

Update one remote dependency, or all of them:

dagger call typescript-sdk mod --path my-module deps update
dagger call typescript-sdk mod --path my-module deps update --name some-dep

Manage the required engine version

# Read the version pinned in dagger.json
dagger call typescript-sdk mod --path my-module engine required

# Pin to a specific version
dagger call typescript-sdk mod --path my-module engine require --version 0.20.8

# Pin to the engine version you're currently running
dagger call typescript-sdk mod --path my-module engine require-current

# Pin to "latest"
dagger call typescript-sdk mod --path my-module engine require-latest

Discover modules in a workspace

# Every TypeScript SDK module under the workspace
dagger call typescript-sdk modules path

See typescript-sdk.dang for the full type surface.

Skipping generation

To exclude a directory tree from generate-all, drop an empty .dagger-typescript-sdk-skip-generate file at or above the module root. Useful for fixtures, vendored modules, or anything you don't want regenerated in bulk.

touch some/fixture/.dagger-typescript-sdk-skip-generate

About

Develop Dagger modules in TypeScript

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors