@better-update/cli 0.3.0
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 +58 -0
- package/oxlint.config.ts +6 -0
- package/package.json +36 -0
- package/src/app-layer.ts +29 -0
- package/src/application/build-workflow.ts +222 -0
- package/src/application/command-exit.ts +13 -0
- package/src/application/login.ts +87 -0
- package/src/application/update-promote.ts +88 -0
- package/src/application/update-publish.ts +402 -0
- package/src/application/update-rollback.ts +275 -0
- package/src/commands/analytics/adoption.ts +40 -0
- package/src/commands/analytics/channels.ts +35 -0
- package/src/commands/analytics/helpers.ts +3 -0
- package/src/commands/analytics/index.ts +13 -0
- package/src/commands/analytics/platforms.ts +39 -0
- package/src/commands/analytics/updates.ts +35 -0
- package/src/commands/audit-logs/helpers.ts +3 -0
- package/src/commands/audit-logs/index.ts +8 -0
- package/src/commands/audit-logs/list.ts +66 -0
- package/src/commands/branches.ts +70 -0
- package/src/commands/build/android.ts +129 -0
- package/src/commands/build/index.ts +63 -0
- package/src/commands/build/ios.ts +199 -0
- package/src/commands/build/reserve-and-upload.test.ts +263 -0
- package/src/commands/build/reserve-and-upload.ts +160 -0
- package/src/commands/build/run-step.ts +131 -0
- package/src/commands/builds/compatibility-matrix.ts +48 -0
- package/src/commands/builds/delete.ts +15 -0
- package/src/commands/builds/get.ts +34 -0
- package/src/commands/builds/helpers.ts +3 -0
- package/src/commands/builds/index.ts +20 -0
- package/src/commands/builds/install-link.ts +20 -0
- package/src/commands/builds/list.ts +38 -0
- package/src/commands/channels/create.ts +37 -0
- package/src/commands/channels/delete.ts +15 -0
- package/src/commands/channels/helpers.ts +18 -0
- package/src/commands/channels/index.ts +24 -0
- package/src/commands/channels/list.ts +38 -0
- package/src/commands/channels/pause.ts +15 -0
- package/src/commands/channels/resume.ts +15 -0
- package/src/commands/channels/rollout/complete.ts +17 -0
- package/src/commands/channels/rollout/create.ts +36 -0
- package/src/commands/channels/rollout/index.ts +11 -0
- package/src/commands/channels/rollout/revert.ts +17 -0
- package/src/commands/channels/rollout/update.ts +23 -0
- package/src/commands/channels/update.ts +32 -0
- package/src/commands/credentials/delete.ts +24 -0
- package/src/commands/credentials/index.ts +10 -0
- package/src/commands/credentials/list.ts +33 -0
- package/src/commands/credentials/upload.ts +91 -0
- package/src/commands/env/delete.ts +35 -0
- package/src/commands/env/export.ts +27 -0
- package/src/commands/env/get.ts +25 -0
- package/src/commands/env/helpers.ts +13 -0
- package/src/commands/env/import.ts +31 -0
- package/src/commands/env/index.ts +24 -0
- package/src/commands/env/list.ts +44 -0
- package/src/commands/env/pull.ts +27 -0
- package/src/commands/env/set.ts +42 -0
- package/src/commands/fingerprint/compare.ts +25 -0
- package/src/commands/fingerprint/generate.ts +18 -0
- package/src/commands/fingerprint/index.ts +9 -0
- package/src/commands/init.ts +35 -0
- package/src/commands/login.ts +13 -0
- package/src/commands/logout.ts +12 -0
- package/src/commands/projects.ts +84 -0
- package/src/commands/status.ts +48 -0
- package/src/commands/update/delete.ts +15 -0
- package/src/commands/update/helpers.ts +22 -0
- package/src/commands/update/index.ts +22 -0
- package/src/commands/update/list.ts +60 -0
- package/src/commands/update/promote.ts +30 -0
- package/src/commands/update/publish.ts +94 -0
- package/src/commands/update/rollback.ts +42 -0
- package/src/commands/update/rollout/complete.ts +17 -0
- package/src/commands/update/rollout/index.ts +10 -0
- package/src/commands/update/rollout/revert.ts +17 -0
- package/src/commands/update/rollout/set.ts +23 -0
- package/src/index.ts +53 -0
- package/src/lib/android-keystore.test.ts +114 -0
- package/src/lib/android-keystore.ts +76 -0
- package/src/lib/android-signing-gradle.test.ts +95 -0
- package/src/lib/android-signing-gradle.ts +52 -0
- package/src/lib/app-json.ts +81 -0
- package/src/lib/apple-auth.test.ts +402 -0
- package/src/lib/apple-auth.ts +132 -0
- package/src/lib/artifact-finder.test.ts +195 -0
- package/src/lib/artifact-finder.ts +122 -0
- package/src/lib/browser-login.test.ts +88 -0
- package/src/lib/browser-login.ts +193 -0
- package/src/lib/build-profile.test.ts +290 -0
- package/src/lib/build-profile.ts +234 -0
- package/src/lib/cli-schemas.ts +39 -0
- package/src/lib/command-errors.ts +60 -0
- package/src/lib/credentials-downloader.ts +181 -0
- package/src/lib/credentials-manager.ts +354 -0
- package/src/lib/env-exporter.test.ts +96 -0
- package/src/lib/env-exporter.ts +28 -0
- package/src/lib/exit-codes.ts +82 -0
- package/src/lib/expo-config.ts +130 -0
- package/src/lib/expo-export.test.ts +94 -0
- package/src/lib/expo-export.ts +281 -0
- package/src/lib/fingerprint.ts +67 -0
- package/src/lib/format-error.ts +22 -0
- package/src/lib/git-context.ts +56 -0
- package/src/lib/gradle-config.ts +126 -0
- package/src/lib/ios-export-options.test.ts +98 -0
- package/src/lib/ios-export-options.ts +62 -0
- package/src/lib/ios-keychain.ts +181 -0
- package/src/lib/ios-provisioning.test.ts +115 -0
- package/src/lib/ios-provisioning.ts +179 -0
- package/src/lib/output.ts +32 -0
- package/src/lib/pkcs12.ts +73 -0
- package/src/lib/plist.ts +39 -0
- package/src/lib/post-build-validation.ts +146 -0
- package/src/lib/presigned-upload.test.ts +140 -0
- package/src/lib/presigned-upload.ts +35 -0
- package/src/lib/record.ts +5 -0
- package/src/lib/resolve-named-resource.ts +24 -0
- package/src/lib/runtime-version.test.ts +119 -0
- package/src/lib/runtime-version.ts +62 -0
- package/src/lib/sha256.test.ts +108 -0
- package/src/lib/sha256.ts +80 -0
- package/src/lib/signed-payloads.test.ts +181 -0
- package/src/lib/signed-payloads.ts +164 -0
- package/src/lib/string-utils.ts +4 -0
- package/src/lib/temp-dir.ts +14 -0
- package/src/lib/test-utils.ts +13 -0
- package/src/lib/update-platforms.test.ts +45 -0
- package/src/lib/update-platforms.ts +19 -0
- package/src/lib/xcpretty-formatter.ts +21 -0
- package/src/services/api-client.ts +42 -0
- package/src/services/apple-session-store.ts +100 -0
- package/src/services/auth-store.ts +85 -0
- package/src/services/cli-runtime.ts +46 -0
- package/src/services/config-store.ts +108 -0
- package/src/services/presigned-upload.ts +84 -0
- package/src/services/update-asset-uploader.ts +72 -0
- package/src/types/keychain.d.ts +22 -0
- package/tests/e2e/build.test.ts +270 -0
- package/tests/e2e/commands.test.ts +694 -0
- package/tests/e2e/ota-lifecycle.test.ts +275 -0
- package/tests/e2e/publish.test.ts +150 -0
- package/tests/helpers/cli-e2e.ts +426 -0
- package/tests/helpers/pty-driver.ts +142 -0
- package/tests/interactive/harness/provider-prompt.ts +54 -0
- package/tests/interactive/login.test.ts +47 -0
- package/tests/interactive/provider-select.test.ts +59 -0
- package/tsconfig.json +7 -0
- package/vitest.config.ts +38 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
|
|
3
|
+
import { spawnPty } from "../helpers/pty-driver";
|
|
4
|
+
|
|
5
|
+
const HARNESS = path.resolve(import.meta.dirname, "./harness/provider-prompt.ts");
|
|
6
|
+
|
|
7
|
+
const RESULT_RE = /^RESULT=(\{.*\})$/m;
|
|
8
|
+
|
|
9
|
+
const runHarness = async (actions: (driver: ReturnType<typeof spawnPty>) => Promise<void>) => {
|
|
10
|
+
const driver = spawnPty("bun", [HARNESS], {
|
|
11
|
+
env: {
|
|
12
|
+
FORCE_COLOR: "0",
|
|
13
|
+
NO_COLOR: "1",
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
await driver.expect("Select App Store Connect provider", { timeoutMs: 15_000 });
|
|
18
|
+
await actions(driver);
|
|
19
|
+
await driver.expect(RESULT_RE, { timeoutMs: 10_000 });
|
|
20
|
+
const code = await driver.waitExit({ timeoutMs: 5000 });
|
|
21
|
+
expect(code).toBe(0);
|
|
22
|
+
|
|
23
|
+
const match = RESULT_RE.exec(driver.stripped());
|
|
24
|
+
expect(match, "harness should print RESULT=<json>").not.toBeNull();
|
|
25
|
+
return JSON.parse(match![1]!) as { providerId: number; switched: boolean };
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
describe("provider select prompt (PTY)", () => {
|
|
29
|
+
it("enter without navigation picks the first provider", async () => {
|
|
30
|
+
const result = await runHarness(async (driver) => {
|
|
31
|
+
driver.enter();
|
|
32
|
+
});
|
|
33
|
+
expect(result).toStrictEqual({ providerId: 10, switched: true });
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("down + enter picks the second provider", async () => {
|
|
37
|
+
const result = await runHarness(async (driver) => {
|
|
38
|
+
driver.down();
|
|
39
|
+
driver.enter();
|
|
40
|
+
});
|
|
41
|
+
expect(result).toStrictEqual({ providerId: 20, switched: true });
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("down + down + enter picks the third provider", async () => {
|
|
45
|
+
const result = await runHarness(async (driver) => {
|
|
46
|
+
driver.down(2);
|
|
47
|
+
driver.enter();
|
|
48
|
+
});
|
|
49
|
+
expect(result).toStrictEqual({ providerId: 30, switched: true });
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("up wraps to the last provider", async () => {
|
|
53
|
+
const result = await runHarness(async (driver) => {
|
|
54
|
+
driver.up();
|
|
55
|
+
driver.enter();
|
|
56
|
+
});
|
|
57
|
+
expect(result).toStrictEqual({ providerId: 30, switched: true });
|
|
58
|
+
});
|
|
59
|
+
});
|
package/tsconfig.json
ADDED
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
projects: [
|
|
6
|
+
// ── Unit tests (Node/Bun runtime) ─────────────────────
|
|
7
|
+
{
|
|
8
|
+
test: {
|
|
9
|
+
name: "unit",
|
|
10
|
+
globals: true,
|
|
11
|
+
include: ["src/**/*.test.ts"],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
test: {
|
|
16
|
+
name: "e2e",
|
|
17
|
+
globals: true,
|
|
18
|
+
include: ["tests/e2e/**/*.test.ts"],
|
|
19
|
+
hookTimeout: 120_000,
|
|
20
|
+
testTimeout: 120_000,
|
|
21
|
+
// E2E tests share a common fixture dir (fixtures/e2e-app) and a
|
|
22
|
+
// Wrangler seed SQL path — serialize via fileParallelism=false and
|
|
23
|
+
// The --maxWorkers 1 flag set on test:e2e in package.json.
|
|
24
|
+
fileParallelism: false,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
test: {
|
|
29
|
+
name: "interactive",
|
|
30
|
+
globals: true,
|
|
31
|
+
include: ["tests/interactive/**/*.test.ts"],
|
|
32
|
+
hookTimeout: 30_000,
|
|
33
|
+
testTimeout: 30_000,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
});
|