@akanjs/devkit 2.3.8-rc.4 → 2.3.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @akanjs/devkit
2
2
 
3
+ ## 2.3.8
4
+
5
+ ### Patch Changes
6
+
7
+ - f518afd: Improve dictionary type inference and lint coverage for generated workspaces.
8
+ - Updated dependencies [f518afd]
9
+ - Updated dependencies [f518afd]
10
+ - akanjs@2.3.8
11
+
3
12
  ## 2.3.6
4
13
 
5
14
  ### Patch Changes
@@ -11,7 +11,7 @@ const BACKEND_RESTART_DEBOUNCE_MS = 120;
11
11
  const BACKEND_GRACEFUL_TIMEOUT_MS = 3000;
12
12
  const BACKEND_RECOVERY_BASE_DELAY_MS = 1_000;
13
13
  const BACKEND_RECOVERY_MAX_DELAY_MS = 30_000;
14
- const BUILDER_READY_TIMEOUT_MS = 15000;
14
+ const BUILDER_READY_TIMEOUT_MS = 150000;
15
15
  const BUILDER_START_MAX_ATTEMPTS = 3;
16
16
  const SOURCE_EXTS = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"]);
17
17
  const NON_SOURCE_EXT_RE =
@@ -102,6 +102,7 @@ const getOptionValue = async (argMeta: ArgMeta, opt: Record<string, unknown>, co
102
102
 
103
103
  if (enumChoices) {
104
104
  const choices = normalizeEnumChoices((await resolveEnumChoices(argMeta, context)) ?? []);
105
+ if (choices.length === 1) return choices[0]?.value;
105
106
  const choice = await select({ message: ask ?? desc ?? `Select the ${name} value`, choices });
106
107
  return choice;
107
108
  } else if (nullable) return null;
@@ -0,0 +1,19 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import path from "node:path";
3
+ import { getDirname } from "./getDirname";
4
+
5
+ describe("getDirname", () => {
6
+ test("converts file URLs to filesystem paths", () => {
7
+ const dirname = getDirname("file:///tmp/akan%20workspace/index.ts");
8
+
9
+ expect(dirname).toBe(path.join("/tmp", "akan workspace"));
10
+ });
11
+
12
+ test("keeps Windows drive paths valid when running on Windows", () => {
13
+ if (process.platform !== "win32") return;
14
+
15
+ const dirname = getDirname("file:///C:/Users/ken78/.bun/install/global/node_modules/@akanjs/devkit/index.ts");
16
+
17
+ expect(dirname).toBe("C:\\Users\\ken78\\.bun\\install\\global\\node_modules\\@akanjs\\devkit");
18
+ });
19
+ });
package/getDirname.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import path from "node:path";
2
+ import { fileURLToPath } from "node:url";
2
3
 
3
- export const getDirname = (url: string) => path.dirname(new URL(url).pathname);
4
+ export const getDirname = (url: string) => path.dirname(fileURLToPath(url));
@@ -24,7 +24,7 @@ describe("mobile target helpers", () => {
24
24
  expect(targetHtmlFilename({ ...target, basePath: undefined })).toBe("index.html");
25
25
  });
26
26
 
27
- test("lists route base paths when only one mobile target is configured", async () => {
27
+ test("uses the configured mobile target as the only choice when one target is configured", async () => {
28
28
  const app = {
29
29
  getConfig: async () => ({
30
30
  basePaths: new Set(["akanjs", "soft", "office"]),
@@ -32,7 +32,8 @@ describe("mobile target helpers", () => {
32
32
  }),
33
33
  } as unknown as App;
34
34
 
35
- await expect(getMobileTargetChoices(app)).resolves.toEqual(["akanjs", "soft", "office"]);
35
+ await expect(getMobileTargetChoices(app)).resolves.toEqual(["akanjs"]);
36
+ await expect(resolveMobileTargets(app, undefined)).resolves.toEqual([{ name: "akanjs", config: target }]);
36
37
  });
37
38
 
38
39
  test("resolves a route base path onto the default mobile target config", async () => {
@@ -19,10 +19,8 @@ export const getMobileTargets = async (app: App): Promise<ResolvedMobileTarget[]
19
19
  export const getMobileTargetChoices = async (app: App): Promise<string[]> => {
20
20
  const config = await app.getConfig();
21
21
  const targetNames = Object.keys(config.mobile.targets);
22
- if (targetNames.length > 1) return targetNames;
23
- const basePaths = [...config.basePaths];
24
- if (basePaths.length > 1) return basePaths;
25
22
  if (targetNames.length > 0) return targetNames;
23
+ const basePaths = [...config.basePaths];
26
24
  return basePaths;
27
25
  };
28
26
 
@@ -52,6 +50,7 @@ export const resolveMobileTargets = async (
52
50
  const config = await app.getConfig();
53
51
  const targets = await getMobileTargets(app);
54
52
  if (targets.length === 0) throw new Error(`No mobile targets configured for ${app.name}`);
53
+ if (!selection && targets.length === 1) return targets;
55
54
  if (!selection) {
56
55
  const choices = await getMobileTargetChoices(app);
57
56
  if (choices.length === 1) return resolveMobileTargets(app, choices[0]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/devkit",
3
- "version": "2.3.8-rc.4",
3
+ "version": "2.3.8",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -32,7 +32,7 @@
32
32
  "@langchain/openai": "^1.4.6",
33
33
  "@tailwindcss/node": "^4.3.0",
34
34
  "@trapezedev/project": "^7.1.4",
35
- "akanjs": "2.3.8-rc.4",
35
+ "akanjs": "2.3.8",
36
36
  "chalk": "^5.6.2",
37
37
  "commander": "^14.0.3",
38
38
  "daisyui": "5.5.23",