Skip to content

Commit 8b4f20f

Browse files
committed
Typedoc on Dagger
1 parent 36886b9 commit 8b4f20f

File tree

5 files changed

+23
-3
lines changed

5 files changed

+23
-3
lines changed

.dagger/src/index.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ import {
55
object,
66
func,
77
argument,
8+
File,
9+
Secret,
810
} from "@dagger.io/dagger";
911

12+
const NODE_IMAGE = "node:24";
13+
1014
@object()
1115
export class AtomicServer {
1216
/**
@@ -57,7 +61,7 @@ export class AtomicServer {
5761
const nodeCache = dag.cacheVolume("node");
5862
return dag
5963
.container()
60-
.from("node:21-slim")
64+
.from(NODE_IMAGE)
6165
.withDirectory("/src", source)
6266
.withMountedCache("/root/.npm", nodeCache)
6367
.withWorkdir("/src")
@@ -99,12 +103,25 @@ export class AtomicServer {
99103
.stdout();
100104
}
101105

106+
@func()
107+
typedocPublish(
108+
@argument({ defaultPath: "/browser" }) source: Directory,
109+
@argument() netlifyAuthToken: Secret
110+
): Promise<string> {
111+
const browserDir = this.buildBrowser(source.directory("."));
112+
return browserDir
113+
.withWorkdir("/app")
114+
.withSecretVariable("NETLIFY_AUTH_TOKEN", netlifyAuthToken)
115+
.withExec(["pnpm", "run", "typedoc-publish"])
116+
.stdout();
117+
}
118+
102119
@func()
103120
private getDeps(source: Directory): Container {
104121
// Create a container with PNPM installed
105122
const pnpmContainer = dag
106123
.container()
107-
.from("node:24")
124+
.from(NODE_IMAGE)
108125
.withExec(["npm", "install", "--global", "corepack@latest"])
109126
.withExec(["corepack", "enable"])
110127
.withExec(["corepack", "prepare", "pnpm@latest-10", "--activate"])

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/target
2+
.envrc
23
.env
34
trace-*.json
45
**/.temp

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ The `.dagger` directory and the `dagger.json` file contain most of the configura
6767
Install the Dagger CLI from [here](https://docs.dagger.io/install/) and run the `dagger` command in the root of the project.
6868
Then you can run the commands from the `.dagger/src/index.ts` file, e.g. `dagger call build-browser`.
6969
Add `-i` to the command to run in interactive mode, add `--output` to save the output to a folder.
70+
You can pass secrets / ENVS to dagger like so:
71+
`dagger call typedoc-publish --netlify-auth-token="env://NETLIFY_AUTH_TOKEN"`
7072
Note that the camelCase functions in the `index.ts` file are converted to kebab-case commands in the Dagger API.
7173

7274
Check out the [Dagger docs](https://docs.dagger.io/) for more information.
File renamed without changes.

browser/typedoc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
],
88
"excludeExternals": true,
99
"includeVersion": true,
10-
"readme": "DOCS.md",
10+
"readme": "typedoc-entry.md",
1111
"name": "@tomic",
1212
"out": "data-browser/publish/docs"
1313
}

0 commit comments

Comments
 (0)