@stim-cli/expo-build-cache 1.20.2 → 1.21.0
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/dist/index.d.mts +2 -1
- package/dist/index.mjs +16 -5
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -6,11 +6,12 @@ declare function resolveBuildCache({ platform, fingerprintHash, runOptions }: {
|
|
|
6
6
|
fingerprintHash: string;
|
|
7
7
|
runOptions?: BuildRunOptions;
|
|
8
8
|
}): Promise<string | null>;
|
|
9
|
-
declare function uploadBuildCache({ platform, fingerprintHash, buildPath, runOptions }: {
|
|
9
|
+
declare function uploadBuildCache({ platform, fingerprintHash, buildPath, runOptions, signal }: {
|
|
10
10
|
platform: string;
|
|
11
11
|
fingerprintHash: string;
|
|
12
12
|
buildPath?: string;
|
|
13
13
|
runOptions?: BuildRunOptions;
|
|
14
|
+
signal?: AbortSignal;
|
|
14
15
|
}): Promise<string | null>;
|
|
15
16
|
//#endregion
|
|
16
17
|
export { buildCacheKey, cacheRoot, resolveBuildCache, uploadBuildCache };
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { artifactIn, buildCacheKey, buildCacheRoot, hostSimulatorArch, registerCache, resolveArtifact,
|
|
5
|
-
import { execFileSync } from "node:child_process";
|
|
4
|
+
import { artifactIn, buildCacheKey, buildCacheRoot, hostSimulatorArch, registerCache, resolveArtifact, storeArtifactAsync } from "@stim-cli/core";
|
|
5
|
+
import { execFile, execFileSync } from "node:child_process";
|
|
6
6
|
//#region index.ts
|
|
7
7
|
let registeredDir = null;
|
|
8
8
|
function cacheRoot() {
|
|
@@ -112,7 +112,8 @@ async function resolveBuildCache({ platform, fingerprintHash, runOptions }) {
|
|
|
112
112
|
console.log(`[build-cache] miss ${platform} ${shortKey(key, fingerprintHash)}`);
|
|
113
113
|
return null;
|
|
114
114
|
}
|
|
115
|
-
async function uploadBuildCache({ platform, fingerprintHash, buildPath, runOptions }) {
|
|
115
|
+
async function uploadBuildCache({ platform, fingerprintHash, buildPath, runOptions, signal }) {
|
|
116
|
+
signal?.throwIfAborted();
|
|
116
117
|
registerOnce();
|
|
117
118
|
if (!buildPath || !fs.existsSync(buildPath)) return null;
|
|
118
119
|
const options = keyOptions(platform, runOptions);
|
|
@@ -125,14 +126,24 @@ async function uploadBuildCache({ platform, fingerprintHash, buildPath, runOptio
|
|
|
125
126
|
if (artifactIn(dest)) return artifactIn(dest);
|
|
126
127
|
let stored;
|
|
127
128
|
try {
|
|
128
|
-
stored =
|
|
129
|
-
|
|
129
|
+
stored = await storeArtifactAsync(dest, buildPath, {
|
|
130
|
+
...signal ? { signal } : {},
|
|
131
|
+
runFile: (file, args) => new Promise((resolve, reject) => {
|
|
132
|
+
let failure = null;
|
|
133
|
+
execFile(file, args, { signal }, (error) => {
|
|
134
|
+
failure = error;
|
|
135
|
+
}).once("close", () => {
|
|
136
|
+
if (failure) reject(failure);
|
|
137
|
+
else resolve();
|
|
138
|
+
});
|
|
139
|
+
}),
|
|
130
140
|
onRenameError: (staging) => fs.rmSync(staging, {
|
|
131
141
|
recursive: true,
|
|
132
142
|
force: true
|
|
133
143
|
})
|
|
134
144
|
});
|
|
135
145
|
} catch (error) {
|
|
146
|
+
signal?.throwIfAborted();
|
|
136
147
|
console.warn(`[build-cache] could not store ${platform} ${shortKey(key, fingerprintHash)}: ${error.message}`);
|
|
137
148
|
return null;
|
|
138
149
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stim-cli/expo-build-cache",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0",
|
|
4
4
|
"description": "Local Expo build cache provider: installs a cached .app/.apk instead of compiling when no native input changed.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@stim-cli/core": "^1.
|
|
27
|
+
"@stim-cli/core": "^1.21.0"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
30
30
|
"node": ">=22.12.0"
|