@better-update/cli 0.18.0 → 0.18.2
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.mjs +38 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
-
import { spawn, spawnSync } from "node:child_process";
|
|
3
|
+
import { execFile, spawn, spawnSync } from "node:child_process";
|
|
4
4
|
import { defineCommand, runMain } from "citty";
|
|
5
5
|
import { Console, Context, Data, Deferred, Duration, Effect, Layer, Match, Option, ParseResult, Schema } from "effect";
|
|
6
6
|
import { Command, FetchHttpClient, FileSystem, HttpApi, HttpApiClient, HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema, HttpApiSecurity, HttpClient, HttpClientRequest, OpenApi, Path } from "@effect/platform";
|
|
@@ -14,12 +14,13 @@ import { createServer } from "node:http";
|
|
|
14
14
|
import { maxBy, uniqBy } from "es-toolkit";
|
|
15
15
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
16
16
|
import forge from "node-forge";
|
|
17
|
-
import { createReadStream, existsSync, promises, readFileSync, writeFileSync } from "node:fs";
|
|
17
|
+
import { accessSync, chmodSync, constants, createReadStream, existsSync, promises, readFileSync, writeFileSync } from "node:fs";
|
|
18
18
|
import { spawn as spawn$1 } from "node-pty";
|
|
19
19
|
import chalk from "chalk";
|
|
20
20
|
import os from "node:os";
|
|
21
21
|
import plistMod from "@expo/plist";
|
|
22
22
|
import { ExpoRunFormatter } from "@expo/xcpretty";
|
|
23
|
+
import { promisify } from "node:util";
|
|
23
24
|
import ignore from "ignore";
|
|
24
25
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
25
26
|
import { getFormattedSerialNumber, getX509Certificate, parsePKCS12 } from "@expo/pkcs12";
|
|
@@ -31,7 +32,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
31
32
|
|
|
32
33
|
//#endregion
|
|
33
34
|
//#region package.json
|
|
34
|
-
var version = "0.18.
|
|
35
|
+
var version = "0.18.2";
|
|
35
36
|
|
|
36
37
|
//#endregion
|
|
37
38
|
//#region src/lib/interactive-mode.ts
|
|
@@ -4444,7 +4445,23 @@ const mergeEnv$1 = (overrides) => {
|
|
|
4444
4445
|
for (const [key, value] of Object.entries(overrides)) merged[key] = value;
|
|
4445
4446
|
return merged;
|
|
4446
4447
|
};
|
|
4448
|
+
let spawnHelperChecked = false;
|
|
4449
|
+
const ensureSpawnHelperExecutable = () => {
|
|
4450
|
+
if (spawnHelperChecked) return;
|
|
4451
|
+
spawnHelperChecked = true;
|
|
4452
|
+
if (process$1.platform === "win32") return;
|
|
4453
|
+
try {
|
|
4454
|
+
const nodeRequire = createRequire(import.meta.url);
|
|
4455
|
+
const helperPath = path.join(path.dirname(nodeRequire.resolve("node-pty/package.json")), "prebuilds", `${process$1.platform}-${process$1.arch}`, "spawn-helper");
|
|
4456
|
+
try {
|
|
4457
|
+
accessSync(helperPath, constants.X_OK);
|
|
4458
|
+
} catch {
|
|
4459
|
+
chmodSync(helperPath, 493);
|
|
4460
|
+
}
|
|
4461
|
+
} catch {}
|
|
4462
|
+
};
|
|
4447
4463
|
const trySpawn = (input) => {
|
|
4464
|
+
ensureSpawnHelperExecutable();
|
|
4448
4465
|
const { cols, rows } = ptyDimensions();
|
|
4449
4466
|
try {
|
|
4450
4467
|
return spawn$1(input.command, [...input.args], {
|
|
@@ -6583,6 +6600,7 @@ const detectPlatform = (explicit, config) => Effect.gen(function* () {
|
|
|
6583
6600
|
|
|
6584
6601
|
//#endregion
|
|
6585
6602
|
//#region src/lib/project-staging.ts
|
|
6603
|
+
const execFileAsync = promisify(execFile);
|
|
6586
6604
|
const LOCKFILES = [
|
|
6587
6605
|
["bun.lock", "bun"],
|
|
6588
6606
|
["bun.lockb", "bun"],
|
|
@@ -6669,6 +6687,22 @@ const copyProjectTree = (params) => Effect.tryPromise({
|
|
|
6669
6687
|
},
|
|
6670
6688
|
catch: (cause) => new StagingError({ message: `Failed to copy project to staging dir: ${formatCause(cause)}` })
|
|
6671
6689
|
});
|
|
6690
|
+
/**
|
|
6691
|
+
* EAS stages projects via `git clone`, so `.git` is always present and prepare
|
|
6692
|
+
* scripts that shell out to git (lefthook install, husky install,
|
|
6693
|
+
* simple-git-hooks, etc.) succeed naturally. Our copy strips `.git` for size,
|
|
6694
|
+
* so we recreate a bare repo at the staging root before install runs. The
|
|
6695
|
+
* hooks installed here never fire because no one commits in the staging dir —
|
|
6696
|
+
* they exist only so `git rev-parse` succeeds during postinstall.
|
|
6697
|
+
*/
|
|
6698
|
+
const initGitRepo = (stagingRoot) => Effect.tryPromise({
|
|
6699
|
+
try: async () => execFileAsync("git", [
|
|
6700
|
+
"init",
|
|
6701
|
+
"-q",
|
|
6702
|
+
stagingRoot
|
|
6703
|
+
]),
|
|
6704
|
+
catch: (cause) => new StagingError({ message: `Failed to init git repo in staging dir: ${formatCause(cause)}` })
|
|
6705
|
+
}).pipe(Effect.asVoid);
|
|
6672
6706
|
const runInstall = (params) => runStep({
|
|
6673
6707
|
command: params.packageManager,
|
|
6674
6708
|
args: ["install"],
|
|
@@ -6693,6 +6727,7 @@ const prepareStagingProject = (input) => Effect.gen(function* () {
|
|
|
6693
6727
|
dest: stagingRoot,
|
|
6694
6728
|
ig: yield* buildIgnoreInstance(workspaceRoot)
|
|
6695
6729
|
});
|
|
6730
|
+
yield* initGitRepo(stagingRoot);
|
|
6696
6731
|
yield* runInstall({
|
|
6697
6732
|
stagingRoot,
|
|
6698
6733
|
packageManager,
|