easc 0.0.21 → 0.0.23
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 +10 -9
- package/src/commands/build-run.ts +8 -2
- package/src/commands/build.ts +8 -2
- package/src/utils/eas.ts +9 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"description": "Expo App Services for Cloudflare - Deploy tool for Expo OTA updates to Cloudflare Workers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
"index.ts",
|
|
13
13
|
"src"
|
|
14
14
|
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "vitest",
|
|
17
|
+
"test:watch": "vitest --watch",
|
|
18
|
+
"test:ui": "vitest --ui",
|
|
19
|
+
"test:coverage": "vitest --coverage",
|
|
20
|
+
"typecheck": "tsgo --noEmit",
|
|
21
|
+
"prepublishOnly": "pnpm run test"
|
|
22
|
+
},
|
|
15
23
|
"dependencies": {
|
|
16
24
|
"@inquirer/prompts": "^7.8.6",
|
|
17
25
|
"chalk": "5.6.0",
|
|
@@ -45,12 +53,5 @@
|
|
|
45
53
|
],
|
|
46
54
|
"publishConfig": {
|
|
47
55
|
"access": "public"
|
|
48
|
-
},
|
|
49
|
-
"scripts": {
|
|
50
|
-
"test": "vitest",
|
|
51
|
-
"test:watch": "vitest --watch",
|
|
52
|
-
"test:ui": "vitest --ui",
|
|
53
|
-
"test:coverage": "vitest --coverage",
|
|
54
|
-
"typecheck": "tsgo --noEmit"
|
|
55
56
|
}
|
|
56
|
-
}
|
|
57
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import chalk from "chalk";
|
|
4
3
|
import type { CommandModule } from "yargs";
|
|
5
4
|
import { Logger } from "../utils/logger";
|
|
6
5
|
import { Platform, PlatformType } from "../enums/platform";
|
|
@@ -86,6 +85,13 @@ export const buildRun: CommandModule = {
|
|
|
86
85
|
const args = argv as unknown as IArgs;
|
|
87
86
|
const logger = new Logger();
|
|
88
87
|
|
|
88
|
+
if (!args.profile) {
|
|
89
|
+
logger.error(
|
|
90
|
+
"eas.json not found or has no build profiles. Run 'eas build:configure' to create one.",
|
|
91
|
+
);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
|
|
89
95
|
try {
|
|
90
96
|
const platform = args.platform;
|
|
91
97
|
const platformName = platform === Platform.iOS ? "iOS" : "Android";
|
|
@@ -163,7 +169,7 @@ export const buildRun: CommandModule = {
|
|
|
163
169
|
logger.success("Done! App is running on simulator/emulator.");
|
|
164
170
|
} catch (error) {
|
|
165
171
|
const message = error instanceof Error ? error.message : String(error);
|
|
166
|
-
|
|
172
|
+
logger.error(`Build:run failed: ${message}`);
|
|
167
173
|
process.exit(1);
|
|
168
174
|
}
|
|
169
175
|
},
|
package/src/commands/build.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import chalk from "chalk";
|
|
4
3
|
import type { CommandModule } from "yargs";
|
|
5
4
|
import { Logger } from "../utils/logger";
|
|
6
5
|
import { Platform, PlatformType } from "../enums/platform";
|
|
@@ -76,6 +75,13 @@ export const build: CommandModule = {
|
|
|
76
75
|
const args = argv as unknown as IArgs;
|
|
77
76
|
const logger = new Logger();
|
|
78
77
|
|
|
78
|
+
if (!args.profile) {
|
|
79
|
+
logger.error(
|
|
80
|
+
"eas.json not found or has no build profiles. Run 'eas build:configure' to create one.",
|
|
81
|
+
);
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
|
|
79
85
|
try {
|
|
80
86
|
const platforms: PlatformType[] =
|
|
81
87
|
args.platform === "all"
|
|
@@ -151,7 +157,7 @@ export const build: CommandModule = {
|
|
|
151
157
|
logger.success("Build completed!");
|
|
152
158
|
} catch (error) {
|
|
153
159
|
const message = error instanceof Error ? error.message : String(error);
|
|
154
|
-
|
|
160
|
+
logger.error(`Build failed: ${message}`);
|
|
155
161
|
process.exit(1);
|
|
156
162
|
}
|
|
157
163
|
},
|
package/src/utils/eas.ts
CHANGED
|
@@ -5,28 +5,27 @@ interface EasConfig {
|
|
|
5
5
|
build?: Record<string, unknown>;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Get EAS build profiles from eas.json
|
|
10
|
+
* Returns an empty array if eas.json is not found, invalid, or has no build profiles.
|
|
11
|
+
*/
|
|
8
12
|
export function getEasProfiles(): string[] {
|
|
9
13
|
const easJsonPath = path.join(process.cwd(), "eas.json");
|
|
10
14
|
|
|
11
15
|
if (!fs.existsSync(easJsonPath)) {
|
|
12
|
-
|
|
16
|
+
return [];
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
let easConfig: EasConfig;
|
|
16
20
|
try {
|
|
17
21
|
easConfig = JSON.parse(fs.readFileSync(easJsonPath, "utf-8"));
|
|
18
|
-
} catch
|
|
19
|
-
|
|
22
|
+
} catch {
|
|
23
|
+
return [];
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
if (!easConfig.build || typeof easConfig.build !== "object") {
|
|
23
|
-
|
|
27
|
+
return [];
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
if (profiles.length === 0) {
|
|
28
|
-
throw new Error("No build profiles found in eas.json");
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return profiles;
|
|
30
|
+
return Object.keys(easConfig.build);
|
|
32
31
|
}
|