easc 0.0.36 → 0.0.38
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 +12 -11
- package/src/commands/build.ts +1 -0
- package/src/commands/submit.ts +1 -0
- package/src/commands/update.ts +13 -2
- package/src/utils/sentry.test.ts +39 -0
- package/src/utils/sentry.ts +35 -0
- package/src/utils/transporter.test.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.38",
|
|
4
4
|
"description": "Expo App Services for Cloudflare - Deploy tool for Expo OTA updates to Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -36,20 +36,21 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@expo/fingerprint": "^0.21.1",
|
|
39
|
-
"@inquirer/prompts": "^8.
|
|
40
|
-
"chalk": "
|
|
41
|
-
"tsx": "^4.
|
|
42
|
-
"valibot": "^1.
|
|
43
|
-
"yargs": "^18.
|
|
39
|
+
"@inquirer/prompts": "^8.7.2",
|
|
40
|
+
"chalk": "6.0.1",
|
|
41
|
+
"tsx": "^4.23.15",
|
|
42
|
+
"valibot": "^1.5.0",
|
|
43
|
+
"yargs": "^18.2.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@types/node": "^26.
|
|
46
|
+
"@types/node": "^26.6.3",
|
|
47
47
|
"@types/yargs": "^17.0.35",
|
|
48
|
-
"@vitest/ui": "
|
|
49
|
-
"vite
|
|
50
|
-
"
|
|
48
|
+
"@vitest/ui": "catalog:",
|
|
49
|
+
"vite": "catalog:",
|
|
50
|
+
"vite-plus": "catalog:",
|
|
51
|
+
"vitest": "catalog:"
|
|
51
52
|
},
|
|
52
53
|
"engines": {
|
|
53
|
-
"node": ">=
|
|
54
|
+
"node": ">=22"
|
|
54
55
|
}
|
|
55
56
|
}
|
package/src/commands/build.ts
CHANGED
|
@@ -127,6 +127,7 @@ export const build: CommandModule = {
|
|
|
127
127
|
runx(`eas build ${buildFlags}`, {
|
|
128
128
|
cwd: process.cwd(),
|
|
129
129
|
stdio: "inherit",
|
|
130
|
+
env: { ...process.env, EAS_UPDATE_UPLOAD_EMBEDDED_BUNDLE: "0" },
|
|
130
131
|
});
|
|
131
132
|
|
|
132
133
|
logger.success(`${platformName} build completed`);
|
package/src/commands/submit.ts
CHANGED
|
@@ -126,6 +126,7 @@ export const submit: CommandModule = {
|
|
|
126
126
|
runx(`eas build ${buildFlags}`, {
|
|
127
127
|
cwd: process.cwd(),
|
|
128
128
|
stdio: "inherit",
|
|
129
|
+
env: { ...process.env, EAS_UPDATE_UPLOAD_EMBEDDED_BUNDLE: "0" },
|
|
129
130
|
});
|
|
130
131
|
|
|
131
132
|
logger.success(`${platformName} build completed`);
|
package/src/commands/update.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { uploadBundle, createDryRunSummary, getUpdateSize, formatBytes } from ".
|
|
|
13
13
|
import { createFingerprintAsync } from "@expo/fingerprint";
|
|
14
14
|
import { Logger } from "../utils/logger";
|
|
15
15
|
import { runx } from "../utils/runx";
|
|
16
|
+
import { hasSentryAuthToken, uploadSourceMapsToSentry, assertNoSourceMaps } from "../utils/sentry";
|
|
16
17
|
|
|
17
18
|
interface IArgs {
|
|
18
19
|
channel: string;
|
|
@@ -84,8 +85,8 @@ export const update: CommandModule = {
|
|
|
84
85
|
|
|
85
86
|
runx(
|
|
86
87
|
args.exportDir !== "dist"
|
|
87
|
-
? `expo export --
|
|
88
|
-
: `expo export --
|
|
88
|
+
? `expo export --source-maps external --output-dir ${args.exportDir}`
|
|
89
|
+
: `expo export --source-maps external`,
|
|
89
90
|
{ cwd: process.cwd(), stdio: "inherit" },
|
|
90
91
|
);
|
|
91
92
|
|
|
@@ -112,6 +113,10 @@ export const update: CommandModule = {
|
|
|
112
113
|
assetPaths: getAssetFiles(exportDir, metadata, platform),
|
|
113
114
|
}));
|
|
114
115
|
|
|
116
|
+
assertNoSourceMaps(
|
|
117
|
+
platformUploads.flatMap(({ bundlePath, assetPaths }) => [bundlePath, ...assetPaths]),
|
|
118
|
+
);
|
|
119
|
+
|
|
115
120
|
logger.section("📤 Deployment Info");
|
|
116
121
|
logger.table([
|
|
117
122
|
["Server", config.otaServer],
|
|
@@ -142,6 +147,12 @@ export const update: CommandModule = {
|
|
|
142
147
|
logger.success(`${platform} (dry run)`);
|
|
143
148
|
}
|
|
144
149
|
} else {
|
|
150
|
+
if (hasSentryAuthToken()) {
|
|
151
|
+
logger.info("Uploading source maps to Sentry...");
|
|
152
|
+
uploadSourceMapsToSentry(exportDir);
|
|
153
|
+
logger.success("Source maps uploaded to Sentry");
|
|
154
|
+
}
|
|
155
|
+
|
|
145
156
|
logger.startSpinner(platformUploads.map(({ platform }) => `Uploading ${platform}...`));
|
|
146
157
|
|
|
147
158
|
const results = await Promise.allSettled(
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { describe, it, expect, vi, afterEach } from "vite-plus/test";
|
|
2
|
+
import { hasSentryAuthToken, assertNoSourceMaps } from "./sentry";
|
|
3
|
+
|
|
4
|
+
describe("Sentry utilities", () => {
|
|
5
|
+
describe("hasSentryAuthToken", () => {
|
|
6
|
+
afterEach(() => {
|
|
7
|
+
vi.unstubAllEnvs();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it("is true when SENTRY_AUTH_TOKEN is set", () => {
|
|
11
|
+
vi.stubEnv("SENTRY_AUTH_TOKEN", "sntrys_test");
|
|
12
|
+
|
|
13
|
+
expect(hasSentryAuthToken()).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("is false when SENTRY_AUTH_TOKEN is empty", () => {
|
|
17
|
+
vi.stubEnv("SENTRY_AUTH_TOKEN", "");
|
|
18
|
+
|
|
19
|
+
expect(hasSentryAuthToken()).toBe(false);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe("assertNoSourceMaps", () => {
|
|
24
|
+
it("passes when no file is a source map", () => {
|
|
25
|
+
expect(() =>
|
|
26
|
+
assertNoSourceMaps(["dist/_expo/static/js/ios/entry-abc.hbc", "dist/assets/0f1e2d"]),
|
|
27
|
+
).not.toThrow();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("throws when a source map would be published", () => {
|
|
31
|
+
expect(() =>
|
|
32
|
+
assertNoSourceMaps([
|
|
33
|
+
"dist/_expo/static/js/ios/entry-abc.hbc",
|
|
34
|
+
"dist/_expo/static/js/ios/entry-abc.hbc.map",
|
|
35
|
+
]),
|
|
36
|
+
).toThrow(/entry-abc\.hbc\.map/);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { runx } from "./runx";
|
|
2
|
+
|
|
3
|
+
const SOURCE_MAP_EXTENSION = ".map";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Whether a SENTRY_AUTH_TOKEN is set (usually from the app's .env).
|
|
7
|
+
*/
|
|
8
|
+
export function hasSentryAuthToken(): boolean {
|
|
9
|
+
return Boolean(process.env["SENTRY_AUTH_TOKEN"]);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Upload the export's bundles and source maps to Sentry. They are matched to
|
|
14
|
+
* events by the debug ID Sentry's Metro config injects, so every OTA update of
|
|
15
|
+
* the same app version symbolicates on its own. Org and project come from the
|
|
16
|
+
* `@sentry/react-native/expo` plugin entry in the app config.
|
|
17
|
+
*/
|
|
18
|
+
export function uploadSourceMapsToSentry(exportDir: string): void {
|
|
19
|
+
runx(`sentry-expo-upload-sourcemaps ${exportDir}`, {
|
|
20
|
+
cwd: process.cwd(),
|
|
21
|
+
stdio: "inherit",
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Throw if any file about to be published to the update server is a source map.
|
|
27
|
+
*/
|
|
28
|
+
export function assertNoSourceMaps(filePaths: string[]): void {
|
|
29
|
+
const sourceMaps = filePaths.filter((file) => file.endsWith(SOURCE_MAP_EXTENSION));
|
|
30
|
+
if (sourceMaps.length > 0) {
|
|
31
|
+
throw new Error(
|
|
32
|
+
`Refusing to publish source maps to the update server:\n ${sourceMaps.join("\n ")}`,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|