@akanjs/devkit 3.0.0-alpha.19 → 3.0.0-alpha.20
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 +7 -9
- package/executors.ts +17 -4
- package/package.json +2 -2
package/executors.test.ts
CHANGED
|
@@ -881,16 +881,14 @@ describe("scan info construction", () => {
|
|
|
881
881
|
});
|
|
882
882
|
|
|
883
883
|
describe("AppExecutor.shouldRelaunchForAppEnv", () => {
|
|
884
|
-
test("relaunches when the app name
|
|
885
|
-
expect(AppExecutor.shouldRelaunchForAppEnv("sceny",
|
|
886
|
-
expect(AppExecutor.shouldRelaunchForAppEnv("sceny",
|
|
884
|
+
test("relaunches when the process was born without the app name, or with another app's", () => {
|
|
885
|
+
expect(AppExecutor.shouldRelaunchForAppEnv("sceny", undefined, undefined)).toBe(true);
|
|
886
|
+
expect(AppExecutor.shouldRelaunchForAppEnv("sceny", "other", undefined)).toBe(true);
|
|
887
887
|
});
|
|
888
888
|
|
|
889
|
-
test("runs in place when the name
|
|
890
|
-
expect(AppExecutor.shouldRelaunchForAppEnv("sceny",
|
|
891
|
-
expect(AppExecutor.shouldRelaunchForAppEnv("sceny",
|
|
892
|
-
expect(
|
|
893
|
-
AppExecutor.shouldRelaunchForAppEnv("sceny", { AKAN_BUILD_RELAUNCHED: "1", AKAN_PUBLIC_APP_NAME: "other" }),
|
|
894
|
-
).toBe(false);
|
|
889
|
+
test("runs in place when the name was present at birth, and never relaunches twice", () => {
|
|
890
|
+
expect(AppExecutor.shouldRelaunchForAppEnv("sceny", "sceny", undefined)).toBe(false);
|
|
891
|
+
expect(AppExecutor.shouldRelaunchForAppEnv("sceny", undefined, "1")).toBe(false);
|
|
892
|
+
expect(AppExecutor.shouldRelaunchForAppEnv("sceny", "other", "1")).toBe(false);
|
|
895
893
|
});
|
|
896
894
|
});
|
package/executors.ts
CHANGED
|
@@ -1284,6 +1284,10 @@ interface AppExecutorOptions {
|
|
|
1284
1284
|
workspace?: WorkspaceExecutor;
|
|
1285
1285
|
name: string;
|
|
1286
1286
|
}
|
|
1287
|
+
// Captured at module load, before the command dispatcher patches the resolved app name into `process.env` —
|
|
1288
|
+
// the relaunch guard below must judge what bundler macros will see, which is the env this process was born with.
|
|
1289
|
+
const bootAppName = process.env.AKAN_PUBLIC_APP_NAME;
|
|
1290
|
+
|
|
1287
1291
|
export class AppExecutor extends SysExecutor {
|
|
1288
1292
|
// `typescript` costs ~65MB resident, so keep it out of the module graph of every process that only
|
|
1289
1293
|
// ever imports an executor. Route validation is the sole consumer here and is already async.
|
|
@@ -1347,15 +1351,24 @@ export class AppExecutor extends SysExecutor {
|
|
|
1347
1351
|
* to them — and any hand-written `@libs/<lib>/server` import puts that lib's env files (module-scope `getEnv()`)
|
|
1348
1352
|
* into the `getSerializedSignal` macro graph. `AKAN_PUBLIC_APP_NAME` is the one required key no workspace root
|
|
1349
1353
|
* `.env` can carry, so the build relaunches itself once with it in place; the child sees it from birth.
|
|
1354
|
+
*
|
|
1355
|
+
* The decision compares the boot snapshot, never the live `process.env`: the command dispatcher writes the
|
|
1356
|
+
* resolved app into `process.env.AKAN_PUBLIC_APP_NAME` before any command method runs, which satisfies runtime
|
|
1357
|
+
* readers but not macros — trusting it is how this relaunch shipped once without ever firing.
|
|
1350
1358
|
*/
|
|
1351
|
-
static shouldRelaunchForAppEnv(
|
|
1352
|
-
|
|
1353
|
-
|
|
1359
|
+
static shouldRelaunchForAppEnv(
|
|
1360
|
+
appName: string,
|
|
1361
|
+
bootName: string | undefined = bootAppName,
|
|
1362
|
+
marker: string | undefined = process.env.AKAN_BUILD_RELAUNCHED,
|
|
1363
|
+
) {
|
|
1364
|
+
if (marker === "1") return false;
|
|
1365
|
+
return bootName !== appName;
|
|
1354
1366
|
}
|
|
1355
1367
|
async relaunchWithAppEnv(): Promise<number | null> {
|
|
1356
1368
|
if (!AppExecutor.shouldRelaunchForAppEnv(this.name)) return null;
|
|
1369
|
+
console.info(`Relaunching with AKAN_PUBLIC_APP_NAME=${this.name} so bundler macros see the app env.`);
|
|
1357
1370
|
const child = Bun.spawn([process.execPath, ...process.argv.slice(1)], {
|
|
1358
|
-
env: { ...this.getCommandEnv(), AKAN_BUILD_RELAUNCHED: "1" },
|
|
1371
|
+
env: { ...this.getCommandEnv(), AKAN_PUBLIC_APP_NAME: this.name, AKAN_BUILD_RELAUNCHED: "1" },
|
|
1359
1372
|
stdin: "inherit",
|
|
1360
1373
|
stdout: "inherit",
|
|
1361
1374
|
stderr: "inherit",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/devkit",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.20",
|
|
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.
|
|
48
|
+
"akanjs": "3.0.0-alpha.20",
|
|
49
49
|
"chalk": "^5.6.2",
|
|
50
50
|
"commander": "^14.0.3",
|
|
51
51
|
"dayjs": "^1.11.20",
|