@tscircuit/cli 0.1.1533 → 0.1.1534
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 +1 -1
- package/dist/cli/main.js +27 -16
- package/dist/lib/index.js +25 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ Commands:
|
|
|
45
45
|
build [options] [file] Run tscircuit eval and output circuit json
|
|
46
46
|
transpile [file] Transpile TypeScript/TSX to JavaScript (ESM,
|
|
47
47
|
CommonJS, and type declarations)
|
|
48
|
-
add <
|
|
48
|
+
add <packageSpecs...> Add tscircuit component packages to your project
|
|
49
49
|
remove <component> Remove a tscircuit component package from your
|
|
50
50
|
project
|
|
51
51
|
snapshot [options] [path] Generate schematic and PCB snapshots (add --3d
|
package/dist/cli/main.js
CHANGED
|
@@ -100768,7 +100768,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
|
|
|
100768
100768
|
// lib/getVersion.ts
|
|
100769
100769
|
import { createRequire as createRequire2 } from "node:module";
|
|
100770
100770
|
// package.json
|
|
100771
|
-
var version = "0.1.
|
|
100771
|
+
var version = "0.1.1533";
|
|
100772
100772
|
var package_default = {
|
|
100773
100773
|
name: "@tscircuit/cli",
|
|
100774
100774
|
version,
|
|
@@ -102001,11 +102001,18 @@ function normalizeTscircuitPackageName(packageSpec) {
|
|
|
102001
102001
|
return null;
|
|
102002
102002
|
}
|
|
102003
102003
|
async function addPackage(packageSpec, projectDir = process.cwd()) {
|
|
102004
|
-
|
|
102005
|
-
|
|
102006
|
-
|
|
102007
|
-
|
|
102008
|
-
|
|
102004
|
+
return addPackages([packageSpec], projectDir);
|
|
102005
|
+
}
|
|
102006
|
+
async function addPackages(packageSpecs, projectDir = process.cwd()) {
|
|
102007
|
+
const normalized = packageSpecs.map((spec) => ({
|
|
102008
|
+
original: spec,
|
|
102009
|
+
normalized: normalizeTscircuitPackageName(spec)
|
|
102010
|
+
}));
|
|
102011
|
+
const displayNames = normalized.map((p) => p.normalized || p.original).join(" ");
|
|
102012
|
+
console.log(kleur_default.cyan(`Adding ${kleur_default.bold(displayNames)}...`));
|
|
102013
|
+
const hasTsciPackage = normalized.some((p) => p.normalized?.startsWith("@tsci/"));
|
|
102014
|
+
let useTarball = false;
|
|
102015
|
+
if (hasTsciPackage) {
|
|
102009
102016
|
const npmrcPath = path8.join(projectDir, ".npmrc");
|
|
102010
102017
|
const npmrcContent = fs10.existsSync(npmrcPath) ? fs10.readFileSync(npmrcPath, "utf-8") : "";
|
|
102011
102018
|
let hasTsciRegistry = /@tsci[/:]/.test(npmrcContent);
|
|
@@ -102026,30 +102033,34 @@ async function addPackage(packageSpec, projectDir = process.cwd()) {
|
|
|
102026
102033
|
hasTsciRegistry = true;
|
|
102027
102034
|
} else {
|
|
102028
102035
|
console.log("Continuing without updating .npmrc; will fetch package directly from registry tarball.");
|
|
102036
|
+
useTarball = true;
|
|
102029
102037
|
}
|
|
102030
102038
|
}
|
|
102031
|
-
if (!hasTsciRegistry) {
|
|
102032
|
-
installTarget = await resolveTarballUrlFromRegistry(normalizedName);
|
|
102033
|
-
}
|
|
102034
102039
|
}
|
|
102040
|
+
const installTargets = await Promise.all(normalized.map(async ({ original, normalized: norm }) => {
|
|
102041
|
+
if (norm?.startsWith("@tsci/") && useTarball) {
|
|
102042
|
+
return resolveTarballUrlFromRegistry(norm);
|
|
102043
|
+
}
|
|
102044
|
+
return norm || original;
|
|
102045
|
+
}));
|
|
102035
102046
|
const packageManager = getPackageManager();
|
|
102036
102047
|
try {
|
|
102037
|
-
packageManager.install({ name:
|
|
102038
|
-
console.log(kleur_default.green(`✓ Added ${kleur_default.bold(
|
|
102039
|
-
await detectAndSetupKicadLibrary(
|
|
102048
|
+
packageManager.install({ name: installTargets.join(" "), cwd: projectDir });
|
|
102049
|
+
console.log(kleur_default.green(`✓ Added ${kleur_default.bold(displayNames)} successfully`));
|
|
102050
|
+
await Promise.all(packageSpecs.map((spec) => detectAndSetupKicadLibrary(spec, projectDir)));
|
|
102040
102051
|
} catch (error) {
|
|
102041
102052
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
102042
|
-
console.error(kleur_default.red(`✗ Failed to add ${
|
|
102053
|
+
console.error(kleur_default.red(`✗ Failed to add ${displayNames}:`), errorMessage);
|
|
102043
102054
|
handleRegistryAuthError({ error, projectDir });
|
|
102044
|
-
throw new Error(`Failed to add ${
|
|
102055
|
+
throw new Error(`Failed to add ${displayNames}: ${errorMessage}`);
|
|
102045
102056
|
}
|
|
102046
102057
|
}
|
|
102047
102058
|
|
|
102048
102059
|
// cli/add/register.ts
|
|
102049
102060
|
var registerAdd = (program2) => {
|
|
102050
|
-
program2.command("add").description("Add
|
|
102061
|
+
program2.command("add").description("Add tscircuit component packages to your project").argument("<packageSpecs...>", "Packages to add (e.g. package-name, author/component, https://github.com/user/repo, package@version)").action(async (packageSpecs) => {
|
|
102051
102062
|
try {
|
|
102052
|
-
await
|
|
102063
|
+
await addPackages(packageSpecs);
|
|
102053
102064
|
} catch (error) {
|
|
102054
102065
|
process.exit(1);
|
|
102055
102066
|
}
|
package/dist/lib/index.js
CHANGED
|
@@ -65365,7 +65365,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
|
|
|
65365
65365
|
}));
|
|
65366
65366
|
};
|
|
65367
65367
|
// package.json
|
|
65368
|
-
var version = "0.1.
|
|
65368
|
+
var version = "0.1.1533";
|
|
65369
65369
|
var package_default = {
|
|
65370
65370
|
name: "@tscircuit/cli",
|
|
65371
65371
|
version,
|
|
@@ -79100,11 +79100,18 @@ function normalizeTscircuitPackageName(packageSpec) {
|
|
|
79100
79100
|
return null;
|
|
79101
79101
|
}
|
|
79102
79102
|
async function addPackage(packageSpec, projectDir = process.cwd()) {
|
|
79103
|
-
|
|
79104
|
-
|
|
79105
|
-
|
|
79106
|
-
|
|
79107
|
-
|
|
79103
|
+
return addPackages([packageSpec], projectDir);
|
|
79104
|
+
}
|
|
79105
|
+
async function addPackages(packageSpecs, projectDir = process.cwd()) {
|
|
79106
|
+
const normalized = packageSpecs.map((spec) => ({
|
|
79107
|
+
original: spec,
|
|
79108
|
+
normalized: normalizeTscircuitPackageName(spec)
|
|
79109
|
+
}));
|
|
79110
|
+
const displayNames = normalized.map((p) => p.normalized || p.original).join(" ");
|
|
79111
|
+
console.log(kleur_default.cyan(`Adding ${kleur_default.bold(displayNames)}...`));
|
|
79112
|
+
const hasTsciPackage = normalized.some((p) => p.normalized?.startsWith("@tsci/"));
|
|
79113
|
+
let useTarball = false;
|
|
79114
|
+
if (hasTsciPackage) {
|
|
79108
79115
|
const npmrcPath = path21.join(projectDir, ".npmrc");
|
|
79109
79116
|
const npmrcContent = fs22.existsSync(npmrcPath) ? fs22.readFileSync(npmrcPath, "utf-8") : "";
|
|
79110
79117
|
let hasTsciRegistry = /@tsci[/:]/.test(npmrcContent);
|
|
@@ -79125,22 +79132,26 @@ async function addPackage(packageSpec, projectDir = process.cwd()) {
|
|
|
79125
79132
|
hasTsciRegistry = true;
|
|
79126
79133
|
} else {
|
|
79127
79134
|
console.log("Continuing without updating .npmrc; will fetch package directly from registry tarball.");
|
|
79135
|
+
useTarball = true;
|
|
79128
79136
|
}
|
|
79129
79137
|
}
|
|
79130
|
-
if (!hasTsciRegistry) {
|
|
79131
|
-
installTarget = await resolveTarballUrlFromRegistry(normalizedName);
|
|
79132
|
-
}
|
|
79133
79138
|
}
|
|
79139
|
+
const installTargets = await Promise.all(normalized.map(async ({ original, normalized: norm }) => {
|
|
79140
|
+
if (norm?.startsWith("@tsci/") && useTarball) {
|
|
79141
|
+
return resolveTarballUrlFromRegistry(norm);
|
|
79142
|
+
}
|
|
79143
|
+
return norm || original;
|
|
79144
|
+
}));
|
|
79134
79145
|
const packageManager = getPackageManager();
|
|
79135
79146
|
try {
|
|
79136
|
-
packageManager.install({ name:
|
|
79137
|
-
console.log(kleur_default.green(`✓ Added ${kleur_default.bold(
|
|
79138
|
-
await detectAndSetupKicadLibrary(
|
|
79147
|
+
packageManager.install({ name: installTargets.join(" "), cwd: projectDir });
|
|
79148
|
+
console.log(kleur_default.green(`✓ Added ${kleur_default.bold(displayNames)} successfully`));
|
|
79149
|
+
await Promise.all(packageSpecs.map((spec) => detectAndSetupKicadLibrary(spec, projectDir)));
|
|
79139
79150
|
} catch (error) {
|
|
79140
79151
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
79141
|
-
console.error(kleur_default.red(`✗ Failed to add ${
|
|
79152
|
+
console.error(kleur_default.red(`✗ Failed to add ${displayNames}:`), errorMessage);
|
|
79142
79153
|
handleRegistryAuthError({ error, projectDir });
|
|
79143
|
-
throw new Error(`Failed to add ${
|
|
79154
|
+
throw new Error(`Failed to add ${displayNames}: ${errorMessage}`);
|
|
79144
79155
|
}
|
|
79145
79156
|
}
|
|
79146
79157
|
|