@akanjs/devkit 3.3.1-rc.0 → 3.4.0-rc.1

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.
@@ -1,4 +1,5 @@
1
1
  import {
2
+ type PipelineDesktopOtaPlatform,
2
3
  type PipelineDiagnostic,
3
4
  PipelineNames,
4
5
  PipelinePattern,
@@ -6,6 +7,8 @@ import {
6
7
  type PipelineValueProblem,
7
8
  PipelineValueReader,
8
9
  pipelineActionNames,
10
+ pipelineDesktopOtaArchs,
11
+ pipelineDesktopOtaSystems,
9
12
  pipelineMilestones,
10
13
  pipelineOtaPlatforms,
11
14
  pipelinePlanLimits,
@@ -136,7 +139,7 @@ export class PipelineInputReader {
136
139
  "use",
137
140
  ...PipelineInputReader.#stageKeys,
138
141
  "retry",
139
- ...(raw.use === "ota" ? ["targets", "platforms"] : []),
142
+ ...(raw.use === "ota" || raw.use === "desktop-ota" ? ["targets", "platforms"] : []),
140
143
  ])
141
144
  )
142
145
  return null;
@@ -165,7 +168,7 @@ export class PipelineInputReader {
165
168
  ? null
166
169
  : this.#nonEmptySet(this.#strings(raw.targets, `${path}.targets`), `${path}.targets`),
167
170
  platforms:
168
- raw.platforms === undefined
171
+ action !== "ota" || raw.platforms === undefined
169
172
  ? null
170
173
  : this.#nonEmptySet(
171
174
  this.#list(raw.platforms, `${path}.platforms`).flatMap((platform, idx) => {
@@ -174,10 +177,47 @@ export class PipelineInputReader {
174
177
  }),
175
178
  `${path}.platforms`,
176
179
  ),
180
+ desktopPlatforms: action === "desktop-ota" ? this.#desktopPlatforms(raw.platforms, `${path}.platforms`) : null,
177
181
  path,
178
182
  };
179
183
  }
180
184
 
185
+ #desktopPlatforms(value: unknown, path: string): PipelineDesktopOtaPlatform[] | null {
186
+ if (value === undefined || (Array.isArray(value) && !value.length)) {
187
+ this.#report(
188
+ "pipeline.desktopOta.noPlatforms",
189
+ '`desktop-ota` names the `platforms` it packs for, like { os: "macos", arch: "arm64" }: it has no default, since each needs a build host of its own OS',
190
+ path,
191
+ );
192
+ return null;
193
+ }
194
+ const seen = new Set<string>();
195
+ const platforms = this.#list(value, path).flatMap((entry, idx): PipelineDesktopOtaPlatform[] => {
196
+ const entryPath = `${path}[${idx}]`;
197
+ const raw = this.#read.object(entry, entryPath, ["os", "arch"]);
198
+ if (!raw) return [];
199
+ const os = this.#read.oneOf(raw.os, `${entryPath}.os`, pipelineDesktopOtaSystems);
200
+ const arch = this.#read.oneOf(raw.arch, `${entryPath}.arch`, pipelineDesktopOtaArchs);
201
+ if (!os || !arch) return [];
202
+ const shown = `{ os: "${os}", arch: "${arch}" }`;
203
+ if (os === "macos" && arch === "x64") {
204
+ this.#report(
205
+ "pipeline.desktopOta.unsupportedPlatform",
206
+ `${shown} cannot be packed: a macOS app is built for arm64 only`,
207
+ entryPath,
208
+ );
209
+ return [];
210
+ }
211
+ if (seen.has(shown)) {
212
+ this.#report("pipeline.desktopOta.duplicatePlatform", `${shown} is listed twice`, entryPath);
213
+ return [];
214
+ }
215
+ seen.add(shown);
216
+ return [{ os, arch }];
217
+ });
218
+ return platforms.length ? platforms : null;
219
+ }
220
+
181
221
  #nonEmptySet<T>(items: T[], path: string): T[] | null {
182
222
  if (!items.length) {
183
223
  this.#report("pipeline.schema.invalid", "lists none: leave it out to take the default", path);
@@ -1,5 +1,6 @@
1
1
  import type {
2
2
  PipelineActionName,
3
+ PipelineDesktopOtaPlatform,
3
4
  PipelineMilestone,
4
5
  PipelineOtaPlatform,
5
6
  PipelinePlanRetry,
@@ -49,9 +50,12 @@ export interface PipelineActionStageRule extends PipelineStageRuleBase {
49
50
  action: PipelineActionName;
50
51
  named: boolean;
51
52
  retry: PipelinePlanRetry | null;
52
- /** `ota` only; `null` takes the default. */
53
+ /** `ota` and `desktop-ota` only; `null` takes the default. */
53
54
  targets: string[] | null;
55
+ /** `ota` only; `null` takes the default. */
54
56
  platforms: PipelineOtaPlatform[] | null;
57
+ /** `desktop-ota` only, which has no default: `null` there was reported by the reader. */
58
+ desktopPlatforms: PipelineDesktopOtaPlatform[] | null;
55
59
  }
56
60
 
57
61
  export interface PipelineParallelStageRule extends PipelineStageRuleBase {
@@ -93,7 +93,7 @@ describe("RuntimeImports", () => {
93
93
  }
94
94
  expect(skipped).toEqual([]);
95
95
  expect(resolved).toBeGreaterThan(20000);
96
- });
96
+ }, 30_000);
97
97
 
98
98
  test("reads a specifier through its extension, index, doubled slashes and dot segments", () => {
99
99
  const file = "apps/demo/lib/memo/Memo.Zone.tsx";
@@ -84,4 +84,14 @@ describe("TypeScriptDependencyScanner — getPackageBuildDependencies", () => {
84
84
 
85
85
  expect((await scanner.getPackageBuildDependencies("@akanjs/devkit")).missingDeps).toEqual(["pkg-b"]);
86
86
  });
87
+
88
+ test("skips a *.fixture.* file, which only a test loads", async () => {
89
+ const root = await makeTempRoot();
90
+ await write(root, "pkgs/@akanjs/devkit/transforms/render.fixture.tsx", `await import("pkg-a/server.node");\n`);
91
+ await write(root, "pkgs/@akanjs/devkit/quality/table.fixture.ts", `import b from "pkg-b";\nexport const x = b;\n`);
92
+ await write(root, "pkgs/@akanjs/devkit/transforms/render.ts", `import c from "pkg-c";\nexport const x = c;\n`);
93
+ const scanner = await scannerFor(root);
94
+
95
+ expect((await scanner.getPackageBuildDependencies("@akanjs/devkit")).missingDeps).toEqual(["pkg-c"]);
96
+ });
87
97
  });
@@ -6,7 +6,7 @@ import type { App, Lib, Pkg } from "../commandDecorators";
6
6
  import { FileSys } from "../util/fileSys";
7
7
  import type { PackageJson, TsConfigJson } from "./types";
8
8
 
9
- const testFileRegex = /\.(?:test|spec)\.[cm]?[tj]sx?$/;
9
+ const testFileRegex = /\.(?:test|spec|fixture)\.[cm]?[tj]sx?$/;
10
10
  // `__fixtures__` holds deliberately invalid lint-rule samples, whose imports are violations, not dependencies.
11
11
  const skipDirs = ["node_modules", "dist", "build", ".git", ".next", "public", "ios", "android", "__fixtures__"];
12
12
  const isSkippedPath = (filePath: string) => {