@tscircuit/cli 0.1.1108 → 0.1.1109

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/cli/main.js CHANGED
@@ -97678,8 +97678,11 @@ var registerStaticAssetLoaders = () => {
97678
97678
 
97679
97679
  // cli/main.ts
97680
97680
  var import_perfect_cli = __toESM2(require_dist2(), 1);
97681
+
97682
+ // lib/getVersion.ts
97683
+ import { createRequire as createRequire2 } from "node:module";
97681
97684
  // package.json
97682
- var version = "0.1.1107";
97685
+ var version = "0.1.1108";
97683
97686
  var package_default = {
97684
97687
  name: "@tscircuit/cli",
97685
97688
  version,
@@ -97782,8 +97785,38 @@ var package_default = {
97782
97785
 
97783
97786
  // lib/getVersion.ts
97784
97787
  var import_semver = __toESM2(require_semver2(), 1);
97785
- var getVersion = () => {
97786
- return import_semver.default.inc(package_default.version, "patch") ?? package_default.version;
97788
+ var require2 = createRequire2(import.meta.url);
97789
+ var resolvePackageVersionFromNodeModules = (packageName) => {
97790
+ try {
97791
+ const packageJson = require2(`${packageName}/package.json`);
97792
+ return packageJson.version;
97793
+ } catch {
97794
+ return;
97795
+ }
97796
+ };
97797
+ var getCliVersion = () => import_semver.default.inc(package_default.version, "patch") ?? package_default.version;
97798
+ var getVersionInfo = (resolvePackageVersion = resolvePackageVersionFromNodeModules) => {
97799
+ const cliVersion = getCliVersion();
97800
+ const tscircuitVersion = globalThis.TSCIRCUIT_VERSION ?? resolvePackageVersion("tscircuit");
97801
+ return {
97802
+ tscircuitVersion,
97803
+ cliVersion,
97804
+ runframeVersion: resolvePackageVersion("@tscircuit/runframe"),
97805
+ coreVersion: resolvePackageVersion("@tscircuit/core")
97806
+ };
97807
+ };
97808
+ var getVersion = ({ verbose = false } = {}) => {
97809
+ const versions = getVersionInfo();
97810
+ if (!verbose) {
97811
+ return versions.tscircuitVersion ?? versions.cliVersion;
97812
+ }
97813
+ return [
97814
+ `tscircuit: ${versions.tscircuitVersion ?? "not installed"}`,
97815
+ `@tscircuit/cli: ${versions.cliVersion}`,
97816
+ `@tscircuit/runframe: ${versions.runframeVersion ?? "not installed"}`,
97817
+ `@tscircuit/core: ${versions.coreVersion ?? "not installed"}`
97818
+ ].join(`
97819
+ `);
97787
97820
  };
97788
97821
 
97789
97822
  // lib/shared/add-package.ts
@@ -105851,13 +105884,13 @@ function deriveComponentNameFromPath(filePath) {
105851
105884
  }
105852
105885
 
105853
105886
  // lib/shared/importFromUserLand.ts
105854
- import { createRequire as createRequire2 } from "node:module";
105887
+ import { createRequire as createRequire3 } from "node:module";
105855
105888
  import fs16 from "node:fs";
105856
105889
  import path16 from "node:path";
105857
105890
  async function importFromUserLand(moduleName) {
105858
105891
  const userModulePath = path16.join(process.cwd(), "node_modules", moduleName);
105859
105892
  if (fs16.existsSync(userModulePath)) {
105860
- const userRequire = createRequire2(path16.join(process.cwd(), "noop.js"));
105893
+ const userRequire = createRequire3(path16.join(process.cwd(), "noop.js"));
105861
105894
  try {
105862
105895
  const resolvedUserPath = userRequire.resolve(moduleName);
105863
105896
  return await import(resolvedUserPath);
@@ -105867,7 +105900,7 @@ async function importFromUserLand(moduleName) {
105867
105900
  }
105868
105901
  }
105869
105902
  }
105870
- const cliRequire = createRequire2(import.meta.url);
105903
+ const cliRequire = createRequire3(import.meta.url);
105871
105904
  try {
105872
105905
  const resolvedCliPath = cliRequire.resolve(moduleName);
105873
105906
  return await import(resolvedCliPath);
@@ -222803,11 +222836,11 @@ registerImport(program2);
222803
222836
  registerConvert(program2);
222804
222837
  registerSimulate(program2);
222805
222838
  if (process.argv.includes("--version") || process.argv.includes("-v") || process.argv.includes("-V")) {
222806
- console.log(getVersion());
222839
+ console.log(getVersion({ verbose: process.argv.includes("--verbose") }));
222807
222840
  process.exit(0);
222808
222841
  }
222809
- program2.command("version").description("Print CLI version").action(() => {
222810
- console.log(getVersion());
222842
+ program2.command("version").description("Print CLI version").option("--verbose", "Print tscircuit + CLI dependency versions").action((options) => {
222843
+ console.log(getVersion({ verbose: options.verbose }));
222811
222844
  });
222812
222845
  if (process.argv.length === 2) {
222813
222846
  import_perfect_cli.perfectCli(program2, process.argv).catch((err) => {
package/dist/lib/index.js CHANGED
@@ -60445,7 +60445,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
60445
60445
  }));
60446
60446
  };
60447
60447
  // package.json
60448
- var version = "0.1.1107";
60448
+ var version = "0.1.1108";
60449
60449
  var package_default = {
60450
60450
  name: "@tscircuit/cli",
60451
60451
  version,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1108",
3
+ "version": "0.1.1109",
4
4
  "main": "dist/cli/main.js",
5
5
  "exports": {
6
6
  ".": "./dist/cli/main.js",