@akanjs/devkit 3.4.0-rc.0 → 3.4.0-rc.2
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/executors.test.ts +51 -44
- package/executors/pkgExecutor.ts +13 -10
- package/mobile/nativeConfig.test.ts +36 -1
- package/mobile/nativeConfig.ts +31 -4
- package/package.json +3 -4
- package/pipeline/PipelineCompiler.test.ts +49 -3
- package/pipeline/PipelineCompiler.ts +2 -1
- package/quality/runtimeImports.test.ts +1 -1
- package/workspace/dependencyScanner.test.ts +10 -0
- package/workspace/dependencyScanner.ts +1 -1
|
@@ -1319,10 +1319,10 @@ describe("Workspace and app executor environment contracts", () => {
|
|
|
1319
1319
|
});
|
|
1320
1320
|
|
|
1321
1321
|
describe("PkgExecutor package generation", () => {
|
|
1322
|
-
test("generates dist package metadata from root dependency versions", async () => {
|
|
1322
|
+
test("generates dist package metadata from root dependency versions, leaving the source manifest alone", async () => {
|
|
1323
1323
|
const root = await makeTempRoot();
|
|
1324
1324
|
await writeJson(path.join(root, "package.json"), rootPackageJson());
|
|
1325
|
-
|
|
1325
|
+
const sourcePackageJson = {
|
|
1326
1326
|
name: "@sample/tool",
|
|
1327
1327
|
version: "0.1.0",
|
|
1328
1328
|
description: "tool",
|
|
@@ -1330,7 +1330,8 @@ describe("PkgExecutor package generation", () => {
|
|
|
1330
1330
|
peerDependencies: { react: "19.0.0" },
|
|
1331
1331
|
peerDependenciesMeta: { react: { optional: true } },
|
|
1332
1332
|
optionalDependencies: { "@sample/native": "1.0.0" },
|
|
1333
|
-
}
|
|
1333
|
+
};
|
|
1334
|
+
await writeJson(path.join(root, "pkgs/@sample/tool/package.json"), sourcePackageJson);
|
|
1334
1335
|
|
|
1335
1336
|
const workspace = new WorkspaceExecutor({ workspaceRoot: root, repoName: "repo" });
|
|
1336
1337
|
const pkg = PkgExecutor.from(workspace, "@sample/tool");
|
|
@@ -1352,7 +1353,7 @@ describe("PkgExecutor package generation", () => {
|
|
|
1352
1353
|
default: "./index.ts",
|
|
1353
1354
|
});
|
|
1354
1355
|
expect(await Bun.file(path.join(root, "dist/pkgs/@sample/tool/package.json")).json()).toEqual(distPackageJson);
|
|
1355
|
-
expect(await Bun.file(path.join(root, "pkgs/@sample/tool/package.json")).json()).toEqual(
|
|
1356
|
+
expect(await Bun.file(path.join(root, "pkgs/@sample/tool/package.json")).json()).toEqual(sourcePackageJson);
|
|
1356
1357
|
});
|
|
1357
1358
|
|
|
1358
1359
|
test("names a sibling the root links as workspace:* at the sibling's own version", async () => {
|
|
@@ -1623,48 +1624,54 @@ describe("SysExecutor scan", () => {
|
|
|
1623
1624
|
expect(fullSrv).toContain('import * as cnst from "./cnst";\nimport * as db from "./db";');
|
|
1624
1625
|
});
|
|
1625
1626
|
|
|
1626
|
-
test.skipIf(!hasBiome)(
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1627
|
+
test.skipIf(!hasBiome)(
|
|
1628
|
+
"writes barrels, module indexes and akan.lib.json the way Biome prints them",
|
|
1629
|
+
async () => {
|
|
1630
|
+
const component = "export const C = () => null;\n";
|
|
1631
|
+
const uiFiles = ["QRCode", "Qa", "SSOButton", "Select", "Icon10", "Icon2"].map((name) => [
|
|
1632
|
+
`ui/${name}.tsx`,
|
|
1633
|
+
component,
|
|
1634
|
+
]);
|
|
1635
|
+
const srvkitFiles = ["aB", "aa", "a10", "a9"].map((name) => [`srvkit/${name}.ts`, "export const x = 1;\n"]);
|
|
1636
|
+
const moduleFiles = ["Template", "Unit", "View"].map((role) => [`lib/post/Post.${role}.tsx`, component]);
|
|
1637
|
+
const { root, lib, libDir } = await createScannableLib("biomestable", {
|
|
1638
|
+
files: Object.fromEntries([
|
|
1639
|
+
...uiFiles,
|
|
1640
|
+
...srvkitFiles,
|
|
1641
|
+
...moduleFiles,
|
|
1642
|
+
["lib/post/post.constant.ts", "export class Post {}\n"],
|
|
1643
|
+
]),
|
|
1644
|
+
});
|
|
1645
|
+
expect(await formatWithBiome('export * from "./b";\nexport * from "./a";\n', "libs/x/srvkit/index.ts")).toBe(
|
|
1646
|
+
'export * from "./a";\nexport * from "./b";\n',
|
|
1647
|
+
);
|
|
1645
1648
|
|
|
1646
|
-
|
|
1649
|
+
await lib.scan();
|
|
1647
1650
|
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1651
|
+
expect(await lib.readFile("ui/index.ts")).toBe(
|
|
1652
|
+
["Icon2", "Icon10", "Qa", "QRCode", "Select", "SSOButton"]
|
|
1653
|
+
.map((name) => `export * from "./${name}";\n`)
|
|
1654
|
+
.join(""),
|
|
1655
|
+
);
|
|
1656
|
+
expect(await lib.readFile("srvkit/index.ts")).toBe(
|
|
1657
|
+
["a9", "a10", "aa", "aB"].map((name) => `export * from "./${name}";\n`).join(""),
|
|
1658
|
+
);
|
|
1659
|
+
for (const file of [
|
|
1660
|
+
"ui/index.ts",
|
|
1661
|
+
"srvkit/index.ts",
|
|
1662
|
+
"lib/post/index.ts",
|
|
1663
|
+
"akan.lib.json",
|
|
1664
|
+
"env/env.server.type.ts",
|
|
1665
|
+
]) {
|
|
1666
|
+
const generated = await lib.readFile(file);
|
|
1667
|
+
expect(await formatWithBiome(generated, `libs/biomestable/${file}`)).toBe(generated);
|
|
1668
|
+
}
|
|
1669
|
+
const devSync = new DevGeneratedIndexSync({ workspaceRoot: root });
|
|
1670
|
+
const events = ["ui/QRCode.tsx", "srvkit/a9.ts", "lib/post"].map((file) => path.join(libDir, file));
|
|
1671
|
+
expect(await devSync.syncForBatch(events)).toEqual({ changedFiles: [], errors: [] });
|
|
1672
|
+
},
|
|
1673
|
+
30_000,
|
|
1674
|
+
);
|
|
1668
1675
|
|
|
1669
1676
|
test.skipIf(!hasBiome)(
|
|
1670
1677
|
"writes env.server.type.ts the way Biome prints it, spreading libs in dependency order",
|
package/executors/pkgExecutor.ts
CHANGED
|
@@ -71,18 +71,21 @@ export class PkgExecutor extends Executor {
|
|
|
71
71
|
Object.fromEntries(names.map((dep) => [dep, dependencyVersions.get(dep) as string]));
|
|
72
72
|
return { dependencies: toDependencyMap(dependencyNames), devDependencies: toDependencyMap(devDependencyNames) };
|
|
73
73
|
}
|
|
74
|
-
async
|
|
74
|
+
async updateDistPackageJsonDependencies(
|
|
75
75
|
dependencies: string[] = [],
|
|
76
76
|
devDependencies: string[] = [],
|
|
77
|
-
): Promise<PackageJson> {
|
|
78
|
-
|
|
77
|
+
): Promise<PackageJson | null> {
|
|
78
|
+
if (!(await this.dist.exists("package.json"))) return null;
|
|
79
|
+
const [rootPackageJson, distPkgJson] = await Promise.all([
|
|
80
|
+
this.workspace.getPackageJson(),
|
|
81
|
+
this.dist.readJson("package.json") as Promise<PackageJson>,
|
|
82
|
+
]);
|
|
79
83
|
const dependencyMaps = await this.#toDependencyMap(rootPackageJson, dependencies, devDependencies);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return newPkgJson;
|
|
84
|
+
//? A build script that drops a dependency field from its manifest has bundled those packages into its output.
|
|
85
|
+
const keptMaps = Object.fromEntries(Object.entries(dependencyMaps).filter(([field]) => field in distPkgJson));
|
|
86
|
+
const newDistPkgJson: PackageJson = { ...distPkgJson, ...keptMaps };
|
|
87
|
+
await this.dist.writeJson("package.json", newDistPkgJson);
|
|
88
|
+
return newDistPkgJson;
|
|
86
89
|
}
|
|
87
90
|
async generateDistPackageJson(dependencies: string[] = [], devDependencies: string[] = []): Promise<PackageJson> {
|
|
88
91
|
const [rootPackageJson, pkgJson] = await Promise.all([this.workspace.getPackageJson(), this.getPackageJson()]);
|
|
@@ -101,7 +104,7 @@ export class PkgExecutor extends Executor {
|
|
|
101
104
|
engines: { bun: ">=1.4.4" },
|
|
102
105
|
...dependencyMaps,
|
|
103
106
|
};
|
|
104
|
-
await
|
|
107
|
+
await this.dist.writeJson("package.json", distPkgJson);
|
|
105
108
|
return distPkgJson;
|
|
106
109
|
}
|
|
107
110
|
async build(): Promise<void> {
|
|
@@ -158,7 +158,7 @@ describe("NativeConfig.build", () => {
|
|
|
158
158
|
platform: "android",
|
|
159
159
|
});
|
|
160
160
|
|
|
161
|
-
expect(warnings).toEqual([
|
|
161
|
+
expect(warnings).toEqual([]);
|
|
162
162
|
expect(config).toEqual({
|
|
163
163
|
app: { id: "com.portal.admin", name: "Portal Admin", fileName: "portal-admin", version: "2.1.0", build: 42 },
|
|
164
164
|
web: { dir: "/repo/dist/native/portal/admin/web" },
|
|
@@ -180,7 +180,10 @@ describe("NativeConfig.build", () => {
|
|
|
180
180
|
NSLocationAlwaysUsageDescription: "Portal Admin requires access to the location to get the user's location.",
|
|
181
181
|
NSLocationWhenInUseUsageDescription: "Portal Admin requires access to the location to get the user's location.",
|
|
182
182
|
NSContactsUsageDescription: "Portal Admin requires access to the contacts to find people you know.",
|
|
183
|
+
NSMicrophoneUsageDescription: "Portal Admin requires access to the microphone to recognize speech.",
|
|
184
|
+
NSSpeechRecognitionUsageDescription: "Portal Admin requires speech recognition to turn speech into text.",
|
|
183
185
|
},
|
|
186
|
+
permissions: { microphone: true, speech: true },
|
|
184
187
|
deepLinks: { domains: [{ host: "portal.example", pathPrefixes: ["/en/admin", "/ko/admin"] }] },
|
|
185
188
|
native: {
|
|
186
189
|
ios: { infoPlist: { ITSAppUsesNonExemptEncryption: false } },
|
|
@@ -506,6 +509,38 @@ describe("NativeConfig.build", () => {
|
|
|
506
509
|
expect((await NativeApi.load(repoApp)).validateConfig(config, { appDir: root })).toEqual([]);
|
|
507
510
|
});
|
|
508
511
|
|
|
512
|
+
test("a microphone permission gives the shell its usage key with no plugin, and desktop.infoPlist reaches the macOS build", async () => {
|
|
513
|
+
const root = await makeTempRoot();
|
|
514
|
+
const infoPlist = {
|
|
515
|
+
NSMicrophoneUsageDescription: "Talk in meetings.",
|
|
516
|
+
NSCameraUsageDescription: "Join video calls.",
|
|
517
|
+
};
|
|
518
|
+
const { config, warnings } = NativeConfig.build({
|
|
519
|
+
appPath: root,
|
|
520
|
+
target: {
|
|
521
|
+
...minimalTarget,
|
|
522
|
+
permissions: ["microphone"],
|
|
523
|
+
deepLinks: undefined,
|
|
524
|
+
android: undefined,
|
|
525
|
+
desktop: { infoPlist },
|
|
526
|
+
},
|
|
527
|
+
webDir: path.join(root, "web"),
|
|
528
|
+
contributions: [],
|
|
529
|
+
locales: ["en"],
|
|
530
|
+
platform: "macos",
|
|
531
|
+
});
|
|
532
|
+
|
|
533
|
+
expect(warnings).toEqual([]);
|
|
534
|
+
expect(config.permissions).toEqual({ microphone: true });
|
|
535
|
+
expect(config.usageDescriptions).toEqual({
|
|
536
|
+
NSMicrophoneUsageDescription: `${minimalTarget.appName} requires access to the microphone for calls and recordings.`,
|
|
537
|
+
});
|
|
538
|
+
expect(config.native?.macos).toEqual({ infoPlist });
|
|
539
|
+
await mkdir(path.join(root, "web"), { recursive: true });
|
|
540
|
+
await writeFile(path.join(root, "web/index.html"), "<html><head></head><body></body></html>");
|
|
541
|
+
expect((await NativeApi.load(repoApp)).validateConfig(config, { appDir: root })).toEqual([]);
|
|
542
|
+
});
|
|
543
|
+
|
|
509
544
|
test("ios.hideFormAccessoryBar reaches the iOS shell next to the dev build's id suffix, and the runtime accepts it", async () => {
|
|
510
545
|
const root = await makeTempRoot();
|
|
511
546
|
const build = (ios?: { hideFormAccessoryBar?: boolean }) =>
|
package/mobile/nativeConfig.ts
CHANGED
|
@@ -46,6 +46,7 @@ export interface NativeConfigResult {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
type NativeIos = NonNullable<NonNullable<AkanNativeConfig["native"]>["ios"]>;
|
|
49
|
+
type NativeWebPermissions = NonNullable<AkanNativeConfig["permissions"]>;
|
|
49
50
|
|
|
50
51
|
export class NativeConfig {
|
|
51
52
|
//* What every akanjs page may call: routing, lifecycle, links, storage, the device facts the runtime reads, the
|
|
@@ -101,7 +102,8 @@ export class NativeConfig {
|
|
|
101
102
|
];
|
|
102
103
|
//? Also bounds the links the shell hands to the OS; on mobile, openExternalUrl sends http(s) to the browser plugin.
|
|
103
104
|
static readonly defaultOpenUrls: readonly string[] = ["https://*:*", "mailto:*", "tel:*"];
|
|
104
|
-
//* Used when no plugin of the app or its libs claims the permission
|
|
105
|
+
//* Used when no plugin of the app or its libs claims the permission. microphone and speech bring no plugin: the page's
|
|
106
|
+
//* own getUserMedia and webkitSpeechRecognition use them, and webPermissions gives the shell their usage keys.
|
|
105
107
|
static readonly builtinContributions: { [permission in NativePermission]: AkanPluginNativeConfig } = {
|
|
106
108
|
camera: {
|
|
107
109
|
permission: "camera",
|
|
@@ -128,8 +130,25 @@ export class NativeConfig {
|
|
|
128
130
|
"$(PRODUCT_NAME) requires access to the location to get the user's location.",
|
|
129
131
|
},
|
|
130
132
|
},
|
|
133
|
+
microphone: {
|
|
134
|
+
permission: "microphone",
|
|
135
|
+
usageDescriptions: {
|
|
136
|
+
microphoneUsageDescription: "$(PRODUCT_NAME) requires access to the microphone for calls and recordings.",
|
|
137
|
+
},
|
|
138
|
+
},
|
|
131
139
|
push: { permission: "push", plugins: ["push"] },
|
|
132
|
-
speech: {
|
|
140
|
+
speech: {
|
|
141
|
+
permission: "speech",
|
|
142
|
+
usageDescriptions: {
|
|
143
|
+
microphoneUsageDescription: "$(PRODUCT_NAME) requires access to the microphone to recognize speech.",
|
|
144
|
+
speechRecognitionUsageDescription: "$(PRODUCT_NAME) requires speech recognition to turn speech into text.",
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
//? Speech recognition listens through the microphone, and WebKit refuses it without both usage texts.
|
|
149
|
+
static readonly webPermissions: { [permission in NativePermission]?: (keyof NativeWebPermissions)[] } = {
|
|
150
|
+
microphone: ["microphone"],
|
|
151
|
+
speech: ["microphone", "speech"],
|
|
133
152
|
};
|
|
134
153
|
|
|
135
154
|
static build({
|
|
@@ -150,7 +169,7 @@ export class NativeConfig {
|
|
|
150
169
|
const applied = (target.permissions ?? []).flatMap((permission) => {
|
|
151
170
|
const claimed = contributions.filter((contribution) => contribution.permission === permission);
|
|
152
171
|
const used = claimed.length ? claimed : [NativeConfig.builtinContributions[permission]];
|
|
153
|
-
if (!used.some((contribution) => contribution.plugins?.length))
|
|
172
|
+
if (!used.some((contribution) => contribution.plugins?.length) && !NativeConfig.webPermissions[permission])
|
|
154
173
|
warnings.push(`Permission '${permission}' has no native plugin yet; the app ships without it.`);
|
|
155
174
|
return used;
|
|
156
175
|
});
|
|
@@ -214,7 +233,9 @@ export class NativeConfig {
|
|
|
214
233
|
...Object.entries(target.ios?.files ?? {}).map(([to, from]) => ({ from: abs(from), to: `ios/${to}` })),
|
|
215
234
|
...Object.entries(target.android?.files ?? {}).map(([to, from]) => ({ from: abs(from), to: `android/${to}` })),
|
|
216
235
|
];
|
|
217
|
-
const
|
|
236
|
+
const { entitlements, infoPlist } = target.desktop ?? {};
|
|
237
|
+
const macos = NativeConfig.#compact({ entitlements, infoPlist });
|
|
238
|
+
const webPermissions = NativeConfig.#webPermissionsOf(target);
|
|
218
239
|
const native = NativeConfig.#compact({ ios, macos, android, resources });
|
|
219
240
|
const googleServices = target.android?.googleServices;
|
|
220
241
|
const pushAndroid = target.android?.push;
|
|
@@ -248,6 +269,7 @@ export class NativeConfig {
|
|
|
248
269
|
],
|
|
249
270
|
...(csp ? { security: { csp } } : {}),
|
|
250
271
|
...(Object.keys(usageDescriptions).length ? { usageDescriptions } : {}),
|
|
272
|
+
...(Object.keys(webPermissions).length ? { permissions: webPermissions } : {}),
|
|
251
273
|
...(target.deepLinks?.schemes?.length || target.deepLinks?.domains?.length
|
|
252
274
|
? { deepLinks: NativeConfig.#deepLinks(target, locales, i18n) }
|
|
253
275
|
: {}),
|
|
@@ -452,6 +474,11 @@ export class NativeConfig {
|
|
|
452
474
|
}
|
|
453
475
|
|
|
454
476
|
/** Drops empty arrays and objects, and answers undefined when nothing is left. */
|
|
477
|
+
static #webPermissionsOf(target: AkanNativeTarget): NativeWebPermissions {
|
|
478
|
+
const names = (target.permissions ?? []).flatMap((permission) => NativeConfig.webPermissions[permission] ?? []);
|
|
479
|
+
return Object.fromEntries(names.map((name) => [name, true]));
|
|
480
|
+
}
|
|
481
|
+
|
|
455
482
|
static #compact<T extends object>(value: { [key: string]: unknown }): T | undefined {
|
|
456
483
|
const kept = Object.entries(value).filter(([, entry]) =>
|
|
457
484
|
Array.isArray(entry)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/devkit",
|
|
3
|
-
"version": "3.4.0-rc.
|
|
3
|
+
"version": "3.4.0-rc.2",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"./workspace/getRelatedCnsts": "./workspace/getRelatedCnsts.ts"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@akanjs/language": "3.4.0-rc.
|
|
55
|
+
"@akanjs/language": "3.4.0-rc.2",
|
|
56
56
|
"@inquirer/prompts": "^8.7.3",
|
|
57
57
|
"@tailwindcss/node": "^4.3.3",
|
|
58
|
-
"akanjs": "3.4.0-rc.
|
|
58
|
+
"akanjs": "3.4.0-rc.2",
|
|
59
59
|
"chalk": "^6.0.1",
|
|
60
60
|
"commander": "^15.0.0",
|
|
61
61
|
"dayjs": "^1.11.23",
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"fonteditor-core": "^2.6.3",
|
|
64
64
|
"ignore": "^7.0.12",
|
|
65
65
|
"ora": "^9.4.1",
|
|
66
|
-
"react-server-dom-webpack": "^19.3.1",
|
|
67
66
|
"subset-font": "^2.9.0",
|
|
68
67
|
"tailwind-scrollbar": "^4.0.2",
|
|
69
68
|
"tailwindcss": "^4.3.3",
|
|
@@ -668,7 +668,7 @@ describe("PipelineCompiler", () => {
|
|
|
668
668
|
});
|
|
669
669
|
});
|
|
670
670
|
|
|
671
|
-
test("is skipped with the app's earlier action,
|
|
671
|
+
test("is skipped with the app's earlier action, and takes when.changed like any action", () => {
|
|
672
672
|
const plan = planOf(
|
|
673
673
|
compile({
|
|
674
674
|
ctx: context({ branch: "develop", env: "develop", apps: ["web"] }),
|
|
@@ -676,7 +676,8 @@ describe("PipelineCompiler", () => {
|
|
|
676
676
|
apps: {
|
|
677
677
|
web: {
|
|
678
678
|
stages: [
|
|
679
|
-
{ use: "
|
|
679
|
+
{ use: "build" },
|
|
680
|
+
{ use: "deploy", when: { branch: "main" } },
|
|
680
681
|
{ use: "desktop-ota", platforms: [mac], when: { changed: ["apps/web/**"] } },
|
|
681
682
|
],
|
|
682
683
|
},
|
|
@@ -684,11 +685,56 @@ describe("PipelineCompiler", () => {
|
|
|
684
685
|
}),
|
|
685
686
|
);
|
|
686
687
|
expect(desktopPhase(plan)?.stages[0]).toMatchObject({
|
|
687
|
-
skip: { reason: "
|
|
688
|
+
skip: { reason: "deploy of web is skipped" },
|
|
688
689
|
runtimeWhen: { changed: ["apps/web/**"] },
|
|
689
690
|
});
|
|
690
691
|
});
|
|
691
692
|
|
|
693
|
+
test("never takes on the skip of ota, a separate release, but takes the one of the action before it", () => {
|
|
694
|
+
const lanes = (deploy: { branch: string } | undefined) =>
|
|
695
|
+
planOf(
|
|
696
|
+
compile({
|
|
697
|
+
ctx: context({ branch: "develop", env: "develop", apps: ["web"] }),
|
|
698
|
+
nativeTargets: webTargets,
|
|
699
|
+
apps: {
|
|
700
|
+
web: {
|
|
701
|
+
stages: [
|
|
702
|
+
{ use: "build" },
|
|
703
|
+
{ use: "deploy", ...(deploy ? { when: deploy } : {}) },
|
|
704
|
+
{ use: "ota", when: { branch: "release" } },
|
|
705
|
+
{ use: "desktop-ota", platforms: [mac] },
|
|
706
|
+
],
|
|
707
|
+
},
|
|
708
|
+
},
|
|
709
|
+
}),
|
|
710
|
+
);
|
|
711
|
+
const released = lanes(undefined);
|
|
712
|
+
expect(released.phases.find((phase) => phase.action === "ota")?.stages[0]?.skip).toEqual({
|
|
713
|
+
reason: 'branch "develop" does not match "release"',
|
|
714
|
+
});
|
|
715
|
+
expect(desktopPhase(released)?.stages[0]?.skip).toBeNull();
|
|
716
|
+
const undeployed = lanes({ branch: "main" });
|
|
717
|
+
expect(undeployed.phases.find((phase) => phase.action === "ota")?.stages[0]?.skip).toEqual({
|
|
718
|
+
reason: 'branch "develop" does not match "release"',
|
|
719
|
+
});
|
|
720
|
+
expect(desktopPhase(undeployed)?.stages[0]?.skip).toEqual({ reason: "deploy of web is skipped" });
|
|
721
|
+
const alone = planOf(
|
|
722
|
+
compile({
|
|
723
|
+
ctx: context({ branch: "develop", env: "develop", apps: ["web"] }),
|
|
724
|
+
nativeTargets: webTargets,
|
|
725
|
+
apps: {
|
|
726
|
+
web: {
|
|
727
|
+
stages: [
|
|
728
|
+
{ use: "ota", when: { branch: "release" } },
|
|
729
|
+
{ use: "desktop-ota", platforms: [mac] },
|
|
730
|
+
],
|
|
731
|
+
},
|
|
732
|
+
},
|
|
733
|
+
}),
|
|
734
|
+
);
|
|
735
|
+
expect(desktopPhase(alone)?.stages[0]?.skip).toBeNull();
|
|
736
|
+
});
|
|
737
|
+
|
|
692
738
|
test("a workspace stage may not take the id of its phase or of the slot behind it", () => {
|
|
693
739
|
for (const name of ["Desktop OTA", "After desktop OTA", "After desktop OTA 2"])
|
|
694
740
|
expect(codes(compile({ workspace: { before: [{ name, sh: "x" }] } }))).toEqual(["pipeline.id.reserved"]);
|
|
@@ -359,7 +359,8 @@ export class PipelineCompiler {
|
|
|
359
359
|
if (!stage) continue;
|
|
360
360
|
const inherited = previous && lane.skips.get(previous) ? { reason: `${previous} of ${app} is skipped` } : null;
|
|
361
361
|
lane.skips.set(action, this.#skipOf(stage.when) ?? inherited);
|
|
362
|
-
|
|
362
|
+
//? A phone bundle and a desktop app are separate releases: `desktop-ota` never takes on `ota`'s skip.
|
|
363
|
+
if (action !== "ota") previous = action;
|
|
363
364
|
}
|
|
364
365
|
return lane;
|
|
365
366
|
}
|
|
@@ -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) => {
|