easc 0.0.30 → 0.0.31

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easc",
3
- "version": "0.0.30",
3
+ "version": "0.0.31",
4
4
  "description": "Expo App Services for Cloudflare - Deploy tool for Expo OTA updates to Cloudflare Workers",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -38,7 +38,6 @@
38
38
  "@expo/fingerprint": "^0.11.0",
39
39
  "@inquirer/prompts": "^8.3.2",
40
40
  "chalk": "5.6.2",
41
- "ora": "^9.3.0",
42
41
  "tsx": "^4.21.0",
43
42
  "yargs": "^18.0.0",
44
43
  "zod": "^4.3.6"
@@ -1,4 +1,3 @@
1
- import fs from "fs";
2
1
  import type { CommandModule } from "yargs";
3
2
  import { validateConfig, getConfig } from "../utils/schema";
4
3
  import { resolveRuntimeVersion, getPlatforms } from "../utils/runtime";
@@ -13,7 +12,6 @@ import {
13
12
  import { uploadBundle, createDryRunSummary } from "../utils/upload";
14
13
  import { createFingerprintAsync } from "@expo/fingerprint";
15
14
  import { Logger } from "../utils/logger";
16
- import { PlatformType } from "../enums/platform";
17
15
  import { runx } from "../utils/runx";
18
16
 
19
17
  interface IArgs {
@@ -118,76 +116,60 @@ export const update: CommandModule = {
118
116
  ["Channel", channel],
119
117
  ]);
120
118
 
121
- const results: {
122
- platform: PlatformType;
123
- status: "dry_run" | "uploaded" | "failed";
124
- bundle_size: number;
125
- asset_count: number;
126
- error?: string;
127
- }[] = [];
119
+ const platformUploads = platforms.map((platform) => ({
120
+ platform,
121
+ bundlePath: findBundleFile(exportDir, metadata, platform),
122
+ assetPaths: getAssetFiles(exportDir, metadata, platform),
123
+ }));
128
124
 
129
- for (const platform of platforms) {
130
- logger.section(platform.toUpperCase());
131
-
132
- try {
133
- const bundlePath = findBundleFile(exportDir, metadata, platform);
134
- const assetPaths = getAssetFiles(exportDir, metadata, platform);
135
-
136
- if (args.dryRun) {
137
- const summary = createDryRunSummary({
125
+ if (args.dryRun) {
126
+ for (const { platform, bundlePath, assetPaths } of platformUploads) {
127
+ logger.section(platform.toUpperCase());
128
+ logger.box(
129
+ createDryRunSummary({
138
130
  platform,
139
131
  bundlePath,
140
132
  assetPaths,
141
133
  channel,
142
134
  runtimeVersion,
143
135
  commitHash,
144
- });
145
-
146
- logger.box(summary);
147
- logger.success(`${platform} (dry run)`);
148
-
149
- results.push({
150
- platform,
151
- status: "dry_run",
152
- bundle_size: fs.statSync(bundlePath).size,
153
- asset_count: assetPaths.length,
154
- });
155
- } else {
156
- logger.startSpinner(`Uploading ${platform}...`);
157
-
158
- await uploadBundle({
159
- platform,
160
- channel,
161
- runtimeVersion,
162
- commitHash,
163
- bundlePath,
164
- assetPaths,
165
- expoConfig: appJson.expo,
166
- metadata,
167
- config,
168
- fingerprint,
169
- ignoreFingerprintCheck: args.dangerouslyIgnoreFingerprintCheck,
170
- });
136
+ }),
137
+ );
138
+ logger.success(`${platform} (dry run)`);
139
+ }
140
+ } else {
141
+ logger.startSpinner(platformUploads.map(({ platform }) => `Uploading ${platform}...`));
142
+
143
+ const results = await Promise.allSettled(
144
+ platformUploads.map(async ({ platform, bundlePath, assetPaths }) => {
145
+ const label = `Uploading ${platform}...`;
146
+ try {
147
+ await uploadBundle({
148
+ platform,
149
+ channel,
150
+ runtimeVersion,
151
+ commitHash,
152
+ bundlePath,
153
+ assetPaths,
154
+ expoConfig: appJson.expo,
155
+ metadata,
156
+ config,
157
+ fingerprint,
158
+ ignoreFingerprintCheck: args.dangerouslyIgnoreFingerprintCheck,
159
+ });
160
+ logger.updateSpinner(label, "done");
161
+ } catch (error) {
162
+ logger.updateSpinner(label, "failed");
163
+ throw error;
164
+ }
165
+ }),
166
+ );
171
167
 
172
- logger.succeedSpinner(`${platform} uploaded`);
168
+ logger.stopSpinner();
173
169
 
174
- results.push({
175
- platform,
176
- status: "uploaded",
177
- bundle_size: fs.statSync(bundlePath).size,
178
- asset_count: assetPaths.length,
179
- });
180
- }
181
- } catch (error) {
182
- logger.failSpinner(`${platform} failed`);
183
- results.push({
184
- platform,
185
- status: "failed",
186
- bundle_size: 0,
187
- asset_count: 0,
188
- error: error instanceof Error ? error.message : String(error),
189
- });
190
- throw error;
170
+ const failed = results.filter((r) => r.status === "rejected");
171
+ if (failed.length > 0) {
172
+ throw (failed[0] as PromiseRejectedResult).reason;
191
173
  }
192
174
  }
193
175
 
@@ -1,8 +1,16 @@
1
1
  import chalk from "chalk";
2
- import ora, { Ora } from "ora";
2
+
3
+ const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
4
+
5
+ interface SpinnerEntry {
6
+ label: string;
7
+ status: "pending" | "done" | "failed";
8
+ }
3
9
 
4
10
  export class Logger {
5
- private spinner: Ora | null = null;
11
+ private lines: SpinnerEntry[] | null = null;
12
+ private timer: ReturnType<typeof setInterval> | null = null;
13
+ private frame = 0;
6
14
 
7
15
  constructor() {}
8
16
 
@@ -35,48 +43,63 @@ export class Logger {
35
43
  }
36
44
 
37
45
  /**
38
- * Start a spinner with a message
46
+ * Start one or more spinner lines
39
47
  */
40
- startSpinner(message: string): void {
41
- this.spinner = ora(message).start();
42
- }
48
+ startSpinner(labels: string | string[]): void {
49
+ const items = Array.isArray(labels) ? labels : [labels];
50
+ this.lines = items.map((label) => ({ label, status: "pending" as const }));
51
+ this.frame = 0;
43
52
 
44
- /**
45
- * Update spinner text
46
- */
47
- updateSpinner(message: string): void {
48
- if (this.spinner) {
49
- this.spinner.text = message;
53
+ for (const entry of this.lines) {
54
+ process.stderr.write(` ${SPINNER_FRAMES[0]} ${entry.label}\n`);
50
55
  }
56
+
57
+ this.timer = setInterval(() => {
58
+ this.frame = (this.frame + 1) % SPINNER_FRAMES.length;
59
+ this.render();
60
+ }, 80);
51
61
  }
52
62
 
53
63
  /**
54
- * Stop spinner with success
64
+ * Mark a spinner line as done or failed
55
65
  */
56
- succeedSpinner(message?: string): void {
57
- if (this.spinner) {
58
- this.spinner.succeed(message);
59
- this.spinner = null;
66
+ updateSpinner(label: string, status: "done" | "failed"): void {
67
+ if (!this.lines) return;
68
+ const entry = this.lines.find((e) => e.label === label);
69
+ if (entry) {
70
+ entry.status = status;
71
+ this.render();
60
72
  }
61
73
  }
62
74
 
63
75
  /**
64
- * Stop spinner with failure
76
+ * Stop all spinner lines
65
77
  */
66
- failSpinner(message?: string): void {
67
- if (this.spinner) {
68
- this.spinner.fail(message);
69
- this.spinner = null;
78
+ stopSpinner(): void {
79
+ if (this.timer) {
80
+ clearInterval(this.timer);
81
+ this.timer = null;
82
+ }
83
+ if (this.lines) {
84
+ this.render();
85
+ this.lines = null;
70
86
  }
71
87
  }
72
88
 
73
- /**
74
- * Stop spinner without status
75
- */
76
- stopSpinner(): void {
77
- if (this.spinner) {
78
- this.spinner.stop();
79
- this.spinner = null;
89
+ private render(): void {
90
+ if (!this.lines) return;
91
+
92
+ process.stderr.write(`\x1B[${this.lines.length}A`);
93
+
94
+ for (const entry of this.lines) {
95
+ process.stderr.write("\x1B[2K\r");
96
+ if (entry.status === "done") {
97
+ process.stderr.write(` ${chalk.green("✓")} ${entry.label}\n`);
98
+ } else if (entry.status === "failed") {
99
+ process.stderr.write(` ${chalk.red("✗")} ${entry.label}\n`);
100
+ } else {
101
+ process.stderr.write(` ${chalk.cyan(SPINNER_FRAMES[this.frame])} ${entry.label}\n`);
102
+ }
80
103
  }
81
104
  }
82
105