@@ -61,9 +61,7 @@ describe("runtime postbuild static assets", () => {
|
61 | 61 | "dist/extensions/diffs-language-pack/assets/viewer-runtime.js", |
62 | 62 | "dist/extensions/diffs/assets/viewer-runtime.js", |
63 | 63 | ]); |
64 | | -expect(payload.sources).toContain( |
65 | | -"extensions/diffs-language-pack/assets/viewer-runtime.js", |
66 | | -); |
| 64 | +expect(payload.sources).toContain("extensions/diffs-language-pack/assets/viewer-runtime.js"); |
67 | 65 | expect(payload.sources).toContain("extensions/diffs/assets/viewer-runtime.js"); |
68 | 66 | }); |
69 | 67 | |
@@ -208,6 +206,45 @@ describe("runtime postbuild static assets", () => {
|
208 | 206 | await expect(fs.readFile(runtimeAsset, "utf8")).resolves.toBe("console.log('viewer');\n"); |
209 | 207 | }); |
210 | 208 | |
| 209 | +it("can skip static asset copies for minimal runtime builds", async () => { |
| 210 | +const rootDir = createTempDir("openclaw-runtime-postbuild-"); |
| 211 | +const warn = vi.fn(); |
| 212 | +const output = "assets/viewer-runtime.js"; |
| 213 | + |
| 214 | +await fs.mkdir(path.join(rootDir, "src", "plugin-sdk"), { recursive: true }); |
| 215 | +await fs.writeFile( |
| 216 | +path.join(rootDir, "src", "plugin-sdk", "root-alias.cjs"), |
| 217 | +"module.exports = {};\n", |
| 218 | +"utf8", |
| 219 | +); |
| 220 | +await fs.mkdir(path.join(rootDir, "extensions", "diffs"), { recursive: true }); |
| 221 | +await fs.writeFile( |
| 222 | +path.join(rootDir, "extensions", "diffs", "package.json"), |
| 223 | +JSON.stringify({ |
| 224 | +name: "@openclaw/diffs", |
| 225 | +openclaw: { |
| 226 | +extensions: ["./index.ts"], |
| 227 | +build: { |
| 228 | +staticAssets: [{ source: `./${output}`, output }], |
| 229 | +}, |
| 230 | +}, |
| 231 | +}), |
| 232 | +"utf8", |
| 233 | +); |
| 234 | + |
| 235 | +runRuntimePostBuild({ |
| 236 | +cwd: rootDir, |
| 237 | +repoRoot: rootDir, |
| 238 | + rootDir, |
| 239 | +env: { OPENCLAW_RUNTIME_POSTBUILD_STATIC_ASSETS: "0" }, |
| 240 | +timings: false, |
| 241 | + warn, |
| 242 | +}); |
| 243 | + |
| 244 | +expect(warn).not.toHaveBeenCalled(); |
| 245 | +await expectPathMissing(path.join(rootDir, "dist", "extensions", "diffs", output)); |
| 246 | +}); |
| 247 | + |
211 | 248 | it("skips runtime overlay asset copies when the runtime extension root is absent", async () => { |
212 | 249 | const rootDir = createTempDir("openclaw-runtime-postbuild-"); |
213 | 250 | await fs.mkdir(path.join(rootDir, "extensions", "demo", "assets"), { recursive: true }); |
|