@tscircuit/cli 0.1.799 → 0.1.800
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 +17 -10
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -74266,7 +74266,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
74266
74266
|
import { execSync as execSync2 } from "node:child_process";
|
|
74267
74267
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
74268
74268
|
// package.json
|
|
74269
|
-
var version = "0.1.
|
|
74269
|
+
var version = "0.1.799";
|
|
74270
74270
|
var package_default = {
|
|
74271
74271
|
name: "@tscircuit/cli",
|
|
74272
74272
|
version,
|
|
@@ -86895,29 +86895,36 @@ Fuse.config = Config;
|
|
|
86895
86895
|
|
|
86896
86896
|
// cli/search/register.ts
|
|
86897
86897
|
var registerSearch = (program3) => {
|
|
86898
|
-
program3.command("search").description("Search for footprints, CAD models or packages in the tscircuit ecosystem").argument("<query>", "Search query (e.g. keyword, author, or package name)").option("--kicad", "
|
|
86899
|
-
const
|
|
86898
|
+
program3.command("search").description("Search for footprints, CAD models or packages in the tscircuit ecosystem").argument("<query>", "Search query (e.g. keyword, author, or package name)").option("--kicad", "Search KiCad footprints").option("--jlcpcb", "Search JLCPCB components").option("--lcsc", "Alias for --jlcpcb").option("--tscircuit", "Search tscircuit registry packages").action(async (query, opts) => {
|
|
86899
|
+
const hasFilters = opts.kicad || opts.jlcpcb || opts.lcsc || opts.tscircuit;
|
|
86900
|
+
const searchKicad = opts.kicad || !hasFilters;
|
|
86901
|
+
const searchJlc = opts.jlcpcb || opts.lcsc || !hasFilters;
|
|
86902
|
+
const searchTscircuit = opts.tscircuit || !hasFilters;
|
|
86900
86903
|
let results = { packages: [] };
|
|
86901
86904
|
let jlcResults = [];
|
|
86902
86905
|
let kicadResults = [];
|
|
86903
86906
|
try {
|
|
86904
|
-
if (
|
|
86907
|
+
if (searchTscircuit) {
|
|
86905
86908
|
const ky2 = getRegistryApiKy();
|
|
86906
86909
|
results = await ky2.post("packages/search", {
|
|
86907
86910
|
json: { query }
|
|
86908
86911
|
}).json();
|
|
86912
|
+
}
|
|
86913
|
+
if (searchJlc) {
|
|
86909
86914
|
const jlcSearchUrl = "https://jlcsearch.tscircuit.com/api/search?limit=10&q=" + encodeURIComponent(query);
|
|
86910
86915
|
const jlcResponse = await fetch(jlcSearchUrl).then((r) => r.json());
|
|
86911
86916
|
jlcResults = jlcResponse?.components ?? [];
|
|
86912
86917
|
}
|
|
86913
|
-
|
|
86914
|
-
|
|
86915
|
-
|
|
86918
|
+
if (searchKicad) {
|
|
86919
|
+
const kicadFiles = await fetch("https://kicad-mod-cache.tscircuit.com/kicad_files.json").then((r) => r.json());
|
|
86920
|
+
const fuse = new Fuse(kicadFiles);
|
|
86921
|
+
kicadResults = fuse.search(query).slice(0, 10).map((r) => r.item);
|
|
86922
|
+
}
|
|
86916
86923
|
} catch (error) {
|
|
86917
86924
|
console.error(kleur_default.red("Failed to search registry:"), error instanceof Error ? error.message : error);
|
|
86918
86925
|
process.exit(1);
|
|
86919
86926
|
}
|
|
86920
|
-
if (!kicadResults.length &&
|
|
86927
|
+
if (!kicadResults.length && !results.packages.length && !jlcResults.length) {
|
|
86921
86928
|
console.log(kleur_default.yellow("No results found matching your query."));
|
|
86922
86929
|
return;
|
|
86923
86930
|
}
|
|
@@ -86927,7 +86934,7 @@ var registerSearch = (program3) => {
|
|
|
86927
86934
|
console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path35.replace(".kicad_mod", "").replace(".pretty", "")}`);
|
|
86928
86935
|
});
|
|
86929
86936
|
}
|
|
86930
|
-
if (
|
|
86937
|
+
if (results.packages.length) {
|
|
86931
86938
|
console.log(kleur_default.bold().underline(`Found ${results.packages.length} package(s) in the tscircuit registry:`));
|
|
86932
86939
|
results.packages.forEach((pkg, idx) => {
|
|
86933
86940
|
const star = pkg.star_count ?? 0;
|
|
@@ -86935,7 +86942,7 @@ var registerSearch = (program3) => {
|
|
|
86935
86942
|
console.log(`${idx + 1}. ${pkg.name}${versionStr} - Stars: ${star}${pkg.description ? ` - ${pkg.description}` : ""}`);
|
|
86936
86943
|
});
|
|
86937
86944
|
}
|
|
86938
|
-
if (
|
|
86945
|
+
if (jlcResults.length) {
|
|
86939
86946
|
console.log();
|
|
86940
86947
|
console.log(kleur_default.bold().underline(`Found ${jlcResults.length} component(s) in JLC search:`));
|
|
86941
86948
|
jlcResults.forEach((comp, idx) => {
|