@akanjs/devkit 3.0.0-alpha.13 → 3.0.0-alpha.14

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.
package/executors.test.ts CHANGED
@@ -760,6 +760,29 @@ describe("Workspace and app executor environment contracts", () => {
760
760
  expect(offsetMinimalStart.env.AKAN_PUBLIC_CLIENT_PORT).toBe("8286");
761
761
  expect(offsetMinimalStart.env.AKAN_PUBLIC_SERVER_PORT).toBe("8286");
762
762
  });
763
+
764
+ test("pins the start command to development so an ambient NODE_ENV cannot pick the production router", async () => {
765
+ const root = await makeTempRoot();
766
+ process.env.AKAN_PUBLIC_REPO_NAME = "repo";
767
+ process.env.AKAN_PUBLIC_SERVE_DOMAIN = "example.com";
768
+ process.env.AKAN_PUBLIC_ENV = "local";
769
+ await writeJson(path.join(root, "package.json"), rootPackageJson());
770
+ await mkdir(path.join(root, "apps/ambient"), { recursive: true });
771
+ await writeFile(path.join(root, "apps/ambient/akan.config.ts"), "export default {};\n");
772
+
773
+ const originalNodeEnv = process.env.NODE_ENV;
774
+ process.env.NODE_ENV = "production";
775
+ try {
776
+ const workspace = new WorkspaceExecutor({ workspaceRoot: root, repoName: "repo" });
777
+ const started = await AppExecutor.from(workspace, "ambient").prepareCommand("start");
778
+ expect(started.env.NODE_ENV).toBe("development");
779
+ // The builder runs in this process and bakes NODE_ENV into the dev bundles it emits.
780
+ expect(process.env.NODE_ENV).toBe("development");
781
+ } finally {
782
+ if (originalNodeEnv === undefined) delete process.env.NODE_ENV;
783
+ else process.env.NODE_ENV = originalNodeEnv;
784
+ }
785
+ });
763
786
  });
764
787
 
765
788
  describe("PkgExecutor package generation", () => {
package/executors.ts CHANGED
@@ -1364,6 +1364,12 @@ export class AppExecutor extends SysExecutor {
1364
1364
  this.cp("public", `${this.dist.cwdPath}/public`, { dereference: true }),
1365
1365
  ]);
1366
1366
  } else await this.removeDir(".akan");
1367
+ //? `akan start` is the dev server, and it must say so rather than inherit an answer. Bun auto-loads the
1368
+ //? workspace `.env`, so NODE_ENV=production can reach this process without ever being exported in a shell —
1369
+ //? and a dev server that believes it is production serves from the production route cache, whose every
1370
+ //? route throws because a dev artifact carries no routes manifest. Written into `process.env` and not only
1371
+ //? into the child env because the builder runs here and bakes NODE_ENV into the bundles it emits.
1372
+ if (type === "start") process.env.NODE_ENV = "development";
1367
1373
  const devPort = type === "start" ? (await this.getDevPort()).toString() : undefined;
1368
1374
  const env = this.getCommandEnv({
1369
1375
  AKAN_COMMAND_TYPE: type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/devkit",
3
- "version": "3.0.0-alpha.13",
3
+ "version": "3.0.0-alpha.14",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -45,7 +45,7 @@
45
45
  "@langchain/openai": "^1.4.6",
46
46
  "@tailwindcss/node": "^4.3.0",
47
47
  "@trapezedev/project": "^7.1.4",
48
- "akanjs": "3.0.0-alpha.13",
48
+ "akanjs": "3.0.0-alpha.14",
49
49
  "chalk": "^5.6.2",
50
50
  "commander": "^14.0.3",
51
51
  "dayjs": "^1.11.20",