@tscircuit/cli 0.1.109 → 0.1.110
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/main.js +33 -16
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -433495,7 +433495,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
433495
433495
|
import { execSync as execSync2 } from "node:child_process";
|
|
433496
433496
|
var import_semver = __toESM2(require_semver2(), 1);
|
|
433497
433497
|
// package.json
|
|
433498
|
-
var version = "0.1.
|
|
433498
|
+
var version = "0.1.109";
|
|
433499
433499
|
var package_default = {
|
|
433500
433500
|
name: "@tscircuit/cli",
|
|
433501
433501
|
version,
|
|
@@ -433707,11 +433707,17 @@ var prompts_default = prompts;
|
|
|
433707
433707
|
|
|
433708
433708
|
// lib/shared/check-for-cli-update.ts
|
|
433709
433709
|
var currentCliVersion = () => program2?.version() ?? import_semver.default.inc(version, "patch") ?? version;
|
|
433710
|
+
var getLatestVersion = async () => {
|
|
433711
|
+
const { version: latestCliVersion } = await distribution_default.get("https://registry.npmjs.org/@tscircuit/cli/latest", { throwHttpErrors: false }).json();
|
|
433712
|
+
return latestCliVersion;
|
|
433713
|
+
};
|
|
433710
433714
|
var checkForTsciUpdates = async () => {
|
|
433711
433715
|
if (process.env.TSCI_SKIP_CLI_UPDATE === "true")
|
|
433712
|
-
return;
|
|
433713
|
-
const
|
|
433714
|
-
if (latestCliVersion
|
|
433716
|
+
return false;
|
|
433717
|
+
const latestCliVersion = await getLatestVersion();
|
|
433718
|
+
if (!latestCliVersion)
|
|
433719
|
+
return false;
|
|
433720
|
+
if (import_semver.default.gt(latestCliVersion, currentCliVersion())) {
|
|
433715
433721
|
const { userWantsToUpdate } = await prompts({
|
|
433716
433722
|
type: "confirm",
|
|
433717
433723
|
name: "userWantsToUpdate",
|
|
@@ -433719,19 +433725,30 @@ var checkForTsciUpdates = async () => {
|
|
|
433719
433725
|
Would you like to update now?`
|
|
433720
433726
|
});
|
|
433721
433727
|
if (userWantsToUpdate) {
|
|
433722
|
-
|
|
433723
|
-
const installCommand = getGlobalDepsInstallCommand(packageManager.name, "@tscircuit/cli@latest");
|
|
433724
|
-
try {
|
|
433725
|
-
console.log(`Updating tsci using: ${installCommand}`);
|
|
433726
|
-
execSync2(installCommand, { stdio: "inherit" });
|
|
433727
|
-
console.log(kleur_default.green("tsci has been updated successfully!"));
|
|
433728
|
-
} catch {
|
|
433729
|
-
console.warn("Update failed. You can try updating manually by running:");
|
|
433730
|
-
console.warn(` ${installCommand}`);
|
|
433731
|
-
}
|
|
433728
|
+
return await updateTsci();
|
|
433732
433729
|
}
|
|
433733
|
-
}
|
|
433730
|
+
}
|
|
433731
|
+
return false;
|
|
433732
|
+
};
|
|
433733
|
+
var updateTsciIfNewVersionIsAvailable = async () => {
|
|
433734
|
+
const latestCliVersion = await getLatestVersion();
|
|
433735
|
+
if (!latestCliVersion)
|
|
433734
433736
|
return false;
|
|
433737
|
+
if (import_semver.default.gt(latestCliVersion, currentCliVersion())) {
|
|
433738
|
+
return await updateTsci();
|
|
433739
|
+
}
|
|
433740
|
+
return false;
|
|
433741
|
+
};
|
|
433742
|
+
var updateTsci = async () => {
|
|
433743
|
+
const packageManager = getPackageManager();
|
|
433744
|
+
const installCommand = getGlobalDepsInstallCommand(packageManager.name, "@tscircuit/cli@latest");
|
|
433745
|
+
try {
|
|
433746
|
+
console.log(`Updating tsci using: ${installCommand}`);
|
|
433747
|
+
execSync2(installCommand, { stdio: "inherit" });
|
|
433748
|
+
console.log(kleur_default.green("tsci has been updated successfully!"));
|
|
433749
|
+
} catch {
|
|
433750
|
+
console.warn("Update failed. You can try updating manually by running:");
|
|
433751
|
+
console.warn(` ${installCommand}`);
|
|
433735
433752
|
}
|
|
433736
433753
|
return true;
|
|
433737
433754
|
};
|
|
@@ -464677,7 +464694,7 @@ var registerAdd = (program3) => {
|
|
|
464677
464694
|
// cli/upgrade/register.ts
|
|
464678
464695
|
function registerUpgradeCommand(program3) {
|
|
464679
464696
|
program3.command("upgrade").description("Upgrade CLI to the latest version").action(async () => {
|
|
464680
|
-
const isUpdated = await
|
|
464697
|
+
const isUpdated = await updateTsciIfNewVersionIsAvailable();
|
|
464681
464698
|
if (!isUpdated) {
|
|
464682
464699
|
console.log(kleur_default.green(`You are already using the latest version of tsci (v${currentCliVersion()})`));
|
|
464683
464700
|
}
|