easc 0.0.30 → 0.0.32

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.32",
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
 
@@ -196,7 +178,7 @@ export const update: CommandModule = {
196
178
  logger.success("Dry run completed successfully!");
197
179
  logger.info("Run without --dry-run to perform actual upload");
198
180
  } else {
199
- logger.success("✨ Updates published successfully!");
181
+ logger.log("\n✨ Updates published successfully!");
200
182
  }
201
183
  },
202
184
  };
@@ -1,11 +1,26 @@
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
 
17
+ /**
18
+ * Log a plain message
19
+ */
20
+ log(message: string): void {
21
+ console.log(message);
22
+ }
23
+
9
24
  /**
10
25
  * Log an informational message
11
26
  */
@@ -35,48 +50,63 @@ export class Logger {
35
50
  }
36
51
 
37
52
  /**
38
- * Start a spinner with a message
53
+ * Start one or more spinner lines
39
54
  */
40
- startSpinner(message: string): void {
41
- this.spinner = ora(message).start();
42
- }
55
+ startSpinner(labels: string | string[]): void {
56
+ const items = Array.isArray(labels) ? labels : [labels];
57
+ this.lines = items.map((label) => ({ label, status: "pending" as const }));
58
+ this.frame = 0;
43
59
 
44
- /**
45
- * Update spinner text
46
- */
47
- updateSpinner(message: string): void {
48
- if (this.spinner) {
49
- this.spinner.text = message;
60
+ for (const entry of this.lines) {
61
+ process.stderr.write(` ${SPINNER_FRAMES[0]} ${entry.label}\n`);
50
62
  }
63
+
64
+ this.timer = setInterval(() => {
65
+ this.frame = (this.frame + 1) % SPINNER_FRAMES.length;
66
+ this.render();
67
+ }, 80);
51
68
  }
52
69
 
53
70
  /**
54
- * Stop spinner with success
71
+ * Mark a spinner line as done or failed
55
72
  */
56
- succeedSpinner(message?: string): void {
57
- if (this.spinner) {
58
- this.spinner.succeed(message);
59
- this.spinner = null;
73
+ updateSpinner(label: string, status: "done" | "failed"): void {
74
+ if (!this.lines) return;
75
+ const entry = this.lines.find((e) => e.label === label);
76
+ if (entry) {
77
+ entry.status = status;
78
+ this.render();
60
79
  }
61
80
  }
62
81
 
63
82
  /**
64
- * Stop spinner with failure
83
+ * Stop all spinner lines
65
84
  */
66
- failSpinner(message?: string): void {
67
- if (this.spinner) {
68
- this.spinner.fail(message);
69
- this.spinner = null;
85
+ stopSpinner(): void {
86
+ if (this.timer) {
87
+ clearInterval(this.timer);
88
+ this.timer = null;
89
+ }
90
+ if (this.lines) {
91
+ this.render();
92
+ this.lines = null;
70
93
  }
71
94
  }
72
95
 
73
- /**
74
- * Stop spinner without status
75
- */
76
- stopSpinner(): void {
77
- if (this.spinner) {
78
- this.spinner.stop();
79
- this.spinner = null;
96
+ private render(): void {
97
+ if (!this.lines) return;
98
+
99
+ process.stderr.write(`\x1B[${this.lines.length}A`);
100
+
101
+ for (const entry of this.lines) {
102
+ process.stderr.write("\x1B[2K\r");
103
+ if (entry.status === "done") {
104
+ process.stderr.write(` ${chalk.green("✓")} ${entry.label}\n`);
105
+ } else if (entry.status === "failed") {
106
+ process.stderr.write(` ${chalk.red("✗")} ${entry.label}\n`);
107
+ } else {
108
+ process.stderr.write(` ${chalk.cyan(SPINNER_FRAMES[this.frame])} ${entry.label}\n`);
109
+ }
80
110
  }
81
111
  }
82
112