@tscircuit/cli 0.1.207 → 0.1.208
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/README.md +2 -1
- package/dist/main.js +14 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,7 +58,8 @@ Commands:
|
|
|
58
58
|
3d preview)
|
|
59
59
|
setup Setup utilities like GitHub Actions
|
|
60
60
|
upgrade Upgrade CLI to the latest version
|
|
61
|
-
search <query> Search for footprints, CAD models or packages
|
|
61
|
+
search <query> Search for footprints, CAD models or packages in
|
|
62
|
+
the tscircuit ecosystem
|
|
62
63
|
import <query> Search JLCPCB or the tscircuit registry and import
|
|
63
64
|
a component
|
|
64
65
|
convert [options] <file> Convert a .kicad_mod footprint to a tscircuit
|
package/dist/main.js
CHANGED
|
@@ -62957,7 +62957,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
62957
62957
|
import { execSync as execSync2 } from "node:child_process";
|
|
62958
62958
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
62959
62959
|
// package.json
|
|
62960
|
-
var version = "0.1.
|
|
62960
|
+
var version = "0.1.207";
|
|
62961
62961
|
var package_default = {
|
|
62962
62962
|
name: "@tscircuit/cli",
|
|
62963
62963
|
version,
|
|
@@ -70873,17 +70873,20 @@ Fuse.config = Config;
|
|
|
70873
70873
|
|
|
70874
70874
|
// cli/search/register.ts
|
|
70875
70875
|
var registerSearch = (program3) => {
|
|
70876
|
-
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)").action(async (query) => {
|
|
70877
|
-
const
|
|
70876
|
+
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", "Only search KiCad footprints").action(async (query, opts) => {
|
|
70877
|
+
const onlyKicad = opts.kicad;
|
|
70878
70878
|
let results = { packages: [] };
|
|
70879
70879
|
let jlcResults = [];
|
|
70880
70880
|
let kicadResults = [];
|
|
70881
70881
|
try {
|
|
70882
|
-
|
|
70883
|
-
|
|
70884
|
-
|
|
70885
|
-
|
|
70886
|
-
|
|
70882
|
+
if (!onlyKicad) {
|
|
70883
|
+
const ky2 = getRegistryApiKy();
|
|
70884
|
+
results = await ky2.post("packages/search", {
|
|
70885
|
+
json: { query }
|
|
70886
|
+
}).json();
|
|
70887
|
+
const jlcSearchUrl = "https://jlcsearch.tscircuit.com/api/search?limit=10&q=" + encodeURIComponent(query);
|
|
70888
|
+
jlcResults = (await fetch(jlcSearchUrl).then((r) => r.json())).components;
|
|
70889
|
+
}
|
|
70887
70890
|
const kicadFiles = await fetch("https://kicad-mod-cache.tscircuit.com/kicad_files.json").then((r) => r.json());
|
|
70888
70891
|
const fuse = new Fuse(kicadFiles);
|
|
70889
70892
|
kicadResults = fuse.search(query).slice(0, 10).map((r) => r.item);
|
|
@@ -70891,7 +70894,7 @@ var registerSearch = (program3) => {
|
|
|
70891
70894
|
console.error(kleur_default.red("Failed to search registry:"), error instanceof Error ? error.message : error);
|
|
70892
70895
|
process.exit(1);
|
|
70893
70896
|
}
|
|
70894
|
-
if (!results.packages.length && !jlcResults.length
|
|
70897
|
+
if (!kicadResults.length && (!results.packages.length && !jlcResults.length || onlyKicad)) {
|
|
70895
70898
|
console.log(kleur_default.yellow("No results found matching your query."));
|
|
70896
70899
|
return;
|
|
70897
70900
|
}
|
|
@@ -70901,14 +70904,14 @@ var registerSearch = (program3) => {
|
|
|
70901
70904
|
console.log(`${(idx + 1).toString().padStart(2, " ")}. ${path23.replace(".kicad_mod", "").replace(".pretty", "")}`);
|
|
70902
70905
|
});
|
|
70903
70906
|
}
|
|
70904
|
-
if (results.packages.length) {
|
|
70907
|
+
if (!onlyKicad && results.packages.length) {
|
|
70905
70908
|
console.log(kleur_default.bold().underline(`Found ${results.packages.length} package(s) in the tscircuit registry:`));
|
|
70906
70909
|
results.packages.forEach((pkg, idx) => {
|
|
70907
70910
|
const star = pkg.star_count ?? 0;
|
|
70908
70911
|
console.log(`${idx + 1}. ${pkg.name} (v${pkg.version}) - Stars: ${star}${pkg.description ? ` - ${pkg.description}` : ""}`);
|
|
70909
70912
|
});
|
|
70910
70913
|
}
|
|
70911
|
-
if (jlcResults.length) {
|
|
70914
|
+
if (!onlyKicad && jlcResults.length) {
|
|
70912
70915
|
console.log();
|
|
70913
70916
|
console.log(kleur_default.bold().underline(`Found ${jlcResults.length} component(s) in JLC search:`));
|
|
70914
70917
|
jlcResults.forEach((comp, idx) => {
|