percher 0.5.3 → 0.5.5
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/bin/percher.js +50 -38
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/bin/percher.js
CHANGED
|
@@ -108493,7 +108493,8 @@ async function envList(ctx, input = {}) {
|
|
|
108493
108493
|
}
|
|
108494
108494
|
// ../core/dist/commands/export.js
|
|
108495
108495
|
import { randomUUID } from "node:crypto";
|
|
108496
|
-
import {
|
|
108496
|
+
import { createWriteStream } from "node:fs";
|
|
108497
|
+
import { rename, unlink } from "node:fs/promises";
|
|
108497
108498
|
import { isAbsolute, resolve as resolvePath } from "node:path";
|
|
108498
108499
|
var exportInputSchema = exports_external.object({
|
|
108499
108500
|
app: exports_external.string().optional(),
|
|
@@ -108516,35 +108517,45 @@ function resolveAppName3(ctx, provided) {
|
|
|
108516
108517
|
}
|
|
108517
108518
|
async function streamToFile(outPath, source) {
|
|
108518
108519
|
const tmpPath = `${outPath}.part-${randomUUID()}`;
|
|
108519
|
-
const
|
|
108520
|
-
let bytes = 0;
|
|
108520
|
+
const out = createWriteStream(tmpPath);
|
|
108521
108521
|
const reader = source.getReader();
|
|
108522
|
+
const closed = new Promise((resolve6) => out.once("close", () => resolve6()));
|
|
108523
|
+
let onWriteError;
|
|
108524
|
+
const writeFailed = new Promise((_, reject) => {
|
|
108525
|
+
onWriteError = reject;
|
|
108526
|
+
});
|
|
108527
|
+
out.once("error", onWriteError);
|
|
108528
|
+
writeFailed.catch(() => {});
|
|
108529
|
+
let bytes = 0;
|
|
108522
108530
|
try {
|
|
108523
|
-
|
|
108524
|
-
const { done, value } = await reader.read();
|
|
108531
|
+
for (;; ) {
|
|
108532
|
+
const { done, value } = await Promise.race([reader.read(), writeFailed]);
|
|
108525
108533
|
if (done)
|
|
108526
108534
|
break;
|
|
108527
|
-
if (value && value.
|
|
108528
|
-
|
|
108529
|
-
|
|
108535
|
+
if (value && value.byteLength > 0) {
|
|
108536
|
+
bytes += value.byteLength;
|
|
108537
|
+
if (!out.write(value)) {
|
|
108538
|
+
await Promise.race([
|
|
108539
|
+
new Promise((resolve6) => out.once("drain", resolve6)),
|
|
108540
|
+
writeFailed
|
|
108541
|
+
]);
|
|
108542
|
+
}
|
|
108530
108543
|
}
|
|
108531
108544
|
}
|
|
108532
|
-
await
|
|
108545
|
+
await new Promise((resolve6, reject) => {
|
|
108546
|
+
out.end((err) => err ? reject(err) : resolve6());
|
|
108547
|
+
});
|
|
108548
|
+
await closed;
|
|
108533
108549
|
} catch (err) {
|
|
108534
|
-
|
|
108535
|
-
|
|
108536
|
-
|
|
108537
|
-
try {
|
|
108538
|
-
await Bun.file(tmpPath).delete?.();
|
|
108539
|
-
} catch {}
|
|
108550
|
+
out.destroy();
|
|
108551
|
+
await closed;
|
|
108552
|
+
await unlink(tmpPath).catch(() => {});
|
|
108540
108553
|
throw err;
|
|
108541
108554
|
}
|
|
108542
108555
|
try {
|
|
108543
108556
|
await rename(tmpPath, outPath);
|
|
108544
108557
|
} catch (err) {
|
|
108545
|
-
|
|
108546
|
-
await Bun.file(tmpPath).delete?.();
|
|
108547
|
-
} catch {}
|
|
108558
|
+
await unlink(tmpPath).catch(() => {});
|
|
108548
108559
|
throw err;
|
|
108549
108560
|
}
|
|
108550
108561
|
return { bytes };
|
|
@@ -113407,9 +113418,20 @@ function updateLocalTomlName(cwd, oldName, newName) {
|
|
|
113407
113418
|
}
|
|
113408
113419
|
}
|
|
113409
113420
|
// ../core/dist/commands/reproduce.js
|
|
113421
|
+
import { spawn } from "node:child_process";
|
|
113410
113422
|
import { mkdtempSync, writeFileSync as writeFileSync9 } from "node:fs";
|
|
113411
113423
|
import { tmpdir } from "node:os";
|
|
113412
113424
|
import { join as join23 } from "node:path";
|
|
113425
|
+
function runProcessExit(cmd, args, opts = {}) {
|
|
113426
|
+
return new Promise((resolve7, reject) => {
|
|
113427
|
+
const child = spawn(cmd, args, {
|
|
113428
|
+
cwd: opts.cwd,
|
|
113429
|
+
stdio: opts.inherit ? "inherit" : "ignore"
|
|
113430
|
+
});
|
|
113431
|
+
child.on("error", reject);
|
|
113432
|
+
child.on("close", (code) => resolve7(code ?? 1));
|
|
113433
|
+
});
|
|
113434
|
+
}
|
|
113413
113435
|
var reproduceInputSchema = exports_external.object({
|
|
113414
113436
|
app: exports_external.string().optional().describe("App name. Defaults to the [app].name in the current directory's percher.toml."),
|
|
113415
113437
|
deployId: exports_external.string().describe("Deploy id (e.g. dep_abc123) to reproduce. Required — usually the failed deploy you want to debug.")
|
|
@@ -113498,12 +113520,7 @@ async function reproduce(ctx, input) {
|
|
|
113498
113520
|
writeFileSync9(tarballPath, bytes);
|
|
113499
113521
|
let extracted = false;
|
|
113500
113522
|
try {
|
|
113501
|
-
|
|
113502
|
-
stdout: "pipe",
|
|
113503
|
-
stderr: "pipe"
|
|
113504
|
-
});
|
|
113505
|
-
const exitCode = await proc.exited;
|
|
113506
|
-
extracted = exitCode === 0;
|
|
113523
|
+
extracted = await runProcessExit("tar", ["-xzf", tarballPath, "-C", tmpDir]) === 0;
|
|
113507
113524
|
} catch {}
|
|
113508
113525
|
const envHint = currentAppEnvKeys.length > 0 ? `Current app env keys (NOT a deploy-time snapshot): ${currentAppEnvKeys.join(", ")}` : "No env vars currently configured on the app.";
|
|
113509
113526
|
if (!extracted) {
|
|
@@ -113522,20 +113539,15 @@ async function reproduce(ctx, input) {
|
|
|
113522
113539
|
let builtLocally = false;
|
|
113523
113540
|
let nixpacksAvailable = false;
|
|
113524
113541
|
try {
|
|
113525
|
-
|
|
113526
|
-
const code = await which.exited;
|
|
113527
|
-
nixpacksAvailable = code === 0;
|
|
113542
|
+
nixpacksAvailable = await runProcessExit("nixpacks", ["--version"]) === 0;
|
|
113528
113543
|
} catch {}
|
|
113529
113544
|
if (nixpacksAvailable) {
|
|
113530
113545
|
ctx.status("Running nixpacks build locally...");
|
|
113531
113546
|
try {
|
|
113532
|
-
|
|
113547
|
+
builtLocally = await runProcessExit("nixpacks", ["build", tmpDir, "--name", `repro-${input.deployId}`], {
|
|
113533
113548
|
cwd: tmpDir,
|
|
113534
|
-
|
|
113535
|
-
|
|
113536
|
-
});
|
|
113537
|
-
const code = await build.exited;
|
|
113538
|
-
builtLocally = code === 0;
|
|
113549
|
+
inherit: true
|
|
113550
|
+
}) === 0;
|
|
113539
113551
|
} catch {}
|
|
113540
113552
|
}
|
|
113541
113553
|
const buildHint = builtLocally ? `Build succeeded locally — the cloud failure may have been infra-flake. Retry the same source server-side: \`bunx percher redeploy ${input.deployId} --app ${app.name}\`` : nixpacksAvailable ? "nixpacks build also failed locally — same error as cloud. Iterate on the source in the tmp dir, then `bunx percher publish` from the project root once fixed." : `nixpacks not on PATH. Install from https://nixpacks.com to reproduce the build, or run your own build command in ${tmpDir}.`;
|
|
@@ -115859,16 +115871,16 @@ function registerTransfersCommands(cli, ctx) {
|
|
|
115859
115871
|
}
|
|
115860
115872
|
|
|
115861
115873
|
// src/open.ts
|
|
115862
|
-
import { spawn } from "node:child_process";
|
|
115874
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
115863
115875
|
async function openUrl(url2) {
|
|
115864
115876
|
const platform = process.platform;
|
|
115865
115877
|
try {
|
|
115866
115878
|
if (platform === "darwin")
|
|
115867
|
-
|
|
115879
|
+
spawn2("open", [url2], { detached: true, stdio: "ignore" }).unref();
|
|
115868
115880
|
else if (platform === "win32")
|
|
115869
|
-
|
|
115881
|
+
spawn2("cmd", ["/c", "start", "", url2], { detached: true, stdio: "ignore" }).unref();
|
|
115870
115882
|
else
|
|
115871
|
-
|
|
115883
|
+
spawn2("xdg-open", [url2], { detached: true, stdio: "ignore" }).unref();
|
|
115872
115884
|
} catch {}
|
|
115873
115885
|
}
|
|
115874
115886
|
|
|
@@ -115975,7 +115987,7 @@ async function renderError(stderr, error48) {
|
|
|
115975
115987
|
// package.json
|
|
115976
115988
|
var package_default = {
|
|
115977
115989
|
name: "percher",
|
|
115978
|
-
version: "0.5.
|
|
115990
|
+
version: "0.5.5",
|
|
115979
115991
|
description: "CLI for the Percher hosting platform — publish apps with one command",
|
|
115980
115992
|
type: "module",
|
|
115981
115993
|
bin: {
|
package/dist/package.json
CHANGED