@tscircuit/cli 0.1.554 → 0.1.556
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 +7 -3
- package/dist/main.js +31 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,20 +43,24 @@ Commands:
|
|
|
43
43
|
specified directory (or current directory if none
|
|
44
44
|
is provided)
|
|
45
45
|
dev [options] [file] Start development server for a package
|
|
46
|
-
clone [options]
|
|
47
|
-
push [options] [file] Save
|
|
46
|
+
clone [options] [package] Clone a package from the registry
|
|
47
|
+
push [options] [file] Save package code to Registry API
|
|
48
48
|
auth Login/logout
|
|
49
49
|
login Login to tscircuit registry
|
|
50
50
|
logout Logout from tscircuit registry
|
|
51
51
|
config Manage tscircuit CLI configuration
|
|
52
52
|
export [options] <file> Export tscircuit code to various formats
|
|
53
53
|
build [options] [file] Run tscircuit eval and output circuit json
|
|
54
|
+
transpile [file] Transpile TypeScript/TSX to JavaScript (ESM,
|
|
55
|
+
CommonJS, and type declarations)
|
|
54
56
|
add <component> Add a tscircuit component package to your project
|
|
55
57
|
remove <component> Remove a tscircuit component package from your
|
|
56
58
|
project
|
|
57
59
|
snapshot [options] [path] Generate schematic and PCB snapshots (add --3d for
|
|
58
60
|
3d preview)
|
|
59
61
|
setup Setup utilities like GitHub Actions
|
|
62
|
+
install Install project dependencies and generate
|
|
63
|
+
package.json if needed
|
|
60
64
|
upgrade Upgrade CLI to the latest version
|
|
61
65
|
search [options] <query> Search for footprints, CAD models or packages in
|
|
62
66
|
the tscircuit ecosystem
|
|
@@ -104,4 +108,4 @@ runframe each time you'd like to load a new version of runframe.
|
|
|
104
108
|
export RUNFRAME_STANDALONE_FILE_PATH=../runframe/dist/standalone.min.js
|
|
105
109
|
cd ../runframe && bun run build
|
|
106
110
|
cd ../cli && bun run dev
|
|
107
|
-
```
|
|
111
|
+
```
|
package/dist/main.js
CHANGED
|
@@ -72387,7 +72387,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
72387
72387
|
import { execSync as execSync2 } from "node:child_process";
|
|
72388
72388
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
72389
72389
|
// package.json
|
|
72390
|
-
var version = "0.1.
|
|
72390
|
+
var version = "0.1.555";
|
|
72391
72391
|
var package_default = {
|
|
72392
72392
|
name: "@tscircuit/cli",
|
|
72393
72393
|
version,
|
|
@@ -77036,25 +77036,32 @@ async function resolveTarballUrlFromRegistry(packageName) {
|
|
|
77036
77036
|
}
|
|
77037
77037
|
|
|
77038
77038
|
// lib/shared/add-package.ts
|
|
77039
|
-
function
|
|
77040
|
-
if (
|
|
77041
|
-
return
|
|
77042
|
-
}
|
|
77043
|
-
|
|
77044
|
-
|
|
77045
|
-
|
|
77046
|
-
|
|
77047
|
-
|
|
77048
|
-
|
|
77039
|
+
function normalizeTscircuitPackageName(packageSpec) {
|
|
77040
|
+
if (packageSpec.startsWith("@tscircuit/") || packageSpec.startsWith("@tsci/")) {
|
|
77041
|
+
return packageSpec;
|
|
77042
|
+
}
|
|
77043
|
+
if (packageSpec.startsWith("http://") || packageSpec.startsWith("https://") || packageSpec.startsWith("git+") || packageSpec.startsWith("git://")) {
|
|
77044
|
+
return null;
|
|
77045
|
+
}
|
|
77046
|
+
if (packageSpec.includes("@") && !packageSpec.startsWith("@")) {
|
|
77047
|
+
return null;
|
|
77048
|
+
}
|
|
77049
|
+
if (packageSpec.startsWith("@") && !packageSpec.startsWith("@tsci/") && !packageSpec.startsWith("@tscircuit/")) {
|
|
77050
|
+
return null;
|
|
77051
|
+
}
|
|
77052
|
+
const match = packageSpec.match(/^([^/.@]+)[/.]([^/.@]+)$/);
|
|
77053
|
+
if (match) {
|
|
77049
77054
|
const [, author, componentName] = match;
|
|
77050
77055
|
return `@tsci/${author}.${componentName}`;
|
|
77051
77056
|
}
|
|
77057
|
+
return null;
|
|
77052
77058
|
}
|
|
77053
|
-
async function addPackage(
|
|
77054
|
-
const
|
|
77055
|
-
|
|
77056
|
-
let installTarget =
|
|
77057
|
-
|
|
77059
|
+
async function addPackage(packageSpec, projectDir = process.cwd()) {
|
|
77060
|
+
const normalizedName = normalizeTscircuitPackageName(packageSpec);
|
|
77061
|
+
const displayName = normalizedName || packageSpec;
|
|
77062
|
+
let installTarget = normalizedName || packageSpec;
|
|
77063
|
+
console.log(`Adding ${displayName}...`);
|
|
77064
|
+
if (normalizedName && normalizedName.startsWith("@tsci/")) {
|
|
77058
77065
|
const npmrcPath = path17.join(projectDir, ".npmrc");
|
|
77059
77066
|
const npmrcContent = fs17.existsSync(npmrcPath) ? fs17.readFileSync(npmrcPath, "utf-8") : "";
|
|
77060
77067
|
let hasTsciRegistry = /@tsci[/:]/.test(npmrcContent);
|
|
@@ -77078,17 +77085,17 @@ async function addPackage(componentPath, projectDir = process.cwd()) {
|
|
|
77078
77085
|
}
|
|
77079
77086
|
}
|
|
77080
77087
|
if (!hasTsciRegistry) {
|
|
77081
|
-
installTarget = await resolveTarballUrlFromRegistry(
|
|
77088
|
+
installTarget = await resolveTarballUrlFromRegistry(normalizedName);
|
|
77082
77089
|
}
|
|
77083
77090
|
}
|
|
77084
77091
|
const packageManager = getPackageManager();
|
|
77085
77092
|
try {
|
|
77086
77093
|
packageManager.install({ name: installTarget, cwd: projectDir });
|
|
77087
|
-
console.log(`Added ${
|
|
77094
|
+
console.log(`Added ${displayName} successfully.`);
|
|
77088
77095
|
} catch (error) {
|
|
77089
77096
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
77090
|
-
console.error(`Failed to add ${
|
|
77091
|
-
throw new Error(`Failed to add ${
|
|
77097
|
+
console.error(`Failed to add ${displayName}:`, errorMessage);
|
|
77098
|
+
throw new Error(`Failed to add ${displayName}: ${errorMessage}`);
|
|
77092
77099
|
}
|
|
77093
77100
|
}
|
|
77094
77101
|
|
|
@@ -95044,9 +95051,9 @@ var registerPush = (program3) => {
|
|
|
95044
95051
|
|
|
95045
95052
|
// cli/add/register.ts
|
|
95046
95053
|
var registerAdd = (program3) => {
|
|
95047
|
-
program3.command("add").description("Add a tscircuit component package to your project").argument("<
|
|
95054
|
+
program3.command("add").description("Add a tscircuit component package to your project").argument("<packageSpec>", "Package to add (e.g. package-name, author/component, https://github.com/user/repo, package@version)").action(async (packageSpec) => {
|
|
95048
95055
|
try {
|
|
95049
|
-
await addPackage(
|
|
95056
|
+
await addPackage(packageSpec);
|
|
95050
95057
|
} catch (error) {
|
|
95051
95058
|
process.exit(1);
|
|
95052
95059
|
}
|
|
@@ -196251,7 +196258,8 @@ var registerImport = (program3) => {
|
|
|
196251
196258
|
|
|
196252
196259
|
// lib/shared/remove-package.ts
|
|
196253
196260
|
async function removePackage(componentPath, projectDir = process.cwd()) {
|
|
196254
|
-
const
|
|
196261
|
+
const normalizedName = normalizeTscircuitPackageName(componentPath);
|
|
196262
|
+
const packageName = normalizedName || componentPath;
|
|
196255
196263
|
console.log(`Removing ${packageName}...`);
|
|
196256
196264
|
const packageManager = getPackageManager();
|
|
196257
196265
|
try {
|