@akanjs/devkit 3.3.0-rc.6 → 3.3.0-rc.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/DEV_RUNTIME_KNOBS.md +1 -1
  2. package/README.ko.md +8 -2
  3. package/README.md +8 -3
  4. package/akanApp/akanApp.host.test.ts +4 -2
  5. package/akanApp/akanApp.host.ts +11 -0
  6. package/akanConfig/akanBin.ts +4 -0
  7. package/akanConfig/akanConfig.test.ts +280 -19
  8. package/akanConfig/akanConfig.ts +96 -270
  9. package/akanConfig/akanWorkers.test.ts +73 -0
  10. package/akanConfig/akanWorkers.ts +61 -0
  11. package/akanConfig/desktopServerConfig.ts +96 -0
  12. package/akanConfig/dockerImage.ts +216 -0
  13. package/akanConfig/index.ts +2 -0
  14. package/akanConfig/nativeFileSettings.ts +33 -0
  15. package/akanConfig/nativeKeys.ts +52 -0
  16. package/akanConfig/types.ts +2 -0
  17. package/app/appBin.test.ts +63 -0
  18. package/app/appBin.ts +50 -0
  19. package/app/applicationBuildReporter.test.ts +51 -1
  20. package/app/applicationBuildReporter.ts +6 -1
  21. package/app/applicationBuildRunner.test.ts +358 -5
  22. package/app/applicationBuildRunner.ts +204 -30
  23. package/app/dictionarySizes.test.ts +40 -0
  24. package/app/dictionarySizes.ts +95 -0
  25. package/app/routeFilesReport.test.ts +59 -0
  26. package/app/routeFilesReport.ts +46 -0
  27. package/app/routeJsBudget.ts +18 -4
  28. package/artifact/implicitRootLayout.test.ts +19 -0
  29. package/artifact/implicitRootLayout.ts +16 -2
  30. package/artifact/implicitRootLayoutRender.test.tsx +4 -1
  31. package/artifact/storeBootstrap.test.ts +28 -0
  32. package/artifact/storeBootstrap.ts +64 -8
  33. package/biome.base.json +7 -5
  34. package/codeAgent/agent/CodeAgent.ts +36 -16
  35. package/codeAgent/agent/CodeAgentAllowed.ts +35 -0
  36. package/codeAgent/agent/CodeAgentCommandLine.ts +372 -0
  37. package/codeAgent/agent/CodeAgentGate.ts +23 -4
  38. package/codeAgent/agent/CodeAgentRpcHost.ts +1 -1
  39. package/codeAgent/agent/codeAgent.test.ts +62 -0
  40. package/codeAgent/agent/codeAgentCommandLine.test.ts +212 -0
  41. package/codeAgent/agent/codeAgentContract.test.ts +117 -5
  42. package/codeAgent/skills/akan-agent/SKILL.md +8 -1
  43. package/codeAgent/skills/akan-code/SKILL.md +38 -3
  44. package/codeAgent/skills/akan-debug/SKILL.md +1 -1
  45. package/codeAgent/skills/akan-deps/SKILL.md +3 -2
  46. package/codeAgent/skills/akan-err/SKILL.md +13 -8
  47. package/codeAgent/skills/akan-mcp/SKILL.md +1 -1
  48. package/codeAgent/skills/akan-module/SKILL.md +2 -2
  49. package/codeAgent/skills/akan-page/SKILL.md +46 -29
  50. package/codeAgent/skills/akan-query/SKILL.md +13 -20
  51. package/codeAgent/skills/akan-runtime/SKILL.md +21 -1
  52. package/codeAgent/skills/akan-service/SKILL.md +10 -11
  53. package/codeAgent/skills/akan-transport/SKILL.md +5 -14
  54. package/codeAgent/skills/akan-ui/SKILL.md +16 -21
  55. package/commandDecorators/command.ts +28 -12
  56. package/commandDecorators/commandBuilder.ts +8 -1
  57. package/commandDecorators/commandDecorators.test.ts +70 -3
  58. package/commandDecorators/helpFormatter.ts +14 -12
  59. package/context/akanContext.ts +2 -0
  60. package/csrE2e/devHmrLatency.e2e.test.ts +1 -1
  61. package/docs/apiReference.test.ts +9 -0
  62. package/docs/apiReference.ts +15 -0
  63. package/executors/appExecutor.ts +26 -12
  64. package/executors/clientRuntimeKeyOrder.fixture.json +682 -0
  65. package/executors/clientRuntimeKeys.fixture.json +393 -0
  66. package/executors/clientRuntimeKeys.test.ts +1690 -0
  67. package/executors/executor.ts +14 -6
  68. package/executors/executors.test.ts +140 -1
  69. package/executors/sysExecutor.ts +112 -8
  70. package/executors/workspaceExecutor.ts +7 -4
  71. package/frontendBuild/allRoutesBuilder.ts +99 -7
  72. package/frontendBuild/autoImportSync.ts +3 -2
  73. package/frontendBuild/buildRouteClient.test.ts +686 -13
  74. package/frontendBuild/clientBuildTypes.ts +26 -0
  75. package/frontendBuild/clientEntriesBundler.ts +49 -1
  76. package/frontendBuild/clientEntryDiscovery.test.ts +308 -1
  77. package/frontendBuild/clientEntryDiscovery.ts +136 -14
  78. package/frontendBuild/clientEntryGroups.test.ts +77 -0
  79. package/frontendBuild/clientEntryGroups.ts +61 -0
  80. package/frontendBuild/csrDevArtifactWriter.ts +2 -2
  81. package/frontendBuild/csrDevModuleCompiler.test.ts +86 -0
  82. package/frontendBuild/csrDevModuleCompiler.ts +44 -8
  83. package/frontendBuild/csrDevPatcher.test.ts +1 -1
  84. package/frontendBuild/csrDevPatcher.ts +33 -7
  85. package/frontendBuild/csrDevTypes.ts +9 -0
  86. package/frontendBuild/devBarrelImports.test.ts +154 -0
  87. package/frontendBuild/devBarrelImports.ts +83 -23
  88. package/frontendBuild/devRegistryBundler.ts +4 -2
  89. package/frontendBuild/devRouteRuntime.test.ts +492 -0
  90. package/frontendBuild/devRouteRuntime.ts +167 -0
  91. package/frontendBuild/dictionaryAssetBuilder.test.ts +408 -0
  92. package/frontendBuild/dictionaryAssetBuilder.ts +185 -17
  93. package/frontendBuild/dictionaryConstants.ts +136 -0
  94. package/frontendBuild/dictionaryOwnParts.ts +88 -0
  95. package/frontendBuild/dictionaryPackState.ts +131 -0
  96. package/frontendBuild/dictionaryPacking.test.ts +207 -0
  97. package/frontendBuild/dictionaryPacking.ts +160 -0
  98. package/frontendBuild/dictionaryRoutes.test.ts +251 -0
  99. package/frontendBuild/dictionaryRoutes.ts +227 -0
  100. package/frontendBuild/pagesBundleBuilder.test.ts +84 -0
  101. package/frontendBuild/pagesBundleBuilder.ts +78 -2
  102. package/frontendBuild/precompressArtifacts.test.ts +22 -0
  103. package/frontendBuild/precompressArtifacts.ts +34 -8
  104. package/frontendBuild/registryMetadataFingerprint.ts +3 -3
  105. package/frontendBuild/renderedEntries.ts +144 -0
  106. package/frontendBuild/routeClientBuilder.ts +407 -43
  107. package/frontendBuild/routeHandoffs.test.ts +155 -0
  108. package/frontendBuild/routeHandoffs.ts +117 -0
  109. package/frontendBuild/routeModulePreloads.test.ts +32 -0
  110. package/frontendBuild/routeModulePreloads.ts +20 -11
  111. package/frontendBuild/routeRuntimeCheck.test.ts +280 -0
  112. package/frontendBuild/routeRuntimeCheck.ts +248 -0
  113. package/frontendBuild/routeRuntimePays.test.ts +143 -0
  114. package/frontendBuild/routeRuntimePays.ts +117 -0
  115. package/frontendBuild/ssrBaseArtifactBuilder.ts +24 -34
  116. package/frontendBuild/ssrDevBundler.test.ts +150 -1
  117. package/frontendBuild/ssrDevBundler.ts +66 -11
  118. package/frontendBuild/vendorFileImports.test.ts +254 -0
  119. package/frontendBuild/vendorFileImports.ts +163 -0
  120. package/frontendBuild/vendorNarrowing.ts +28 -0
  121. package/frontendBuild/vendorSpecifiers.ts +2 -0
  122. package/incrementalBuilder/buildBatch.proc.ts +9 -9
  123. package/incrementalBuilder/buildBatchProtocol.ts +1 -1
  124. package/incrementalBuilder/builderBoot.ts +5 -5
  125. package/incrementalBuilder/builderGraphPayloads.ts +4 -4
  126. package/incrementalBuilder/builderLanes.ts +2 -2
  127. package/incrementalBuilder/builderWatch.ts +8 -8
  128. package/incrementalBuilder/csrRegistry.ts +4 -4
  129. package/incrementalBuilder/incrementalBuilder.proc.test.ts +79 -0
  130. package/incrementalBuilder/incrementalBuilder.proc.ts +27 -8
  131. package/incrementalBuilder/ssrRegistry.ts +6 -6
  132. package/index.ts +1 -1
  133. package/integration/renderAdmissionSoak.test.ts +99 -0
  134. package/integration/renderAdmissionSoak.ts +609 -0
  135. package/lint/__fixtures__/no-arbitrary-color/every-color-function/bad.tsx +11 -0
  136. package/lint/__fixtures__/no-arbitrary-color/every-color-function/good.tsx +2 -0
  137. package/lint/__fixtures__/no-daisyui-legacy-class/every-class/bad.tsx +34 -0
  138. package/lint/__fixtures__/no-daisyui-legacy-class/every-class/good.tsx +2 -0
  139. package/lint/__fixtures__/no-inline-color/every-color-function/bad.tsx +10 -0
  140. package/lint/__fixtures__/no-inline-color/every-color-function/good.tsx +2 -0
  141. package/lint/__fixtures__/no-raw-palette-class/every-palette/bad.tsx +22 -0
  142. package/lint/__fixtures__/no-raw-palette-class/every-palette/good.tsx +2 -0
  143. package/lint/biomeBase.test.ts +50 -3
  144. package/lint/biomeBase.ts +1 -1
  145. package/lint/biomeCheck.test.ts +162 -0
  146. package/lint/biomeCheck.ts +131 -0
  147. package/lint/linter.test.ts +16 -11
  148. package/lint/no-arbitrary-color.grit +5 -0
  149. package/lint/no-conditional-st-hook.grit +5 -1
  150. package/lint/no-daisyui-legacy-class.grit +8 -0
  151. package/lint/no-document-cookie.grit +3 -0
  152. package/lint/no-inline-color.grit +10 -2
  153. package/lint/no-oversized-list-limit.grit +2 -0
  154. package/lint/no-raw-palette-class.grit +7 -0
  155. package/lint/no-unpublished-form-setter.grit +2 -0
  156. package/lint/no-web-only-api-outside-webkit.grit +5 -0
  157. package/lint/no-web-storage.grit +3 -0
  158. package/lint/withheldEnvFile.ts +17 -0
  159. package/mobile/desktopBin.ts +2 -2
  160. package/mobile/desktopServerStage.test.ts +18 -3
  161. package/mobile/desktopServerStage.ts +7 -2
  162. package/mobile/nativeApp.test.ts +7 -5
  163. package/mobile/nativeApp.ts +2 -2
  164. package/mobile/nativeConfig.test.ts +96 -1
  165. package/mobile/nativeConfig.ts +46 -12
  166. package/mobile/nativePublicEnv.ts +1 -1
  167. package/mobile/serverBundleSecrets.ts +43 -0
  168. package/package.json +20 -171
  169. package/packageExports.test.ts +38 -24
  170. package/quality/dictionaryKeys.test.ts +356 -0
  171. package/quality/dictionaryKeys.ts +488 -0
  172. package/quality/objectImportReport.test.ts +36 -0
  173. package/quality/objectImportReport.ts +105 -0
  174. package/quality/qualityScanner.ts +1 -1
  175. package/quality/routeRuntimeReport.test.ts +91 -0
  176. package/quality/routeRuntimeReport.ts +121 -0
  177. package/quality/runtimeConstantFacts.ts +71 -0
  178. package/quality/runtimeConstantGraph.ts +123 -0
  179. package/quality/runtimeConstantReads.ts +116 -0
  180. package/quality/runtimeImports.test.ts +190 -0
  181. package/quality/runtimeImports.ts +233 -0
  182. package/quality/runtimeKeyNames.ts +46 -0
  183. package/quality/runtimeLexicalScope.ts +132 -0
  184. package/quality/runtimeMarkerReach.test.ts +84 -0
  185. package/quality/runtimeMarkerReach.ts +255 -0
  186. package/quality/runtimeModuleFacts.ts +290 -0
  187. package/quality/runtimeNameTable.test.ts +172 -0
  188. package/quality/runtimeNameTable.ts +477 -0
  189. package/quality/runtimeScopeReport.test.ts +123 -0
  190. package/quality/runtimeScopeReport.ts +167 -0
  191. package/quality/runtimeSliceKey.ts +269 -0
  192. package/quality/runtimeSyntax.ts +133 -0
  193. package/quality/runtimeTable.fixture.ts +189 -0
  194. package/quality/runtimeUse.test.ts +737 -0
  195. package/quality/runtimeUse.ts +696 -0
  196. package/quality/runtimeUseReadable.test.ts +393 -0
  197. package/quality/ssrScanner.test.ts +13 -0
  198. package/quality/ssrScanner.ts +1 -1
  199. package/quality/translatorBindings.ts +187 -0
  200. package/test/secretEnvFixture.ts +134 -0
  201. package/test/testHelpers.ts +11 -0
  202. package/transforms/barrelAnalyzer.ts +26 -4
  203. package/transforms/barrelImportsPlugin.ts +121 -32
  204. package/transforms/exportReach.test.ts +162 -0
  205. package/transforms/exportReach.ts +308 -0
  206. package/transforms/frameworkObjects.fixture.tsx +58 -0
  207. package/transforms/frameworkObjects.test.ts +54 -0
  208. package/transforms/modelReference.test.ts +196 -0
  209. package/transforms/modelReference.ts +39 -0
  210. package/transforms/moduleParts.test.ts +225 -0
  211. package/transforms/moduleParts.ts +418 -0
  212. package/transforms/objectImportEdits.ts +150 -0
  213. package/transforms/objectMemberImports.test.ts +633 -0
  214. package/transforms/objectMemberImports.ts +571 -0
  215. package/transforms/objectMemberLookup.ts +150 -0
  216. package/transforms/objectModule.test.ts +307 -0
  217. package/transforms/objectModule.ts +482 -0
  218. package/transforms/objectModuleAnalyzer.ts +104 -0
  219. package/transforms/partImports.test.ts +76 -0
  220. package/transforms/partImports.ts +110 -0
  221. package/transforms/partModules.test.ts +187 -0
  222. package/transforms/partModules.ts +90 -0
  223. package/transforms/partPurity.ts +124 -0
  224. package/transforms/reactIconImports.test.ts +231 -0
  225. package/transforms/reactIconImports.ts +325 -0
  226. package/transforms/routeConstants.ts +122 -0
  227. package/transforms/routeRuntime.test.ts +835 -0
  228. package/transforms/routeRuntime.ts +703 -0
  229. package/transforms/routeRuntimeEdits.ts +92 -0
  230. package/transforms/routeRuntimeGraph.ts +66 -0
  231. package/transforms/routeRuntimePlan.ts +244 -0
  232. package/transforms/secretEnvDeclaration.test.ts +208 -0
  233. package/transforms/secretEnvDeclaration.ts +213 -0
  234. package/transforms/secretEnvFile.test.ts +117 -0
  235. package/transforms/secretEnvFile.ts +113 -0
  236. package/transforms/secretEnvName.test.ts +54 -0
  237. package/transforms/secretEnvName.ts +29 -0
  238. package/transforms/secretEnvSource.test.ts +148 -0
  239. package/transforms/secretEnvSource.ts +166 -0
  240. package/transforms/serverEnvEvaluationError.ts +11 -0
  241. package/transforms/serverEnvPlugin.test.ts +2 -1
  242. package/transforms/serverEnvPlugin.ts +13 -0
  243. package/transforms/serverEnvProfile.test.ts +129 -2
  244. package/transforms/serverEnvProfile.ts +126 -40
  245. package/transforms/serverEnvSecrets.test.ts +292 -0
  246. package/transforms/signalDescriptors.test.ts +280 -0
  247. package/transforms/signalDescriptors.ts +227 -0
  248. package/transforms/thisFreeExports.ts +87 -0
  249. package/transforms/transforms.test.ts +180 -3
  250. package/transforms/tsconfigPackageResolver.test.ts +1 -0
  251. package/tunnel/createTunnel.test.ts +29 -8
  252. package/tunnel/createTunnel.ts +22 -11
  253. package/tunnel/ssh2Module.test.ts +37 -0
  254. package/tunnel/ssh2Module.ts +32 -0
  255. package/tunnel/sshTunnel.ts +4 -2
  256. package/typecheck/projectTypecheck.test.ts +32 -1
  257. package/typecheck/projectTypecheck.ts +3 -3
  258. package/typecheck/typeChecker.test.ts +49 -0
  259. package/typecheck/typeChecker.ts +9 -7
  260. package/typecheck/withheldDiagnostics.ts +41 -0
  261. package/util/fileEditor.ts +1 -0
  262. package/util/selectModel.ts +1 -0
  263. package/workflow/executor.ts +6 -2
  264. package/workflow/index.ts +1 -0
  265. package/workflow/plan.ts +36 -7
  266. package/workflow/types.ts +1 -1
  267. package/workflow/uiTarget.ts +50 -0
  268. package/workspace/envSeed.test.ts +30 -1
  269. package/workspace/envSeed.ts +30 -1
  270. package/workspace/getRelatedCnsts.ts +7 -0
  271. package/workspace/mainCheckout.test.ts +55 -0
  272. package/workspace/mainCheckout.ts +38 -0
  273. package/workspace/scanInfo.test.ts +39 -0
  274. package/workspace/scanInfo.ts +55 -6
  275. package/workspace/slicePlanner.ts +1 -1
  276. package/workspace/workspaceLayout.test.ts +5 -1
  277. package/workspace/workspaceLayout.ts +3 -0
  278. package/CHANGELOG.md +0 -2717
