Skip to content

Commit 84970e3

Browse files
committed
use built JS
1 parent 5e8c0be commit 84970e3

File tree

1 file changed

+21
-24
lines changed

1 file changed

+21
-24
lines changed

.dagger/src/index.ts

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export class AtomicServer {
3838
async ci(@argument() netlifyAuthToken: Secret): Promise<string> {
3939
await Promise.all([
4040
this.docsPublish(netlifyAuthToken),
41-
this.lintBrowser(),
42-
this.testBrowser(),
41+
this.jsLint(),
42+
this.jsTest(),
4343
this.endToEnd(netlifyAuthToken),
4444
this.rustTest(),
4545
this.rustClippy(),
@@ -50,31 +50,17 @@ export class AtomicServer {
5050
}
5151

5252
@func()
53-
buildBrowser(): Container {
54-
const source = this.source.directory("browser");
55-
const depsContainer = this.getDeps(source.directory("."));
56-
57-
const buildContainer = depsContainer
58-
.withWorkdir("/app")
59-
.withExec(["pnpm", "run", "build"]);
60-
61-
return buildContainer;
62-
}
63-
64-
@func()
65-
async lintBrowser(): Promise<string> {
66-
const source = this.source.directory("browser");
67-
const depsContainer = this.getDeps(source.directory("."));
53+
async jsLint(): Promise<string> {
54+
const depsContainer = this.jsBuild();
6855
return depsContainer
6956
.withWorkdir("/app")
7057
.withExec(["pnpm", "run", "lint"])
7158
.stdout();
7259
}
7360

7461
@func()
75-
async testBrowser(): Promise<string> {
76-
const source = this.source.directory("browser");
77-
const depsContainer = this.getDeps(source.directory("."));
62+
async jsTest(): Promise<string> {
63+
const depsContainer = this.jsBuild();
7864
return depsContainer
7965
.withWorkdir("/app")
8066
.withExec(["pnpm", "run", "test"])
@@ -126,7 +112,7 @@ export class AtomicServer {
126112
}
127113
@func()
128114
typedocPublish(@argument() netlifyAuthToken: Secret): Promise<string> {
129-
const browserDir = this.buildBrowser();
115+
const browserDir = this.jsBuild();
130116
return browserDir
131117
.withWorkdir("/app")
132118
.withSecretVariable("NETLIFY_AUTH_TOKEN", netlifyAuthToken)
@@ -135,7 +121,9 @@ export class AtomicServer {
135121
}
136122

137123
@func()
138-
private getDeps(source: Directory): Container {
124+
private jsBuild(): Container {
125+
const source = this.source.directory("browser");
126+
139127
// Create a container with PNPM installed
140128
const pnpmContainer = dag
141129
.container()
@@ -167,7 +155,10 @@ export class AtomicServer {
167155
]);
168156

169157
// Copy the source so installed dependencies persist in the container
170-
return depsContainer.withDirectory("/app", source);
158+
const sourceContainer = depsContainer.withDirectory("/app", source);
159+
160+
// Build all packages since they may depend on each other's built artifacts
161+
return sourceContainer.withExec(["pnpm", "run", "build"]);
171162
}
172163

173164
@func()
@@ -198,7 +189,13 @@ export class AtomicServer {
198189
.withWorkdir("/code")
199190
.withExec(["cargo", "fetch"]);
200191

201-
return sourceContainer
192+
const browserDir = this.jsBuild().directory("/app/data-browser/dist");
193+
const containerWithAssets = sourceContainer.withDirectory(
194+
"/code/server/assets_tmp",
195+
browserDir
196+
);
197+
198+
return containerWithAssets
202199
.withExec(["cargo", "build", "--release"])
203200
.withExec(["./target/release/atomic-server", "--version"])
204201
.withExec([

0 commit comments

Comments
 (0)