@tscircuit/cli 0.1.186 → 0.1.188

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 +48 -44
  2. package/package.json +5 -4
package/dist/main.js CHANGED
@@ -62951,7 +62951,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
62951
62951
  import { execSync as execSync2 } from "node:child_process";
62952
62952
  var import_semver2 = __toESM2(require_semver2(), 1);
62953
62953
  // package.json
62954
- var version = "0.1.185";
62954
+ var version = "0.1.187";
62955
62955
  var package_default = {
62956
62956
  name: "@tscircuit/cli",
62957
62957
  version,
@@ -62987,6 +62987,7 @@ var package_default = {
62987
62987
  "dsn-converter": "^0.0.63",
62988
62988
  "get-port": "^7.1.0",
62989
62989
  globby: "^14.1.0",
62990
+ "jscad-fiber": "^0.0.82",
62990
62991
  jsonwebtoken: "^9.0.2",
62991
62992
  "jwt-decode": "^4.0.0",
62992
62993
  kleur: "^4.1.5",
@@ -62997,7 +62998,7 @@ var package_default = {
62997
62998
  redaxios: "^0.5.1",
62998
62999
  semver: "^7.6.3",
62999
63000
  tempy: "^3.1.0",
63000
- tscircuit: "^0.0.555",
63001
+ tscircuit: "^0.0.559-libonly",
63001
63002
  tsx: "^4.7.1",
63002
63003
  "typed-ky": "^0.0.4",
63003
63004
  zod: "3"
@@ -63010,7 +63011,7 @@ var package_default = {
63010
63011
  },
63011
63012
  peerDependenciesMeta: {
63012
63013
  tscircuit: {
63013
- optional: true
63014
+ optional: false
63014
63015
  }
63015
63016
  },
63016
63017
  bin: {
@@ -63026,7 +63027,7 @@ var package_default = {
63026
63027
  setup: "bun run build && npm install -g .",
63027
63028
  build: "bun run build:bun",
63028
63029
  "build:bun": "bun run scripts/bun-build.ts",
63029
- smoketest: "docker build -f Dockerfile.smoketest .",
63030
+ smoketest: "docker build --progress=plain -f Dockerfile.smoketest .",
63030
63031
  format: "biome format --write .",
63031
63032
  "format:check": "biome format .",
63032
63033
  cli: "bun ./cli/main.ts",
@@ -69270,9 +69271,8 @@ var debug10 = Debug10("dsn-converter:parse-dsn-to-dsn-json");
69270
69271
 
69271
69272
  // lib/shared/generate-circuit-json.tsx
69272
69273
  var import_make_vfs2 = __toESM2(require_dist8(), 1);
69273
- import { RootCircuit } from "tscircuit";
69274
69274
  import path21 from "node:path/posix";
69275
- import { relative as relative6 } from "node:path";
69275
+ import { relative as relative7 } from "node:path";
69276
69276
  import fs21 from "node:fs";
69277
69277
  import Debug11 from "debug";
69278
69278
 
@@ -69290,6 +69290,23 @@ var abbreviateStringifyObject = (obj) => {
69290
69290
  })));
69291
69291
  };
69292
69292
 
69293
+ // lib/shared/importFromUserLand.ts
69294
+ import { resolve as resolve9 } from "node:path";
69295
+ async function importFromUserLand(moduleName) {
69296
+ try {
69297
+ const resolvedPath = import.meta.resolve(moduleName, resolve9(process.cwd(), "dummy.js"));
69298
+ return await import(resolvedPath);
69299
+ } catch (error) {
69300
+ try {
69301
+ const modulePath = await Bun.resolve(moduleName, process.cwd());
69302
+ return await import(modulePath);
69303
+ } catch (error2) {
69304
+ const module2 = await import(moduleName);
69305
+ return module2;
69306
+ }
69307
+ }
69308
+ }
69309
+
69293
69310
  // lib/shared/generate-circuit-json.tsx
69294
69311
  import { jsxDEV } from "react/jsx-dev-runtime";
69295
69312
  var debug11 = Debug11("tsci:generate-circuit-json");
@@ -69310,12 +69327,13 @@ async function generateCircuitJson({
69310
69327
  platformConfig
69311
69328
  }) {
69312
69329
  debug11(`Generating circuit JSON for ${filePath}`);
69313
- const runner = new RootCircuit({
69330
+ const userLandTscircuit = await importFromUserLand("tscircuit");
69331
+ const runner = new userLandTscircuit.RootCircuit({
69314
69332
  platform: platformConfig
69315
69333
  });
69316
69334
  const projectDir = path21.dirname(filePath);
69317
69335
  const resolvedOutputDir = outputDir || projectDir;
69318
- const relativeComponentPath = relative6(projectDir, filePath);
69336
+ const relativeComponentPath = relative7(projectDir, filePath);
69319
69337
  const baseFileName = outputFileName || path21.basename(filePath).replace(/\.[^.]+$/, "");
69320
69338
  const outputPath = path21.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
69321
69339
  debug11(`Project directory: ${projectDir}`);
@@ -69551,56 +69569,41 @@ var registerConfigSet = (program3) => {
69551
69569
  };
69552
69570
 
69553
69571
  // cli/search/register.ts
69554
- var import_prompts5 = __toESM2(require_prompts3(), 1);
69555
69572
  var registerSearch = (program3) => {
69556
69573
  program3.command("search").description("Search for packages in the tscircuit registry").argument("<query>", "Search query (e.g. keyword, author, or package name)").action(async (query) => {
69557
69574
  const ky2 = getRegistryApiKy();
69558
69575
  let results = { packages: [] };
69576
+ let jlcResults = [];
69559
69577
  try {
69560
69578
  results = await ky2.post("packages/search", {
69561
69579
  json: { query }
69562
69580
  }).json();
69581
+ const jlcSearchUrl = "https://jlcsearch.tscircuit.com/api/search?limit=10&q=" + encodeURIComponent(query);
69582
+ jlcResults = (await fetch(jlcSearchUrl).then((r) => r.json())).components;
69563
69583
  } catch (error) {
69564
69584
  console.error(kleur_default.red("Failed to search registry:"), error instanceof Error ? error.message : error);
69565
69585
  process.exit(1);
69566
69586
  }
69567
- if (!results.packages.length) {
69568
- console.log(kleur_default.yellow("No packages found matching your query."));
69587
+ if (!results.packages.length && !jlcResults.length) {
69588
+ console.log(kleur_default.yellow("No results found matching your query."));
69569
69589
  return;
69570
69590
  }
69571
- console.log(kleur_default.bold().underline(`Found ${results.packages.length} package(s):`));
69572
- const choices = results.packages.map((pkg) => ({
69573
- title: pkg.name,
69574
- description: pkg.description || "",
69575
- value: pkg.name
69576
- }));
69577
- const { selectedPackage } = await import_prompts5.default({
69578
- type: "select",
69579
- name: "selectedPackage",
69580
- message: "Select a package to add:",
69581
- choices,
69582
- initial: 0
69583
- });
69584
- if (!selectedPackage) {
69585
- console.log(kleur_default.yellow("No package selected."));
69586
- return;
69591
+ if (results.packages.length) {
69592
+ console.log(kleur_default.bold().underline(`Found ${results.packages.length} package(s) in the tscircuit registry:`));
69593
+ results.packages.forEach((pkg, idx) => {
69594
+ const star = pkg.star_count ?? 0;
69595
+ console.log(`${idx + 1}. ${pkg.name} (v${pkg.version}) - Stars: ${star}${pkg.description ? ` - ${pkg.description}` : ""}`);
69596
+ });
69587
69597
  }
69588
- const { confirm } = await import_prompts5.default({
69589
- type: "confirm",
69590
- name: "confirm",
69591
- message: `Do you want to add ${kleur_default.green(selectedPackage)}?`,
69592
- initial: true
69593
- });
69594
- if (confirm) {
69595
- try {
69596
- console.log(kleur_default.blue(`Installing ${selectedPackage}...`));
69597
- await addPackage(selectedPackage);
69598
- console.log(kleur_default.green(`Successfully installed ${selectedPackage}`));
69599
- } catch (error) {
69600
- console.error(kleur_default.red(`Failed to install ${selectedPackage}:`), error);
69601
- process.exit(1);
69602
- }
69598
+ if (jlcResults.length) {
69599
+ console.log();
69600
+ console.log(kleur_default.bold().underline(`Found ${jlcResults.length} component(s) in JLC search:`));
69601
+ jlcResults.forEach((comp, idx) => {
69602
+ console.log(`${idx + 1}. ${comp.mfr} (C${comp.lcsc}) - ${comp.description}`);
69603
+ });
69603
69604
  }
69605
+ console.log(`
69606
+ `);
69604
69607
  });
69605
69608
  };
69606
69609
 
@@ -69683,6 +69686,7 @@ var buildFile = async (input, output, projectDir, options) => {
69683
69686
  for (const err of errors) {
69684
69687
  const msg = err.message || JSON.stringify(err);
69685
69688
  console.error(kleur_default.red(msg));
69689
+ console.log(err.stack);
69686
69690
  }
69687
69691
  }
69688
69692
  if (errors.length > 0 && !options?.ignoreErrors) {
@@ -69739,8 +69743,8 @@ var registerBuild = (program3) => {
69739
69743
  fs25.mkdirSync(distDir, { recursive: true });
69740
69744
  let hasErrors = false;
69741
69745
  for (const filePath of circuitFiles) {
69742
- const relative7 = path25.relative(projectDir, filePath);
69743
- const outputDirName = relative7.replace(/(\.board|\.circuit)?\.tsx$/, "");
69746
+ const relative8 = path25.relative(projectDir, filePath);
69747
+ const outputDirName = relative8.replace(/(\.board|\.circuit)?\.tsx$/, "");
69744
69748
  const outputPath = path25.join(distDir, outputDirName, "circuit.json");
69745
69749
  const ok = await buildFile(filePath, outputPath, projectDir, options);
69746
69750
  if (!ok)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.186",
3
+ "version": "0.1.188",
4
4
  "main": "dist/main.js",
5
5
  "devDependencies": {
6
6
  "@babel/standalone": "^7.26.9",
@@ -33,6 +33,7 @@
33
33
  "dsn-converter": "^0.0.63",
34
34
  "get-port": "^7.1.0",
35
35
  "globby": "^14.1.0",
36
+ "jscad-fiber": "^0.0.82",
36
37
  "jsonwebtoken": "^9.0.2",
37
38
  "jwt-decode": "^4.0.0",
38
39
  "kleur": "^4.1.5",
@@ -43,7 +44,7 @@
43
44
  "redaxios": "^0.5.1",
44
45
  "semver": "^7.6.3",
45
46
  "tempy": "^3.1.0",
46
- "tscircuit": "^0.0.555",
47
+ "tscircuit": "^0.0.559-libonly",
47
48
  "tsx": "^4.7.1",
48
49
  "typed-ky": "^0.0.4",
49
50
  "zod": "3"
@@ -56,7 +57,7 @@
56
57
  },
57
58
  "peerDependenciesMeta": {
58
59
  "tscircuit": {
59
- "optional": true
60
+ "optional": false
60
61
  }
61
62
  },
62
63
  "bin": {
@@ -72,7 +73,7 @@
72
73
  "setup": "bun run build && npm install -g .",
73
74
  "build": "bun run build:bun",
74
75
  "build:bun": "bun run scripts/bun-build.ts",
75
- "smoketest": "docker build -f Dockerfile.smoketest .",
76
+ "smoketest": "docker build --progress=plain -f Dockerfile.smoketest .",
76
77
  "format": "biome format --write .",
77
78
  "format:check": "biome format .",
78
79
  "cli": "bun ./cli/main.ts",