@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.
Files changed (2) hide show
  1. package/dist/main.js +33 -16
  2. 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.108";
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 { version: latestCliVersion } = await distribution_default.get("https://registry.npmjs.org/@tscircuit/cli/latest", { throwHttpErrors: false }).json();
433714
- if (latestCliVersion && import_semver.default.gt(latestCliVersion, currentCliVersion())) {
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
- const packageManager = getPackageManager();
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
- } else {
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 checkForTsciUpdates();
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.109",
3
+ "version": "0.1.110",
4
4
  "main": "dist/main.js",
5
5
  "devDependencies": {
6
6
  "@babel/standalone": "^7.26.9",