chofex-cli 0.1.140 → 0.1.141
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/README.md +1 -0
- package/dist/index.js +65 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -62434,6 +62434,51 @@ var uploadPicture = exports_Effect.fn("uploadPicture")(function* (options, path4
|
|
|
62434
62434
|
});
|
|
62435
62435
|
});
|
|
62436
62436
|
|
|
62437
|
+
// src/upgrade.ts
|
|
62438
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
62439
|
+
import { mkdtemp as mkdtemp2, rm as rm2 } from "node:fs/promises";
|
|
62440
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
62441
|
+
import { join as join3 } from "node:path";
|
|
62442
|
+
var cliPackageName = "chofex-cli";
|
|
62443
|
+
var upgradeVersion = "latest";
|
|
62444
|
+
var npmUpgradeArguments = (cacheDirectory) => [
|
|
62445
|
+
"install",
|
|
62446
|
+
"--global",
|
|
62447
|
+
`${cliPackageName}@${upgradeVersion}`,
|
|
62448
|
+
"--force",
|
|
62449
|
+
"--prefer-online",
|
|
62450
|
+
`--cache=${cacheDirectory}`
|
|
62451
|
+
];
|
|
62452
|
+
var runNpm = (arguments_) => new Promise((resolve4, reject) => {
|
|
62453
|
+
const executable = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
62454
|
+
const child = spawn3(executable, arguments_, {
|
|
62455
|
+
stdio: ["ignore", "ignore", "pipe"]
|
|
62456
|
+
});
|
|
62457
|
+
let stderr = "";
|
|
62458
|
+
child.stderr.setEncoding("utf8");
|
|
62459
|
+
child.stderr.on("data", (chunk) => {
|
|
62460
|
+
stderr += chunk;
|
|
62461
|
+
});
|
|
62462
|
+
child.on("error", reject);
|
|
62463
|
+
child.on("close", (exitCode) => {
|
|
62464
|
+
resolve4({ exitCode: exitCode ?? 1, stderr: stderr.trim() });
|
|
62465
|
+
});
|
|
62466
|
+
});
|
|
62467
|
+
var upgradeCli = async (runner = runNpm) => {
|
|
62468
|
+
const cacheDirectory = await mkdtemp2(join3(tmpdir2(), "chofex-npm-cache-"));
|
|
62469
|
+
try {
|
|
62470
|
+
const result3 = await runner(npmUpgradeArguments(cacheDirectory));
|
|
62471
|
+
if (result3.exitCode === 0)
|
|
62472
|
+
return;
|
|
62473
|
+
let detail = "";
|
|
62474
|
+
if (result3.stderr)
|
|
62475
|
+
detail = `: ${result3.stderr}`;
|
|
62476
|
+
throw new Error(`npm exited with code ${result3.exitCode}${detail}`);
|
|
62477
|
+
} finally {
|
|
62478
|
+
await rm2(cacheDirectory, { recursive: true, force: true });
|
|
62479
|
+
}
|
|
62480
|
+
};
|
|
62481
|
+
|
|
62437
62482
|
// src/commands.ts
|
|
62438
62483
|
var inputFlag2 = exports_Flag.string("input").pipe(exports_Flag.optional, exports_Flag.withDescription("Read JSON from a file, or use - for stdin"));
|
|
62439
62484
|
var stageFlag = exports_Flag.choice("stage", ["application", "acceptance"]).pipe(exports_Flag.withDefault("application"));
|
|
@@ -62610,6 +62655,25 @@ var whoamiCommand = exports_Command.make("whoami", {}, exports_Effect.fn("whoami
|
|
|
62610
62655
|
const operation = getCurrentUser({ apiUrl: options.apiUrl, token });
|
|
62611
62656
|
yield* execute(options.output, operation, (result3) => `Authenticated as ${result3.email} (${result3.userId}, ${result3.tokenType}).`);
|
|
62612
62657
|
})).pipe(exports_Command.withDescription("Verify the current Clerk authentication"));
|
|
62658
|
+
var upgradeCommand = exports_Command.make("upgrade", {}, exports_Effect.fn("upgradeCommand")(function* () {
|
|
62659
|
+
const options = yield* root;
|
|
62660
|
+
const operation = exports_Effect.tryPromise({
|
|
62661
|
+
try: async () => {
|
|
62662
|
+
await upgradeCli();
|
|
62663
|
+
return {
|
|
62664
|
+
version: 1,
|
|
62665
|
+
ok: true,
|
|
62666
|
+
requestId: crypto.randomUUID(),
|
|
62667
|
+
data: {
|
|
62668
|
+
packageName: cliPackageName,
|
|
62669
|
+
requestedVersion: upgradeVersion
|
|
62670
|
+
}
|
|
62671
|
+
};
|
|
62672
|
+
},
|
|
62673
|
+
catch: (error2) => cliError("UPGRADE_FAILED", `npm could not update ${cliPackageName}`, false, String(error2))
|
|
62674
|
+
});
|
|
62675
|
+
yield* execute(options.output, operation, () => `Updated ${cliPackageName} to the ${upgradeVersion} version.`);
|
|
62676
|
+
})).pipe(exports_Command.withDescription("Update chofex-cli to the latest version"));
|
|
62613
62677
|
var inputValidation = (stage, path4) => {
|
|
62614
62678
|
if (stage === "application") {
|
|
62615
62679
|
return applicationInput(path4, config.publicSiteUrl).pipe(exports_Effect.asVoid);
|
|
@@ -62668,6 +62732,7 @@ var command = root.pipe(exports_Command.withSubcommands([
|
|
|
62668
62732
|
loginCommand,
|
|
62669
62733
|
logoutCommand,
|
|
62670
62734
|
whoamiCommand,
|
|
62735
|
+
upgradeCommand,
|
|
62671
62736
|
validateCommand,
|
|
62672
62737
|
registerCommand,
|
|
62673
62738
|
statusCommand,
|