@@ -83,7 +83,7 @@ reporting ready until the file it names exists.
83
83
 
84
84
  | variable | default | what it does |
85
85
  |---|---|---|
86
- | `AKAN_MEMORY_LOG` | off | `=1` logs a periodic memory report from each server role. |
86
+ | `AKAN_MEMORY_LOG` | off | `=1` logs a periodic memory report from each server role, and adds `rscFirstRenderMemory` (each route's first-render growth and loaded modules) to the RSC worker's metrics. |
87
87
  | `AKAN_MEMORY_LOG_INTERVAL_MS` | `60000` | How often that report is written. |
88
88
  | `AKAN_MEMORY_GC_ON_REPORT` | off | `=1` forces a GC before each report, so the number is retained memory rather than garbage. Costs a full GC per report. |
89
89
 
package/README.ko.md CHANGED
@@ -39,8 +39,9 @@ await runner.build();
39
39
 
40
40
  값은 그것을 가진 facet에서 import합니다(`@akanjs/devkit/executors`, `@akanjs/devkit/akanConfig`,
41
41
  `@akanjs/devkit/workflow` 등). 루트 `@akanjs/devkit` 진입점은 타입만 내보내므로, 도구 하나를 불러도 모든 facet이
42
- 프로세스에 올라오지 않습니다. facet이 따로 없는 도구는 그 폴더에서 import합니다(`@akanjs/devkit/app/…`, `quality/`,
43
- `workspace/`, `util/` 등). 이 도구들이 패키지 루트에 있던 시절의 경로는 다음 minor 릴리스까지 계속 동작합니다.
42
+ 프로세스에 올라오지 않습니다. facet 외에는 `exports`가 이름을 붙인 몇몇 파일(`app/applicationBuildRunner`,
43
+ `cloud/cloudApi`, `mobile/desktopRelease` 등)만 공개되며, 그 밖의 파일은 `akan` 명령의 내부 구현이라 패키지 밖에서
44
+ resolve되지 않습니다.
44
45
 
45
46
  ## 제공하는 것
46
47
 
@@ -75,6 +76,11 @@ await runner.build();
75
76
  - TypeScript
76
77
  - `react`는 optional peer이며, 렌더링하는 기능에서만 필요합니다.
77
78
 
79
+ ## 변경 기록
80
+
81
+ [`CHANGELOG.md`](https://github.com/akan-team/akanjs/blob/main/pkgs/@akanjs/devkit/CHANGELOG.md)는 저장소에 있고,
82
+ 패키지에는 들어 있지 않습니다.
83
+
78
84
  ## 라이선스
79
85
 
80
86
  MIT
package/README.md CHANGED
@@ -38,9 +38,9 @@ await runner.build();
38
38
 
39
39
  Import values from the facet that owns them (`@akanjs/devkit/executors`, `@akanjs/devkit/akanConfig`,
40
40
  `@akanjs/devkit/workflow`, …). The root `@akanjs/devkit` entry exports types only, so loading a tool does not pull
41
- every facet into the process. A tool with no facet of its own is imported from its folder (`@akanjs/devkit/app/…`,
42
- `quality/`, `workspace/`, `util/`, …); the paths these tools had at the package root still resolve until the next
43
- minor release.
41
+ every facet into the process. Besides the facets, `exports` names a few files (`app/applicationBuildRunner`,
42
+ `cloud/cloudApi`, `mobile/desktopRelease`, …); any other file is internal to the `akan` command and does not resolve
43
+ from outside the package.
44
44
 
45
45
  ## What It Provides
46
46
 
@@ -75,6 +75,11 @@ defaults, the shares they derive from `AKAN_MEMORY_LIMIT`, and what a small cont
75
75
  - TypeScript
76
76
  - `react` is an optional peer, needed only by the features that render.
77
77
 
78
+ ## Changelog
79
+
80
+ [`CHANGELOG.md`](https://github.com/akan-team/akanjs/blob/main/pkgs/@akanjs/devkit/CHANGELOG.md) is kept in the
81
+ repository; the package does not carry it.
82
+
78
83
  ## License
79
84
 
80
85
  MIT
@@ -52,7 +52,7 @@ describe("Redis tunnels during dev startup", () => {
52
52
  const listener = Bun.listen({ hostname: "127.0.0.1", port: 0, socket: { data() {} } });
53
53
  const port = listener.port;
54
54
  listener.stop(true);
55
- process.env.SSH_TUNNEL_PORT = String(port);
55
+ Object.assign(process.env, { SSH_TUNNEL_PORT: String(port), SSH_TUNNEL_PASSWORD: "test-password" });
56
56
  if (mode === "local") process.env.AKAN_PUBLIC_ENV = "local";
57
57
  const create = IncrementalBuilderHost.create;
58
58
  IncrementalBuilderHost.create = async () =>
@@ -406,8 +406,10 @@ describe("a stop while the builder is starting", () => {
406
406
  const starting = host.start();
407
407
  await Bun.sleep(50);
408
408
  expect(builder.started).toBe(1);
409
+ //? Read before the stop: stop() takes real time with a backend alive, and Bun fails a test on an unread rejection.
410
+ const outcome = settled(starting);
409
411
  await host.stop();
410
- expect(await settled(starting)).toBe("dev server stopped before the builder was ready");
412
+ expect(await outcome).toBe("dev server stopped before the builder was ready");
411
413
  exitLate?.();
412
414
  await Bun.sleep(50);
413
415
  expect({ creates, stopped: builder.stopped }).toEqual({ creates: 1, stopped: 1 });
@@ -2,6 +2,7 @@ import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { Logger } from "akanjs/common";
4
4
  import type { BuilderMessage } from "akanjs/server";
5
+ import { AppBin } from "../app/appBin";
5
6
  import type { App } from "../commandDecorators";
6
7
  import { WorkspaceExecutor } from "../executors";
7
8
  import type { DevStdioMode } from "../incrementalBuilder";
@@ -199,8 +200,18 @@ export class AkanAppHost {
199
200
  }
200
201
  if (!this.#backend.running) this.#backend.start();
201
202
  this.#idle.arm();
203
+ void this.#warnMissingBin();
202
204
  return this;
203
205
  }
206
+ //? A bin two libs declare differently fails the build that carries it; a dev start has nothing to carry.
207
+ async #warnMissingBin() {
208
+ const names = await this.app
209
+ .getConfig()
210
+ .then((config) => new AppBin(this.app, config).names())
211
+ .catch(() => []);
212
+ const missing = AppBin.missing(names);
213
+ if (missing) this.logger.warn(missing);
214
+ }
204
215
  async stop() {
205
216
  //? Nothing reapplies once it stops: a pages ok received meanwhile would bring children back after it.
206
217
  this.#stopping = true;
@@ -23,6 +23,10 @@ export class AkanBin {
23
23
  );
24
24
  }
25
25
 
26
+ static imagePath(binDir: string) {
27
+ return `/workspace/${binDir}/$TARGETARCH:$PATH`;
28
+ }
29
+
26
30
  static isArchive(source: AkanBinSource): boolean {
27
31
  return AkanBin.archive.test("url" in source ? new URL(source.url).pathname : source.path);
28
32
  }
@@ -6,7 +6,17 @@ import { fileURLToPath } from "node:url";
6
6
  import { AppExecutor, WorkspaceExecutor } from "../executors";
7
7
  import { NativeConfig } from "../mobile/nativeConfig";
8
8
  import type { PackageJson } from "../workspace/types";
9
+ import { AkanBin } from "./akanBin";
9
10
  import { AkanAppConfig, AkanLibConfig, deriveDefaultAppId } from "./akanConfig";
11
+ import {
12
+ BUN_IMAGE_PIN,
13
+ DEFAULT_DOCKER_IMAGE,
14
+ DOCKER_INIT,
15
+ DOCKERFILE_FORMAT,
16
+ dockerfileLayoutOf,
17
+ dockerfileOf,
18
+ dockerfileSections,
19
+ } from "./dockerImage";
10
20
  import type { LibConfigInput } from "./types";
11
21
 
12
22
  const akanPackageJson = JSON.parse(
@@ -15,7 +25,14 @@ const akanPackageJson = JSON.parse(
15
25
  const rootPackageJson = JSON.parse(
16
26
  fs.readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)), "../../../../package.json"), "utf8"),
17
27
  ) as { engines: { bun: string } };
18
- const pinnedBunImage = `oven/bun:${rootPackageJson.engines.bun}-slim`;
28
+ const writeDirsStep =
29
+ "RUN mkdir -p /workspace/sqlite /workspace/local /workspace/runtime /workspace/data /workspace/.akan/artifact/image-cache && chown 1000:1000 /workspace/sqlite /workspace/local /workspace/runtime /workspace/data /workspace/.akan/artifact/image-cache";
30
+ const setupActionBunVersion = /bun-version:\s*(\S+)/.exec(
31
+ fs.readFileSync(
32
+ path.join(path.dirname(fileURLToPath(import.meta.url)), "../../../../.github/actions/setup/action.yml"),
33
+ "utf8",
34
+ ),
35
+ )?.[1];
19
36
 
20
37
  const packageJson: PackageJson = {
21
38
  name: "repo",
@@ -151,7 +168,9 @@ describe("AkanAppConfig", () => {
151
168
  expect(config.publicEnv).toEqual(["AKAN_PUBLIC_FEATURE"]);
152
169
  expect(config.optimizeImports).toContain("custom-icons");
153
170
  expect(config.dockerfile).toContain('CMD ["bun","server.js"]');
154
- expect(config.dockerfile).toContain("FROM oven/bun:amd64 AS amd64");
171
+ expect(config.dockerfile).toContain(
172
+ "FROM oven/bun:amd64 AS amd64\nFROM oven/bun:arm64 AS arm64\nFROM $TARGETARCH\n",
173
+ );
155
174
  expect(config.dockerfile).toContain('RUN if [ "$TARGETARCH" = "arm64"');
156
175
  });
157
176
 
@@ -166,6 +185,16 @@ describe("AkanAppConfig", () => {
166
185
  expect(unlocked).not.toContain("bun.lock");
167
186
  });
168
187
 
188
+ test("a PATH the build hands in lands after the TARGETARCH it reads and the files it points at", () => {
189
+ const config = new AkanAppConfig(app, [], packageJson, {}, baseDevEnv);
190
+ const carrying = config.dockerfileFor("main", { env: { PATH: AkanBin.imagePath("bin") } });
191
+
192
+ expect(carrying).toContain("ENV PATH=/workspace/bin/$TARGETARCH:$PATH\n");
193
+ expect(carrying.indexOf("ARG TARGETARCH")).toBeLessThan(carrying.indexOf("ENV PATH="));
194
+ expect(carrying.indexOf("COPY . .")).toBeLessThan(carrying.indexOf("ENV PATH="));
195
+ expect(config.dockerfileFor("main")).not.toContain("ENV PATH=");
196
+ });
197
+
169
198
  test.skipIf(process.platform === "win32")(
170
199
  "writes a Dockerfile for a local build that refuses docker build without an explicit build arg",
171
200
  () => {
@@ -180,7 +209,7 @@ describe("AkanAppConfig", () => {
180
209
  env: { PATH: process.env.PATH ?? "", ...(allow ? { AKAN_ALLOW_LOCAL_IMAGE: allow } : {}) },
181
210
  });
182
211
 
183
- expect(local).toContain(`FROM ${pinnedBunImage}\nARG AKAN_ALLOW_LOCAL_IMAGE\nRUN if`);
212
+ expect(local).toContain(`FROM ${DEFAULT_DOCKER_IMAGE}\nARG AKAN_ALLOW_LOCAL_IMAGE\nRUN if`);
184
213
  expect(config.dockerfileFor("main")).not.toContain("AKAN_ALLOW_LOCAL_IMAGE");
185
214
  expect(run().exitCode).toBe(1);
186
215
  expect(run().stderr.toString()).toContain("--build-arg AKAN_ALLOW_LOCAL_IMAGE=1");
@@ -240,7 +269,9 @@ describe("AkanAppConfig", () => {
240
269
  const envBlock = Object.entries(config.getProductionEnv())
241
270
  .map(([key, value]) => `ENV ${key}=${value}`)
242
271
  .join("\n");
243
- expect(config.dockerfile).toContain(`COPY . .\n${envBlock}\nCMD ["bun","main.js"]`);
272
+ expect(config.dockerfile).toContain(
273
+ `COPY . .\n${writeDirsStep}\n${envBlock}\nUSER 1000:1000\nENTRYPOINT ["tini","-s","--"]\nCMD ["bun","main.js"]`,
274
+ );
244
275
  });
245
276
 
246
277
  test('publishes localePrefix "as-needed" to the bundles and the image, and leaves the default out of the image', () => {
@@ -255,19 +286,19 @@ describe("AkanAppConfig", () => {
255
286
  });
256
287
 
257
288
  test("writes the Dockerfile instructions it wrote before its env came from getProductionEnv", () => {
258
- //? 9adfb95c's output for this config, less the blank lines its empty interpolations left and its floating tag.
289
+ //? 9adfb95c's output for this config, less the blank lines its empty interpolations left, its floating tag and root, plus the init.
259
290
  const before = [
260
- `FROM ${pinnedBunImage}`,
261
- "RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends ca-certificates tzdata && rm -rf /var/lib/apt/lists/*",
291
+ `FROM ${DEFAULT_DOCKER_IMAGE}`,
292
+ "RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends ca-certificates tzdata tini && rm -rf /var/lib/apt/lists/*",
262
293
  "RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime",
263
294
  "ARG TARGETARCH",
264
295
  "",
265
- "RUN mkdir -p /workspace",
266
296
  "WORKDIR /workspace",
267
297
  "COPY ./package.json ./bun.lock ./",
268
298
  "RUN bun install --production --frozen-lockfile",
269
299
  "",
270
300
  "COPY . .",
301
+ writeDirsStep,
271
302
  "ENV PORT=8282",
272
303
  "ENV NODE_ENV=production",
273
304
  "ENV AKAN_PUBLIC_REPO_NAME=akanjs",
@@ -283,9 +314,11 @@ describe("AkanAppConfig", () => {
283
314
  "ENV AKAN_DATABASE_MODES=single",
284
315
  "ENV AKAN_LOG_TO_FILE=0",
285
316
  "",
317
+ "USER 1000:1000",
318
+ 'ENTRYPOINT ["tini","-s","--"]',
286
319
  'CMD ["bun","main.js"]',
287
320
  ];
288
- const lines = (text: string) => text.split("\n").filter((line) => line !== "");
321
+ const lines = (text: string) => text.split("\n").filter((line) => line !== "" && !line.startsWith("#"));
289
322
 
290
323
  expect(lines(new AkanAppConfig(app, [], packageJson, {}, baseDevEnv).dockerfile)).toEqual(lines(before.join("\n")));
291
324
  });
@@ -296,17 +329,227 @@ describe("AkanAppConfig", () => {
296
329
  ).toThrow("the native apps ship that bundle");
297
330
  });
298
331
 
299
- test("installs only ca-certificates and tzdata in the default image", () => {
332
+ test("installs only ca-certificates, tzdata and the init in the default image", () => {
300
333
  const config = new AkanAppConfig(app, [], packageJson, {}, baseDevEnv);
301
334
 
302
335
  expect(config.dockerfile).toContain(
303
- "RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends ca-certificates tzdata && rm -rf /var/lib/apt/lists/*",
336
+ "RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends ca-certificates tzdata tini && rm -rf /var/lib/apt/lists/*",
304
337
  );
305
338
  // The Chromium/ffmpeg toolchain moved to per-app `preRuns`; keeping it here paid for it in every image.
306
339
  for (const dropped of ["libnss3", "ffmpeg", "build-essential", "redis", "xdg-utils"])
307
340
  expect(config.dockerfile).not.toContain(dropped);
308
341
  });
309
342
 
343
+ test("pins the default image to the Bun release the repo runs, by the digest kept beside that version", () => {
344
+ expect(rootPackageJson.engines.bun).toBe(BUN_IMAGE_PIN.version);
345
+ expect(setupActionBunVersion).toBe(rootPackageJson.engines.bun);
346
+ expect(BUN_IMAGE_PIN.digest).toMatch(/^sha256:[0-9a-f]{64}$/);
347
+ expect(DEFAULT_DOCKER_IMAGE).toBe(`oven/bun:${BUN_IMAGE_PIN.version}-slim@${BUN_IMAGE_PIN.digest}`);
348
+ });
349
+
350
+ test("runs the generated image as the bun user once every root step is done, owning only what it writes", () => {
351
+ const config = new AkanAppConfig(
352
+ app,
353
+ [],
354
+ packageJson,
355
+ { docker: { preRuns: ["apt-get install -y ffmpeg"], postRuns: ["echo after"] } },
356
+ baseDevEnv,
357
+ );
358
+ const instructions = config.dockerfile.split("\n").filter((line) => line !== "");
359
+ const userAt = instructions.indexOf("USER 1000:1000");
360
+
361
+ expect(instructions.filter((line) => line.startsWith("USER "))).toEqual(["USER 1000:1000"]);
362
+ expect(instructions.slice(userAt + 1)).toEqual(['ENTRYPOINT ["tini","-s","--"]', 'CMD ["bun","main.js"]']);
363
+ for (const rootStep of ["apt-get update", "apt-get install -y ffmpeg", "bun install", "echo after"])
364
+ expect(instructions.findIndex((line) => line.includes(rootStep))).toBeLessThan(userAt);
365
+ expect(instructions.filter((line) => line.includes("--chown"))).toEqual([]);
366
+ expect(instructions[instructions.indexOf("COPY . .") + 1]).toBe(writeDirsStep);
367
+ expect(instructions.filter((line) => line.includes("chown") && / \/workspace( |$)/.test(line))).toEqual([]);
368
+ });
369
+
370
+ test("runs installRuns in the layer of bun install, a lib's before the app's, so a deleted file reaches no layer", () => {
371
+ const config = new AkanAppConfig(
372
+ app,
373
+ ["vision"],
374
+ packageJson,
375
+ {
376
+ docker: {
377
+ installRuns: [
378
+ "find node_modules -name '*.map' -delete || true",
379
+ { arm64: "rm -rf node_modules/a/linux/x64" },
380
+ ],
381
+ },
382
+ },
383
+ baseDevEnv,
384
+ [],
385
+ { externalLibs: [], docker: { preRuns: [], installRuns: ["rm -rf node_modules/a/darwin"], postRuns: [] } },
386
+ );
387
+
388
+ expect(config.dockerfile).toContain(
389
+ [
390
+ "RUN bun install --production --frozen-lockfile \\",
391
+ " && ( rm -rf node_modules/a/darwin ) \\",
392
+ " && ( find node_modules -name '*.map' -delete || true ) \\",
393
+ ' && if [ "$TARGETARCH" = "arm64" ]; then rm -rf node_modules/a/linux/x64; fi',
394
+ "# akan:app",
395
+ "COPY . .",
396
+ ].join("\n"),
397
+ );
398
+ });
399
+
400
+ test("crossBuild installs on the build machine for the target, and the target's stage runs no bun", () => {
401
+ const docker = { crossBuild: true, preRuns: ["echo pre"], installRuns: ["echo prune"], postRuns: ["echo post"] };
402
+ const lines = new AkanAppConfig(app, [], packageJson, { docker }, baseDevEnv).dockerfile.split("\n");
403
+ const target = lines.lastIndexOf(`FROM ${DEFAULT_DOCKER_IMAGE}`);
404
+
405
+ expect(lines.slice(0, target)).toEqual([
406
+ "# akan:dockerfile 1",
407
+ "# akan:install-stage",
408
+ `FROM --platform=$BUILDPLATFORM ${DEFAULT_DOCKER_IMAGE} AS install`,
409
+ "ARG TARGETARCH",
410
+ "WORKDIR /workspace",
411
+ "COPY ./package.json ./bun.lock ./",
412
+ 'RUN bun install --production --frozen-lockfile --os linux --cpu "$(echo "$TARGETARCH" | sed s/amd64/x64/)" \\',
413
+ " && ( echo prune )",
414
+ "# akan:base",
415
+ ]);
416
+ expect(lines.slice(target).filter((line) => line.includes("bun install"))).toEqual([]);
417
+ expect(lines.slice(lines.indexOf("# akan:pre-runs"), lines.indexOf("COPY . .") + 1)).toEqual([
418
+ "# akan:pre-runs",
419
+ "RUN echo pre",
420
+ "# akan:install",
421
+ "WORKDIR /workspace",
422
+ "COPY --from=install /workspace ./",
423
+ "# akan:post-runs",
424
+ "RUN echo post",
425
+ "# akan:app",
426
+ "COPY . .",
427
+ ]);
428
+ });
429
+
430
+ test("crossBuild installs with the pinned image where each architecture names its own, and a local build still refuses", () => {
431
+ const docker = { crossBuild: true, image: { arm64: "vendor/bun:arm64" } };
432
+ const local = new AkanAppConfig(app, [], packageJson, { docker }, baseDevEnv).dockerfileFor("local");
433
+
434
+ expect(local).toContain(
435
+ `# akan:install-stage\nFROM --platform=$BUILDPLATFORM ${DEFAULT_DOCKER_IMAGE} AS install\n`,
436
+ );
437
+ expect(local).toContain(
438
+ `FROM ${DEFAULT_DOCKER_IMAGE} AS amd64\nFROM vendor/bun:arm64 AS arm64\nFROM $TARGETARCH\nARG AKAN_ALLOW_LOCAL_IMAGE\n`,
439
+ );
440
+ });
441
+
442
+ test("lays docker.env over the build's ENV lines in place, quoting a value Docker would split", () => {
443
+ const docker = { env: { AKAN_PUBLIC_OPERATION_MODE: "edge", EDGE_MODE: "camera", MOTD: 'say "hi" there' } };
444
+ const env = new AkanAppConfig(app, [], packageJson, { docker }, baseDevEnv).dockerfile
445
+ .split("\n")
446
+ .filter((line) => line.startsWith("ENV "));
447
+ const plain = new AkanAppConfig(app, [], packageJson, {}, baseDevEnv).dockerfile
448
+ .split("\n")
449
+ .filter((line) => line.startsWith("ENV "));
450
+
451
+ expect(env).toEqual([
452
+ ...plain.map((line) =>
453
+ line === "ENV AKAN_PUBLIC_OPERATION_MODE=cloud" ? "ENV AKAN_PUBLIC_OPERATION_MODE=edge" : line,
454
+ ),
455
+ "ENV EDGE_MODE=camera",
456
+ 'ENV MOTD="say \\"hi\\" there"',
457
+ ]);
458
+ });
459
+
460
+ test("refuses a docker.env key that names no variable and a value holding a line break", () => {
461
+ const configOf = (docker: object) => new AkanAppConfig(app, [], packageJson, { docker }, baseDevEnv);
462
+
463
+ expect(() => configOf({ env: { "EDGE MODE": "camera" } })).toThrow('docker.env names "EDGE MODE"');
464
+ expect(() => configOf({ variants: { edge: { env: { EDGE_MODE: "a\nb" } } } })).toThrow(
465
+ "docker.variants.edge.env.EDGE_MODE holds a line break",
466
+ );
467
+ });
468
+
469
+ test("a variant is the app's docker with its named fields replaced and its env laid over the app's, and a lib's steps reach it", () => {
470
+ const tools = "curl -fsSL https://example.com/kubectl -o /usr/local/bin/kubectl";
471
+ const docker = {
472
+ preRuns: [tools],
473
+ postRuns: ["echo post"],
474
+ env: { REGION: "seoul", EDGE_MODE: "off" },
475
+ variants: {
476
+ edge: { preRuns: [], crossBuild: true, env: { AKAN_PUBLIC_OPERATION_MODE: "edge", EDGE_MODE: "camera" } },
477
+ },
478
+ };
479
+ const lib = { externalLibs: [], docker: { preRuns: ["echo lib"], installRuns: [], postRuns: [] } };
480
+ const config = new AkanAppConfig(app, ["vision"], packageJson, { docker }, baseDevEnv, [], lib);
481
+ const edge = config.dockerfileFor("main", { variant: "edge" });
482
+
483
+ expect(config.dockerVariants).toEqual({
484
+ edge: {
485
+ image: DEFAULT_DOCKER_IMAGE,
486
+ preRuns: ["echo lib"],
487
+ installRuns: [],
488
+ postRuns: ["echo post"],
489
+ command: ["bun", "main.js"],
490
+ crossBuild: true,
491
+ env: { REGION: "seoul", EDGE_MODE: "camera", AKAN_PUBLIC_OPERATION_MODE: "edge" },
492
+ },
493
+ });
494
+ expect(config.dockerfileFor("main")).toContain("ENV EDGE_MODE=off\n");
495
+ expect(config.dockerfileFor("main")).toContain(`RUN echo lib\nRUN ${tools}\n`);
496
+ expect(config.dockerfileFor("main")).toContain("ENV AKAN_PUBLIC_OPERATION_MODE=cloud\n");
497
+ expect(config.dockerfileFor("main")).toContain("ENV REGION=seoul\n");
498
+ expect(edge).toContain(`# akan:install-stage\nFROM --platform=$BUILDPLATFORM ${DEFAULT_DOCKER_IMAGE} AS install\n`);
499
+ expect(edge).toContain("RUN echo lib\n# akan:install\nWORKDIR /workspace\n");
500
+ expect(edge).not.toContain("kubectl");
501
+ expect(edge).toContain("ENV AKAN_PUBLIC_OPERATION_MODE=edge\n");
502
+ expect(edge).toContain("ENV EDGE_MODE=camera\n");
503
+ expect(edge).toContain("ENV REGION=seoul\n");
504
+ expect(edge).not.toContain("EDGE_MODE=off");
505
+ });
506
+
507
+ test("refuses a variant name that cannot end a file name, and a variant nothing declares", () => {
508
+ const configOf = (docker: string | object) => new AkanAppConfig(app, [], packageJson, { docker }, baseDevEnv);
509
+
510
+ expect(() => configOf({ variants: { "Edge Box": {} } })).toThrow('docker.variants names "Edge Box"');
511
+ expect(() => configOf({ variants: { edge: {} } }).dockerfileFor("main", { variant: "kiosk" })).toThrow(
512
+ 'declares no docker variant "kiosk"',
513
+ );
514
+ expect(configOf("FROM scratch").dockerVariants).toEqual({});
515
+ });
516
+
517
+ test("opens the Dockerfile with its format and marks each section it wrote, so a tool finds one without matching its instructions", () => {
518
+ const plain = dockerfileLayoutOf(new AkanAppConfig(app, [], packageJson, {}, baseDevEnv).dockerfile);
519
+ expect(plain?.format).toBe(DOCKERFILE_FORMAT);
520
+ expect([...(plain?.sections.keys() ?? [])]).toEqual(["base", "install", "app"]);
521
+ expect(plain?.sections.get("install")).toEqual([
522
+ "WORKDIR /workspace",
523
+ "COPY ./package.json ./bun.lock ./",
524
+ "RUN bun install --production --frozen-lockfile",
525
+ ]);
526
+ expect(plain?.sections.get("base")?.[0]).toBe(`FROM ${DEFAULT_DOCKER_IMAGE}`);
527
+ expect(plain?.sections.get("app")?.at(-2)).toBe(`ENTRYPOINT ${JSON.stringify(DOCKER_INIT)}`);
528
+
529
+ const docker = { crossBuild: true, preRuns: ["echo pre"], installRuns: ["echo prune"], postRuns: ["echo post"] };
530
+ const every = dockerfileLayoutOf(new AkanAppConfig(app, [], packageJson, { docker }, baseDevEnv).dockerfile);
531
+ expect([...(every?.sections.keys() ?? [])]).toEqual([...dockerfileSections]);
532
+ expect(every?.sections.get("install")).toEqual(["WORKDIR /workspace", "COPY --from=install /workspace ./"]);
533
+ expect(every?.sections.get("install-stage")?.at(-1)).toBe(" && ( echo prune )");
534
+ });
535
+
536
+ test("reads no layout from a Dockerfile it did not write, and the format of one a later version wrote", () => {
537
+ expect(dockerfileLayoutOf('FROM oven/bun:1-slim\nCOPY . .\nCMD ["bun","main.js"]')).toBeNull();
538
+ expect(dockerfileLayoutOf("# akan:base\nFROM scratch")).toBeNull();
539
+ const later = dockerfileLayoutOf("# akan:dockerfile 7\n# akan:base\nFROM scratch\n# akan:warm\nRUN true");
540
+ expect(later?.format).toBe(7);
541
+ expect(later?.sections.get("warm")).toEqual(["RUN true"]);
542
+ });
543
+
544
+ test("the akanConfig entry carries the generator, for a tool that checks its edits against the installed one", async () => {
545
+ const entry = await import("./index");
546
+ expect(entry.dockerfileOf).toBe(dockerfileOf);
547
+ expect(entry.dockerfileLayoutOf).toBe(dockerfileLayoutOf);
548
+ expect(entry.DEFAULT_DOCKER_IMAGE).toBe(DEFAULT_DOCKER_IMAGE);
549
+ expect(entry.DOCKER_INIT).toBe(DOCKER_INIT);
550
+ expect(entry.DOCKERFILE_FORMAT).toBe(DOCKERFILE_FORMAT);
551
+ });
552
+
310
553
  test("keeps a declared Dockerfile string verbatim", () => {
311
554
  const dockerfile = 'FROM oven/bun:1-slim\nCOPY . .\nCMD ["bun","main.js"]';
312
555
  const config = new AkanAppConfig(app, [], packageJson, { docker: dockerfile }, baseDevEnv);
@@ -319,10 +562,13 @@ describe("AkanAppConfig", () => {
319
562
  const config = new AkanAppConfig(app, [], packageJson, { docker: { preRuns: ["echo hi"] } }, baseDevEnv);
320
563
 
321
564
  expect(config.docker).toEqual({
322
- image: pinnedBunImage,
565
+ image: DEFAULT_DOCKER_IMAGE,
323
566
  preRuns: ["echo hi"],
567
+ installRuns: [],
324
568
  postRuns: [],
325
569
  command: ["bun", "main.js"],
570
+ crossBuild: false,
571
+ env: {},
326
572
  });
327
573
  });
328
574
 
@@ -870,6 +1116,16 @@ describe("AkanAppConfig", () => {
870
1116
  expect(make({ native: { desktop: { dmg: { backgroundImage: "bg.png" } } } })).toThrow(
871
1117
  "native.desktop.dmg.backgroundImage in apps/portal/akan.config.ts is not a native setting",
872
1118
  );
1119
+ expect(make({ native: { desktop: { externalView: { origins: ["https://board.example"] } } } })).toThrow(
1120
+ "native.desktop.externalView.origins in apps/portal/akan.config.ts is not a native setting. Known: allowOrigins, evaluate, sendKey.",
1121
+ );
1122
+ expect(
1123
+ make({
1124
+ native: {
1125
+ desktop: { externalView: { allowOrigins: ["https://board.example"], evaluate: true, sendKey: true } },
1126
+ },
1127
+ }),
1128
+ ).not.toThrow();
873
1129
  });
874
1130
 
875
1131
  test("derives a repo-scoped default appId and records an explicit native section", () => {
@@ -906,7 +1162,7 @@ describe("AkanAppConfig lib externalLibs", () => {
906
1162
  { externalLibs: ["@external/runtime"] },
907
1163
  baseDevEnv,
908
1164
  [],
909
- { externalLibs: ["@external/runtime", "puppeteer"], docker: { preRuns: [], postRuns: [] } },
1165
+ { externalLibs: ["@external/runtime", "puppeteer"], docker: { preRuns: [], installRuns: [], postRuns: [] } },
910
1166
  );
911
1167
 
912
1168
  expect(config.externalLibs).toEqual(["@external/runtime", "puppeteer"]);
@@ -928,9 +1184,9 @@ describe("AkanAppConfig lib externalLibs", () => {
928
1184
  });
929
1185
 
930
1186
  describe("AkanAppConfig lib docker runs", () => {
931
- const libDocker = (preRuns: string[], postRuns: string[] = []) => ({
1187
+ const libDocker = (preRuns: string[], postRuns: string[] = [], installRuns: string[] = []) => ({
932
1188
  externalLibs: [],
933
- docker: { preRuns, postRuns },
1189
+ docker: { preRuns, installRuns, postRuns },
934
1190
  });
935
1191
 
936
1192
  test("runs lib steps before the app's own, deduped", () => {
@@ -993,7 +1249,7 @@ describe("AkanAppConfig trustedDependencies and bin", () => {
993
1249
  {
994
1250
  externalLibs: [],
995
1251
  trustedDependencies: ["sharp", "@serialport/bindings-cpp"],
996
- docker: { preRuns: [], postRuns: [] },
1252
+ docker: { preRuns: [], installRuns: [], postRuns: [] },
997
1253
  },
998
1254
  );
999
1255
  expect(withTrusted.getProductionPackageJson().trustedDependencies).toEqual([
@@ -1017,7 +1273,11 @@ describe("AkanAppConfig trustedDependencies and bin", () => {
1017
1273
  { bin: { ffmpeg: { "darwin-arm64": { path: "tools/ffmpeg" } } } },
1018
1274
  baseDevEnv,
1019
1275
  [],
1020
- { externalLibs: [], docker: { preRuns: [], postRuns: [] }, bin: [{ lib: "media", bin: libBin }] },
1276
+ {
1277
+ externalLibs: [],
1278
+ docker: { preRuns: [], installRuns: [], postRuns: [] },
1279
+ bin: [{ lib: "media", bin: libBin }],
1280
+ },
1021
1281
  );
1022
1282
  expect(config.bin).toEqual({
1023
1283
  ffmpeg: { "darwin-arm64": { path: path.resolve("/repo/apps/portal/tools/ffmpeg") } },
@@ -1054,9 +1314,10 @@ describe("AkanLibConfig", () => {
1054
1314
 
1055
1315
  test("defaults docker runs to empty lists and preserves declared ones", () => {
1056
1316
  const lib = { name: "shared" } as never;
1057
- expect(new AkanLibConfig(lib, {}).docker).toEqual({ preRuns: [], postRuns: [] });
1058
- expect(new AkanLibConfig(lib, { docker: { preRuns: ["echo lib"] } }).docker).toEqual({
1317
+ expect(new AkanLibConfig(lib, {}).docker).toEqual({ preRuns: [], installRuns: [], postRuns: [] });
1318
+ expect(new AkanLibConfig(lib, { docker: { preRuns: ["echo lib"], installRuns: ["rm -rf a"] } }).docker).toEqual({
1059
1319
  preRuns: ["echo lib"],
1320
+ installRuns: ["rm -rf a"],
1060
1321
  postRuns: [],
1061
1322
  });
1062
1323
  });