easc 0.0.33 → 0.0.35

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/README.md CHANGED
@@ -59,6 +59,7 @@ easc submit --profile development # Use dev profile
59
59
  easc submit --auto-submit # Auto-submit to stores
60
60
  easc submit --clear-cache # Clean prebuild
61
61
  easc submit --output ./build.ipa # Custom output path
62
+ easc submit --submitter eas # Upload iOS through EAS Submit instead of Transporter
62
63
  ```
63
64
 
64
65
  ## Development
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easc",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "Expo App Services for Cloudflare - Deploy tool for Expo OTA updates to Cloudflare Workers",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -35,15 +35,15 @@
35
35
  "test:coverage": "vp test --coverage"
36
36
  },
37
37
  "dependencies": {
38
- "@expo/fingerprint": "^0.11.0",
38
+ "@expo/fingerprint": "^0.20.2",
39
39
  "@inquirer/prompts": "^8.3.2",
40
40
  "chalk": "5.6.2",
41
41
  "tsx": "^4.21.0",
42
- "yargs": "^18.0.0",
43
- "zod": "^4.3.6"
42
+ "valibot": "^1.1.0",
43
+ "yargs": "^18.0.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@types/node": "^25.5.0",
46
+ "@types/node": "^26.1.0",
47
47
  "@types/yargs": "^17.0.35",
48
48
  "@vitest/ui": "^4.1.0",
49
49
  "vite-plus": "latest",
@@ -5,6 +5,7 @@ import { Logger } from "../utils/logger";
5
5
  import { Platform, PlatformType } from "../enums/platform";
6
6
  import { runx } from "../utils/runx";
7
7
  import { getEasProfiles } from "../utils/eas";
8
+ import { deliverWithTransporter, isTransporterAvailable } from "../utils/transporter";
8
9
 
9
10
  interface IArgs {
10
11
  platform: PlatformType | "all";
@@ -13,6 +14,7 @@ interface IArgs {
13
14
  clearCache: boolean;
14
15
  output?: string;
15
16
  nonInteractive: boolean;
17
+ submitter: "transporter" | "eas";
16
18
  }
17
19
 
18
20
  function findBuildArtifact(pattern: string): string | null {
@@ -68,6 +70,13 @@ export const submit: CommandModule = {
68
70
  description: "Never prompt for user input",
69
71
  default: false,
70
72
  })
73
+ .option("submitter", {
74
+ type: "string",
75
+ choices: ["transporter", "eas"] as const,
76
+ description:
77
+ "How to upload an iOS build: the Transporter app (no EAS queue; needs the app signed in) or EAS Submit",
78
+ default: isTransporterAvailable() ? "transporter" : "eas",
79
+ })
71
80
  .example("$0 submit", "Build all platforms locally")
72
81
  .example("$0 submit -p ios -e development", "Build iOS with dev profile")
73
82
  .example("$0 submit -s", "Build and submit to stores"),
@@ -136,6 +145,17 @@ export const submit: CommandModule = {
136
145
 
137
146
  logger.info(`Found artifact: ${artifactPath}`);
138
147
 
148
+ if (platform === Platform.iOS && args.submitter === "transporter") {
149
+ // Hand the .ipa to the Transporter app: goes straight to App Store Connect with
150
+ // the app's own Apple ID session, bypassing EAS Submit's queue. The upload runs
151
+ // inside Transporter, so the artifact is left on disk for it.
152
+ await deliverWithTransporter(artifactPath);
153
+ logger.success(
154
+ `${platformName} build handed to Transporter — watch its window for the upload; ${artifactPath} is kept until it finishes`,
155
+ );
156
+ continue;
157
+ }
158
+
139
159
  runx(`eas submit --platform ${platform} --path "${artifactPath}" --non-interactive`, {
140
160
  cwd: process.cwd(),
141
161
  stdio: "inherit",
@@ -9,7 +9,7 @@ import {
9
9
  getAssetFiles,
10
10
  checkExportDirectory,
11
11
  } from "../utils/files";
12
- import { uploadBundle, createDryRunSummary } from "../utils/upload";
12
+ import { uploadBundle, createDryRunSummary, getUpdateSize, formatBytes } from "../utils/upload";
13
13
  import { createFingerprintAsync } from "@expo/fingerprint";
14
14
  import { Logger } from "../utils/logger";
15
15
  import { runx } from "../utils/runx";
@@ -106,6 +106,12 @@ export const update: CommandModule = {
106
106
  const { hash: fingerprint } = await createFingerprintAsync(process.cwd());
107
107
  logger.success(`Fingerprint: ${fingerprint}`);
108
108
 
109
+ const platformUploads = platforms.map((platform) => ({
110
+ platform,
111
+ bundlePath: findBundleFile(exportDir, metadata, platform),
112
+ assetPaths: getAssetFiles(exportDir, metadata, platform),
113
+ }));
114
+
109
115
  logger.section("📤 Deployment Info");
110
116
  logger.table([
111
117
  ["Server", config.otaServer],
@@ -114,14 +120,12 @@ export const update: CommandModule = {
114
120
  ["Fingerprint", fingerprint || ""],
115
121
  ["Export Dir", args.exportDir],
116
122
  ["Channel", channel],
123
+ ...platformUploads.map(({ platform, bundlePath, assetPaths }): [string, string] => [
124
+ `Size (${platform})`,
125
+ formatBytes(getUpdateSize(bundlePath, assetPaths)),
126
+ ]),
117
127
  ]);
118
128
 
119
- const platformUploads = platforms.map((platform) => ({
120
- platform,
121
- bundlePath: findBundleFile(exportDir, metadata, platform),
122
- assetPaths: getAssetFiles(exportDir, metadata, platform),
123
- }));
124
-
125
129
  if (args.dryRun) {
126
130
  for (const { platform, bundlePath, assetPaths } of platformUploads) {
127
131
  logger.section(platform.toUpperCase());
@@ -167,9 +171,9 @@ export const update: CommandModule = {
167
171
 
168
172
  logger.stopSpinner();
169
173
 
170
- const failed = results.filter((r) => r.status === "rejected");
171
- if (failed.length > 0) {
172
- throw (failed[0] as PromiseRejectedResult).reason;
174
+ const firstFailure = results.find((r): r is PromiseRejectedResult => r.status === "rejected");
175
+ if (firstFailure) {
176
+ throw firstFailure.reason;
173
177
  }
174
178
  }
175
179
 
package/src/utils/cli.ts CHANGED
@@ -60,7 +60,7 @@ class InteractiveCLI {
60
60
 
61
61
  this.commands.push({
62
62
  command: commandName,
63
- describe: (cmd.describe as string) ?? "",
63
+ describe: cmd.describe || "",
64
64
  options,
65
65
  handler: cmd.handler as (argv: any) => void | Promise<void>,
66
66
  });
@@ -168,8 +168,7 @@ function _isAppJson(value: unknown): value is IAppJson {
168
168
  if (typeof value !== "object" || value === null || !("expo" in value)) {
169
169
  return false;
170
170
  }
171
- const record = value as Record<string, unknown>;
172
- return typeof record["expo"] === "object" && record["expo"] !== null;
171
+ return typeof value.expo === "object" && value.expo !== null;
173
172
  }
174
173
 
175
174
  /**
@@ -1,26 +1,27 @@
1
1
  import chalk from "chalk";
2
- import { z } from "zod";
2
+ import * as v from "valibot";
3
3
 
4
- const envSchema = z.object({
5
- OTA_SERVER: z.url("OTA_SERVER must be a valid URL"),
6
- OTA_API_KEY: z.string().min(1, "OTA_API_KEY is required"),
4
+ const envSchema = v.object({
5
+ OTA_SERVER: v.pipe(v.string(), v.url("OTA_SERVER must be a valid URL")),
6
+ OTA_API_KEY: v.pipe(v.string(), v.minLength(1, "OTA_API_KEY is required")),
7
7
  });
8
8
 
9
- const channelSchema = z
10
- .string()
11
- .min(1, "Channel name is required")
12
- .regex(
9
+ const channelSchema = v.pipe(
10
+ v.string(),
11
+ v.minLength(1, "Channel name is required"),
12
+ v.regex(
13
13
  /^[a-zA-Z0-9-_]+$/,
14
14
  "Channel names can only contain letters, numbers, hyphens, and underscores",
15
- );
15
+ ),
16
+ );
16
17
 
17
- const configSchema = z.object({
18
+ const configSchema = v.object({
18
19
  channel: channelSchema,
19
- otaServer: z.url(),
20
- apiKey: z.string().min(1),
20
+ otaServer: v.pipe(v.string(), v.url()),
21
+ apiKey: v.pipe(v.string(), v.minLength(1)),
21
22
  });
22
23
 
23
- export type IConfig = z.infer<typeof configSchema>;
24
+ export type IConfig = v.InferOutput<typeof configSchema>;
24
25
 
25
26
  export interface IValidationResult {
26
27
  valid: boolean;
@@ -28,11 +29,11 @@ export interface IValidationResult {
28
29
  }
29
30
 
30
31
  /**
31
- * Format zod errors into user-friendly messages
32
+ * Format valibot issues into user-friendly messages
32
33
  */
33
- function formatZodError(error: z.ZodError, context?: string): string[] {
34
- return error.issues.map((err) => {
35
- const path = err.path.join(".");
34
+ function formatIssues(issues: v.BaseIssue<unknown>[], context?: string): string[] {
35
+ return issues.map((err) => {
36
+ const path = (err.path ?? []).map((p) => p.key).join(".");
36
37
  const message = err.message;
37
38
 
38
39
  if (context === "environment") {
@@ -66,10 +67,10 @@ function formatZodError(error: z.ZodError, context?: string): string[] {
66
67
  }
67
68
 
68
69
  /**
69
- * Validate environment variables using zod
70
+ * Validate environment variables
70
71
  */
71
72
  export function validateEnvironment(): IValidationResult {
72
- const result = envSchema.safeParse({
73
+ const result = v.safeParse(envSchema, {
73
74
  OTA_SERVER: process.env["OTA_SERVER"],
74
75
  OTA_API_KEY: process.env["OTA_API_KEY"],
75
76
  });
@@ -77,7 +78,7 @@ export function validateEnvironment(): IValidationResult {
77
78
  if (!result.success) {
78
79
  return {
79
80
  valid: false,
80
- errors: formatZodError(result.error, "environment"),
81
+ errors: formatIssues(result.issues, "environment"),
81
82
  };
82
83
  }
83
84
 
@@ -85,7 +86,7 @@ export function validateEnvironment(): IValidationResult {
85
86
  }
86
87
 
87
88
  /**
88
- * Validate a channel name using zod
89
+ * Validate a channel name
89
90
  */
90
91
  export function validateChannel(channel: string | undefined): IValidationResult {
91
92
  if (!channel) {
@@ -100,12 +101,12 @@ export function validateChannel(channel: string | undefined): IValidationResult
100
101
  };
101
102
  }
102
103
 
103
- const result = channelSchema.safeParse(channel);
104
+ const result = v.safeParse(channelSchema, channel);
104
105
 
105
106
  if (!result.success) {
106
107
  return {
107
108
  valid: false,
108
- errors: formatZodError(result.error, "channel"),
109
+ errors: formatIssues(result.issues, "channel"),
109
110
  };
110
111
  }
111
112
 
@@ -0,0 +1,18 @@
1
+ import { describe, expect, it } from "vitest";
2
+
3
+ import { deliverButtonPoint } from "./transporter";
4
+
5
+ describe("deliverButtonPoint", () => {
6
+ it("lands on the DELIVER button of the top Active row at the default window width", () => {
7
+ // Measured 2026-09-07: window at (888,214) 840x626 → button clicked at (1571,388).
8
+ expect(deliverButtonPoint({ x: 888, y: 214, width: 840, height: 626 })).toEqual({
9
+ x: 1571,
10
+ y: 388,
11
+ });
12
+ });
13
+
14
+ it("scales the horizontal offset with the window width", () => {
15
+ const wide = deliverButtonPoint({ x: 0, y: 0, width: 1680, height: 626 });
16
+ expect(wide).toEqual({ x: 1366, y: 174 });
17
+ });
18
+ });
@@ -0,0 +1,115 @@
1
+ import { execFileSync } from "child_process";
2
+ import fs from "fs";
3
+ import os from "os";
4
+ import path from "path";
5
+
6
+ export const TRANSPORTER_APP = "/Applications/Transporter.app";
7
+
8
+ /**
9
+ * Window geometry of Transporter's main window, in screen points.
10
+ */
11
+ export interface IWindowFrame {
12
+ x: number;
13
+ y: number;
14
+ width: number;
15
+ height: number;
16
+ }
17
+
18
+ /**
19
+ * Where the newest Active item's DELIVER button sits, relative to the window: the top row of
20
+ * the Active list, ~174 pt below the window's origin, with the button ~683 pt to the right at
21
+ * the default 840 pt window width (it scales horizontally with the window).
22
+ * Transporter's list is not exposed to accessibility, so the button is clicked by position.
23
+ */
24
+ export function deliverButtonPoint(frame: IWindowFrame): {
25
+ x: number;
26
+ y: number;
27
+ } {
28
+ return {
29
+ x: Math.round(frame.x + (683 * frame.width) / 840),
30
+ y: Math.round(frame.y + 174),
31
+ };
32
+ }
33
+
34
+ /**
35
+ * Whether this machine can deliver through the Transporter app: macOS with the app installed.
36
+ */
37
+ export function isTransporterAvailable(): boolean {
38
+ return process.platform === "darwin" && fs.existsSync(TRANSPORTER_APP);
39
+ }
40
+
41
+ function osascript(script: string): string {
42
+ return execFileSync("osascript", ["-e", script], { encoding: "utf8" }).trim();
43
+ }
44
+
45
+ function sleep(ms: number): Promise<void> {
46
+ return new Promise((resolve) => setTimeout(resolve, ms));
47
+ }
48
+
49
+ function isTransporterRunning(): boolean {
50
+ try {
51
+ execFileSync("pgrep", ["-x", "Transporter"], { stdio: "ignore" });
52
+ return true;
53
+ } catch {
54
+ return false;
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Deliver an .ipa to App Store Connect through the Transporter app — the same as dropping the
60
+ * file on its window and pressing DELIVER, so it uses the Apple ID session Transporter is
61
+ * already signed in with: no App Store Connect API key, no app-specific password, and no EAS
62
+ * Submit queue. Requirements: macOS, Transporter installed and signed in, the Mac unlocked,
63
+ * and accessibility access for the terminal running this (the click is synthesised).
64
+ *
65
+ * Transporter uploads asynchronously; this returns once the upload has been started, and the
66
+ * artifact must stay on disk until Transporter has finished with it.
67
+ */
68
+ export async function deliverWithTransporter(ipaPath: string): Promise<void> {
69
+ if (!isTransporterAvailable()) {
70
+ throw new Error(`Transporter is not installed at ${TRANSPORTER_APP} (macOS only).`);
71
+ }
72
+ const ipa = path.resolve(ipaPath);
73
+ if (!fs.existsSync(ipa)) throw new Error(`No such file: ${ipa}`);
74
+
75
+ if (!isTransporterRunning()) {
76
+ execFileSync("open", ["-a", "Transporter"]);
77
+ await sleep(5000);
78
+ }
79
+
80
+ // A file-open event: identical to dropping the .ipa on the window.
81
+ execFileSync("open", ["-a", "Transporter", ipa]);
82
+ await sleep(8000); // Transporter reads the package and lists it under "Active"
83
+ osascript('tell application "Transporter" to activate');
84
+ await sleep(1000);
85
+
86
+ const raw = osascript(
87
+ 'tell application "System Events" to tell process "Transporter" to get {position, size} of window 1',
88
+ );
89
+ const numbers = raw
90
+ .replace(/[{}]/g, "")
91
+ .split(",")
92
+ .map((n) => Number(n.trim()));
93
+ const [x, y, width, height] = numbers;
94
+ if (
95
+ numbers.length !== 4 ||
96
+ x === undefined ||
97
+ y === undefined ||
98
+ width === undefined ||
99
+ height === undefined ||
100
+ numbers.some(Number.isNaN)
101
+ ) {
102
+ throw new Error(`Could not read Transporter's window geometry (got "${raw}").`);
103
+ }
104
+ const point = deliverButtonPoint({ x, y, width, height });
105
+ osascript(
106
+ `tell application "System Events" to tell process "Transporter" to click at {${point.x}, ${point.y}}`,
107
+ );
108
+ }
109
+
110
+ export function transporterLogsDir(): string {
111
+ return path.join(
112
+ os.homedir(),
113
+ "Library/Group Containers/group.com.apple.contentdelivery/Library/Logs/Transporter",
114
+ );
115
+ }
@@ -118,9 +118,7 @@ export function createDryRunSummary(options: {
118
118
  const { channel, platform, bundlePath, assetPaths, commitHash, runtimeVersion } = options;
119
119
 
120
120
  const bundleSize = fs.statSync(bundlePath).size;
121
- const totalAssetSize = assetPaths.reduce((sum, path) => {
122
- return sum + fs.statSync(path).size;
123
- }, 0);
121
+ const totalAssetSize = getUpdateSize(bundlePath, assetPaths) - bundleSize;
124
122
 
125
123
  const lines = [
126
124
  `Platform: ${platform}`,
@@ -140,10 +138,19 @@ export function createDryRunSummary(options: {
140
138
  return lines.join("\n");
141
139
  }
142
140
 
141
+ /**
142
+ * Total size on disk of a bundle plus its assets
143
+ */
144
+ export function getUpdateSize(bundlePath: string, assetPaths: string[]): number {
145
+ return assetPaths.reduce((sum, path) => {
146
+ return sum + fs.statSync(path).size;
147
+ }, fs.statSync(bundlePath).size);
148
+ }
149
+
143
150
  /**
144
151
  * Format bytes to human readable string
145
152
  */
146
- function formatBytes(bytes: number): string {
153
+ export function formatBytes(bytes: number): string {
147
154
  const sizes = ["Bytes", "KB", "MB", "GB"];
148
155
  if (bytes === 0) return "0 Bytes";
149
156
  const i = Math.floor(Math.log(bytes) / Math.log(1024));