@limrun/api 0.22.2 → 0.23.1
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/CHANGELOG.md +8 -0
- package/exec-client.d.mts +5 -1
- package/exec-client.d.mts.map +1 -1
- package/exec-client.d.ts +5 -1
- package/exec-client.d.ts.map +1 -1
- package/exec-client.js +14 -7
- package/exec-client.js.map +1 -1
- package/exec-client.mjs +14 -7
- package/exec-client.mjs.map +1 -1
- package/folder-sync-ignore.d.mts +7 -0
- package/folder-sync-ignore.d.mts.map +1 -0
- package/folder-sync-ignore.d.ts +7 -0
- package/folder-sync-ignore.d.ts.map +1 -0
- package/folder-sync-ignore.js +56 -0
- package/folder-sync-ignore.js.map +1 -0
- package/folder-sync-ignore.mjs +52 -0
- package/folder-sync-ignore.mjs.map +1 -0
- package/folder-sync-watcher.d.mts +2 -0
- package/folder-sync-watcher.d.mts.map +1 -1
- package/folder-sync-watcher.d.ts +2 -0
- package/folder-sync-watcher.d.ts.map +1 -1
- package/folder-sync-watcher.js +10 -62
- package/folder-sync-watcher.js.map +1 -1
- package/folder-sync-watcher.mjs +10 -62
- package/folder-sync-watcher.mjs.map +1 -1
- package/folder-sync.d.mts +16 -16
- package/folder-sync.d.mts.map +1 -1
- package/folder-sync.d.ts +16 -16
- package/folder-sync.d.ts.map +1 -1
- package/folder-sync.js +22 -65
- package/folder-sync.js.map +1 -1
- package/folder-sync.mjs +21 -64
- package/folder-sync.mjs.map +1 -1
- package/ios-client.d.mts +24 -0
- package/ios-client.d.mts.map +1 -1
- package/ios-client.d.ts +24 -0
- package/ios-client.d.ts.map +1 -1
- package/ios-client.js +108 -8
- package/ios-client.js.map +1 -1
- package/ios-client.mjs +109 -9
- package/ios-client.mjs.map +1 -1
- package/package.json +11 -1
- package/sandbox-client.d.mts +20 -15
- package/sandbox-client.d.mts.map +1 -1
- package/sandbox-client.d.ts +20 -15
- package/sandbox-client.d.ts.map +1 -1
- package/sandbox-client.js +49 -40
- package/sandbox-client.js.map +1 -1
- package/sandbox-client.mjs +48 -40
- package/sandbox-client.mjs.map +1 -1
- package/src/exec-client.ts +14 -7
- package/src/folder-sync-ignore.ts +65 -0
- package/src/folder-sync-watcher.ts +11 -66
- package/src/folder-sync.ts +39 -89
- package/src/ios-client.ts +138 -9
- package/src/sandbox-client.ts +72 -62
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/sandbox-client.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import os from 'os';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { syncFolder as syncFolderImpl, type FolderSyncOptions } from './folder-sync';
|
|
2
4
|
import { exec, ExecChildProcess } from './exec-client';
|
|
5
|
+
import { createIgnoreFn } from './folder-sync-ignore';
|
|
6
|
+
import crypto from 'crypto';
|
|
3
7
|
|
|
4
8
|
export type LogLevel = 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
5
9
|
|
|
@@ -27,32 +31,37 @@ export type SimulatorConfig = {
|
|
|
27
31
|
*/
|
|
28
32
|
export type SyncOptions = {
|
|
29
33
|
/**
|
|
30
|
-
*
|
|
31
|
-
* This is not sent to the server.
|
|
34
|
+
* If true, watch the folder and re-sync on any changes. Defaults to true.
|
|
32
35
|
*/
|
|
33
|
-
|
|
34
|
-
basisCacheDir?: string;
|
|
35
|
-
maxPatchBytes?: number;
|
|
36
|
+
watch?: boolean;
|
|
36
37
|
/**
|
|
37
|
-
*
|
|
38
|
+
* Directory for the client-side folder-sync cache.
|
|
39
|
+
* Used to store the last-synced “basis” copies of files (and related sync metadata) so we can compute xdelta patches
|
|
40
|
+
* on subsequent syncs without re-downloading server state.
|
|
41
|
+
*
|
|
42
|
+
* Defaults to a temporary directory under the OS temp directory.
|
|
38
43
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
basisCacheDir?: string;
|
|
45
|
+
/** Max patch size (bytes) to send as delta before falling back to full upload. */
|
|
46
|
+
maxPatchBytes?: number;
|
|
47
|
+
/** If true, install the app after syncing. Defaults to true. */
|
|
48
|
+
install?: boolean;
|
|
41
49
|
/**
|
|
42
|
-
* Optional
|
|
50
|
+
* Optional predicate for ignoring files and directories during sync.
|
|
51
|
+
* Applied in addition to built-in sync and Xcode-specific ignore rules.
|
|
43
52
|
* Called with the relative path from the sync root (using forward slashes).
|
|
44
53
|
* For directories, the path ends with '/'.
|
|
45
|
-
* Return true to
|
|
54
|
+
* Return true to ignore, false to keep.
|
|
46
55
|
*
|
|
47
56
|
* @example
|
|
48
|
-
* //
|
|
49
|
-
*
|
|
57
|
+
* // Ignore build folder
|
|
58
|
+
* ignore: (path) => path.startsWith('build/')
|
|
50
59
|
*
|
|
51
60
|
* @example
|
|
52
|
-
* //
|
|
53
|
-
*
|
|
61
|
+
* // Ignore anything outside src/ and JSON files
|
|
62
|
+
* ignore: (path) => !(path.startsWith('src/') || path.endsWith('.json'))
|
|
54
63
|
*/
|
|
55
|
-
|
|
64
|
+
ignore?: (relativePath: string) => boolean;
|
|
56
65
|
};
|
|
57
66
|
|
|
58
67
|
/**
|
|
@@ -150,7 +159,7 @@ export async function createXCodeSandboxClient(
|
|
|
150
159
|
},
|
|
151
160
|
};
|
|
152
161
|
|
|
153
|
-
const
|
|
162
|
+
const log = (level: 'debug' | 'info' | 'warn' | 'error', msg: string) => {
|
|
154
163
|
switch (level) {
|
|
155
164
|
case 'debug':
|
|
156
165
|
logger.debug(msg);
|
|
@@ -196,54 +205,55 @@ export async function createXCodeSandboxClient(
|
|
|
196
205
|
|
|
197
206
|
return {
|
|
198
207
|
async sync(localCodePath: string, opts?: SyncOptions): Promise<SyncResult> {
|
|
208
|
+
// Use folder name and hash of absolute path to scope basisCacheDir uniquely for each sync root
|
|
209
|
+
const resolvedPath = path.resolve(localCodePath);
|
|
210
|
+
const folderName = path.basename(resolvedPath);
|
|
211
|
+
const hash = crypto.createHash('sha1').update(resolvedPath).digest('hex').slice(0, 8);
|
|
212
|
+
const cacheKey = `limsync-cache-${folderName}-${hash}`;
|
|
213
|
+
const basisCacheDir = opts?.basisCacheDir ?? path.join(os.tmpdir(), cacheKey);
|
|
199
214
|
const codeSyncOpts: FolderSyncOptions = {
|
|
200
215
|
apiUrl: options.apiUrl,
|
|
201
216
|
token: options.token,
|
|
202
|
-
udid:
|
|
203
|
-
install:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
217
|
+
udid: cacheKey,
|
|
218
|
+
install: opts?.install ?? true,
|
|
219
|
+
ignoreFn: await createIgnoreFn(localCodePath, {
|
|
220
|
+
basisCacheDir,
|
|
221
|
+
additional: (relativePath: string) => {
|
|
222
|
+
if (
|
|
223
|
+
relativePath.startsWith('build/') ||
|
|
224
|
+
relativePath.startsWith('.build/') ||
|
|
225
|
+
relativePath.startsWith('DerivedData/') ||
|
|
226
|
+
relativePath.startsWith('Index.noindex/') ||
|
|
227
|
+
relativePath.startsWith('ModuleCache.noindex/') ||
|
|
228
|
+
relativePath.startsWith('.index-build/')
|
|
229
|
+
) {
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
if (
|
|
233
|
+
relativePath.startsWith('.swiftpm/') ||
|
|
234
|
+
relativePath.startsWith('Pods/') ||
|
|
235
|
+
relativePath.startsWith('Carthage/Build/')
|
|
236
|
+
) {
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
if (relativePath.includes('/xcuserdata/')) {
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
if (relativePath.includes('.dSYM/')) {
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
// User-provided ignores
|
|
246
|
+
if (opts?.ignore?.(relativePath)) {
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
213
249
|
return false;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
if (
|
|
223
|
-
relativePath.startsWith('.git/') ||
|
|
224
|
-
relativePath.startsWith('.limsync-cache/') ||
|
|
225
|
-
relativePath === '.DS_Store' ||
|
|
226
|
-
relativePath.endsWith('/.DS_Store')
|
|
227
|
-
) {
|
|
228
|
-
return false;
|
|
229
|
-
}
|
|
230
|
-
if (relativePath.includes('/xcuserdata/')) {
|
|
231
|
-
return false;
|
|
232
|
-
}
|
|
233
|
-
if (relativePath.includes('.dSYM/')) {
|
|
234
|
-
return false;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// User-provided filter
|
|
238
|
-
if (opts?.filter && !opts.filter(relativePath)) {
|
|
239
|
-
return false;
|
|
240
|
-
}
|
|
241
|
-
return true;
|
|
242
|
-
},
|
|
243
|
-
...(opts?.basisCacheDir ? { basisCacheDir: opts.basisCacheDir } : {}),
|
|
244
|
-
...(opts?.maxPatchBytes !== undefined ? { maxPatchBytes: opts.maxPatchBytes } : {}),
|
|
245
|
-
...(opts?.watch !== undefined ? { watch: opts.watch } : {}),
|
|
246
|
-
log: opts?.log ?? logFn,
|
|
250
|
+
},
|
|
251
|
+
}),
|
|
252
|
+
basisCacheDir,
|
|
253
|
+
watch: opts?.watch ?? true,
|
|
254
|
+
maxPatchBytes: opts?.maxPatchBytes ?? 4 * 1024 * 1024,
|
|
255
|
+
launchMode: 'ForegroundIfRunning',
|
|
256
|
+
log,
|
|
247
257
|
};
|
|
248
258
|
|
|
249
259
|
const result = await syncFolderImpl(localCodePath, codeSyncOpts);
|
|
@@ -259,7 +269,7 @@ export async function createXCodeSandboxClient(
|
|
|
259
269
|
{
|
|
260
270
|
apiUrl: options.apiUrl,
|
|
261
271
|
token: options.token,
|
|
262
|
-
log
|
|
272
|
+
log,
|
|
263
273
|
},
|
|
264
274
|
);
|
|
265
275
|
},
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.23.1'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.23.1";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.23.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.23.1'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|