@tscircuit/cli 0.0.20 → 0.0.22

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/cli.js CHANGED
@@ -208,36 +208,36 @@ import {perfectCli} from "perfect-cli";
208
208
  import {Command} from "commander";
209
209
 
210
210
  // lib/cmd-fns/config-reveal-location.ts
211
- var configRevealLocation = async (ctx, args2) => {
211
+ var configRevealLocation = async (ctx, args) => {
212
212
  console.log(`tsci config path: ${ctx.global_config.path}`);
213
213
  };
214
214
  // lib/cmd-fns/config-set-registry.ts
215
215
  import {z} from "zod";
216
- var configSetRegistry = async (ctx, args2) => {
217
- const params = z.object({ server: z.string().url() }).parse(args2);
216
+ var configSetRegistry = async (ctx, args) => {
217
+ const params = z.object({ server: z.string().url() }).parse(args);
218
218
  ctx.profile_config.clear();
219
219
  ctx.profile_config.set("registry_url", params.server);
220
220
  };
221
221
  // lib/cmd-fns/config-set-session.ts
222
222
  import {z as z2} from "zod";
223
- var configSetSession = async (ctx, args2) => {
224
- const params = z2.object({ sessionToken: z2.string() }).parse(args2);
223
+ var configSetSession = async (ctx, args) => {
224
+ const params = z2.object({ sessionToken: z2.string() }).parse(args);
225
225
  ctx.profile_config.set("session_token", params.sessionToken);
226
226
  };
227
227
  // lib/cmd-fns/config-set-log-requests.ts
228
228
  import {z as z3} from "zod";
229
- var configSetLogRequests = async (ctx, args2) => {
230
- const params = z3.object({ logRequests: z3.boolean() }).parse(args2);
229
+ var configSetLogRequests = async (ctx, args) => {
230
+ const params = z3.object({ logRequests: z3.boolean() }).parse(args);
231
231
  ctx.global_config.set("log_requests", params.logRequests);
232
232
  };
233
233
  // lib/cmd-fns/config-print-config.ts
234
234
  import {readFile} from "fs/promises";
235
- var configPrintConfig = async (ctx, args2) => {
235
+ var configPrintConfig = async (ctx, args) => {
236
236
  console.log((await readFile(ctx.global_config.path)).toString());
237
237
  };
238
238
  // lib/cmd-fns/auth-login.ts
239
239
  import delay from "delay";
240
- var authLogin = async (ctx, args2) => {
240
+ var authLogin = async (ctx, args) => {
241
241
  const {
242
242
  data: { login_page }
243
243
  } = await ctx.axios.post("/sessions/login_page/create", {});
@@ -276,22 +276,22 @@ var authLogin = async (ctx, args2) => {
276
276
  };
277
277
  // lib/cmd-fns/auth-logout.ts
278
278
  import kleur from "kleur";
279
- var authLogout = async (ctx, args2) => {
279
+ var authLogout = async (ctx, args) => {
280
280
  ctx.profile_config.delete("session_token");
281
281
  console.log(kleur.green("Logged out!"));
282
282
  };
283
283
  // lib/cmd-fns/auth-sessions-create.ts
284
- var authSessionsCreate = async (ctx, args2) => {
284
+ var authSessionsCreate = async (ctx, args) => {
285
285
  };
286
286
  // lib/cmd-fns/auth-sessions-list.ts
287
- var authSessionsList = async (ctx, args2) => {
287
+ var authSessionsList = async (ctx, args) => {
288
288
  await ctx.axios.get("/sessions/list");
289
289
  };
290
290
  // lib/cmd-fns/auth-sessions-get.ts
291
- var authSessionsGet = async (ctx, args2) => {
291
+ var authSessionsGet = async (ctx, args) => {
292
292
  };
293
293
  // lib/cmd-fns/packages-list.ts
294
- var packagesList = async (ctx, args2) => {
294
+ var packagesList = async (ctx, args) => {
295
295
  const {
296
296
  data: { packages }
297
297
  } = await ctx.axios.post("/packages/list", {});
@@ -306,9 +306,9 @@ var packagesList = async (ctx, args2) => {
306
306
  };
307
307
  // lib/cmd-fns/packages-get.ts
308
308
  import {z as z4} from "zod";
309
- var packagesGet = async (ctx, args2) => {
310
- args2.packageId = args2.package_id;
311
- const params = z4.object({ package_id: z4.string() }).or(z4.object({ name: z4.string() })).parse(args2);
309
+ var packagesGet = async (ctx, args) => {
310
+ args.packageId = args.package_id;
311
+ const params = z4.object({ package_id: z4.string() }).or(z4.object({ name: z4.string() })).parse(args);
312
312
  const {
313
313
  data: { package: pkg }
314
314
  } = await ctx.axios.post("/packages/get", params);
@@ -316,25 +316,25 @@ var packagesGet = async (ctx, args2) => {
316
316
  };
317
317
  // lib/cmd-fns/packages-create.ts
318
318
  import {z as z5} from "zod";
319
- var packagesCreate = async (ctx, args2) => {
319
+ var packagesCreate = async (ctx, args) => {
320
320
  const params = z5.object({
321
321
  name: z5.string(),
322
322
  description: z5.string().optional(),
323
323
  authorAccountId: z5.string().optional()
324
- }).parse(args2);
324
+ }).parse(args);
325
325
  await ctx.axios.post("/packages/create", params);
326
326
  console.log(`Package "${params.name}" created!`);
327
327
  };
328
328
  // lib/cmd-fns/package-files-upload-directory.ts
329
- var packageFilesUploadDirectory = async (ctx, args2) => {
329
+ var packageFilesUploadDirectory = async (ctx, args) => {
330
330
  };
331
331
  // lib/cmd-fns/package-releases-list.ts
332
332
  import {z as z6} from "zod";
333
- var packageReleasesList = async (ctx, args2) => {
333
+ var packageReleasesList = async (ctx, args) => {
334
334
  const params = z6.object({
335
335
  packageName: z6.string().optional(),
336
336
  verbose: z6.boolean().optional()
337
- }).parse(args2);
337
+ }).parse(args);
338
338
  const package_releases = await ctx.axios.post("/package_releases/list", {
339
339
  package_name: params.packageName
340
340
  }).then((r) => r.data.package_releases);
@@ -349,13 +349,13 @@ var packageReleasesList = async (ctx, args2) => {
349
349
  }
350
350
  };
351
351
  // lib/cmd-fns/package-releases-get.ts
352
- var packageReleasesGet = async (ctx, args2) => {
352
+ var packageReleasesGet = async (ctx, args) => {
353
353
  };
354
354
  // lib/cmd-fns/package-releases-create.ts
355
355
  import {z as z7} from "zod";
356
356
  import kleur2 from "kleur";
357
- var packageReleasesCreate = async (ctx, args2) => {
358
- args2.version = args2.releaseVersion;
357
+ var packageReleasesCreate = async (ctx, args) => {
358
+ args.version = args.releaseVersion;
359
359
  const params = z7.object({
360
360
  packageNameWithVersion: z7.string().optional(),
361
361
  packageName: z7.string().optional(),
@@ -366,7 +366,7 @@ var packageReleasesCreate = async (ctx, args2) => {
366
366
  if (d.packageName && d.version)
367
367
  return true;
368
368
  return false;
369
- }, "Either packageNameWithVersion or packageName and version must be provided").parse(args2);
369
+ }, "Either packageNameWithVersion or packageName and version must be provided").parse(args);
370
370
  let { packageNameWithVersion, packageName, version } = params;
371
371
  if (!packageNameWithVersion) {
372
372
  packageNameWithVersion = `${packageName}@${version}`;
@@ -378,7 +378,7 @@ var packageReleasesCreate = async (ctx, args2) => {
378
378
  };
379
379
  // lib/cmd-fns/package-releases-update.ts
380
380
  import {z as z8} from "zod";
381
- var packageReleasesUpdate = async (ctx, args2) => {
381
+ var packageReleasesUpdate = async (ctx, args) => {
382
382
  const params = z8.object({
383
383
  packageNameWithVersion: z8.string().optional(),
384
384
  packageName: z8.string().optional(),
@@ -391,7 +391,7 @@ var packageReleasesUpdate = async (ctx, args2) => {
391
391
  if (d.packageName && d.version)
392
392
  return true;
393
393
  return false;
394
- }, "Either packageNameWithVersion or packageName and version must be provided").parse(args2);
394
+ }, "Either packageNameWithVersion or packageName and version must be provided").parse(args);
395
395
  let { packageNameWithVersion, packageName, version } = params;
396
396
  if (!packageNameWithVersion) {
397
397
  packageNameWithVersion = `${packageName}@${version}`;
@@ -411,13 +411,13 @@ var packageReleasesUpdate = async (ctx, args2) => {
411
411
  };
412
412
  // lib/cmd-fns/package-files-list.ts
413
413
  import {z as z9} from "zod";
414
- var packageFilesList = async (ctx, args2) => {
414
+ var packageFilesList = async (ctx, args) => {
415
415
  const params = z9.object({
416
416
  packageReleaseId: z9.string().optional(),
417
417
  packageName: z9.string().optional(),
418
418
  packageNameWithVersion: z9.string().optional(),
419
419
  verbose: z9.boolean().optional()
420
- }).parse(args2);
420
+ }).parse(args);
421
421
  const package_files = await ctx.axios.post("/package_files/list", {
422
422
  package_release_id: params.packageReleaseId,
423
423
  package_name: params.packageName,
@@ -431,17 +431,17 @@ var packageFilesList = async (ctx, args2) => {
431
431
  }
432
432
  };
433
433
  // lib/cmd-fns/package-files-get.ts
434
- var packageFilesGet = async (ctx, args2) => {
434
+ var packageFilesGet = async (ctx, args) => {
435
435
  };
436
436
  // lib/cmd-fns/package-files-download.ts
437
437
  import {z as z10} from "zod";
438
438
  import * as fs from "fs/promises";
439
- var packageFilesDownload = async (ctx, args2) => {
439
+ var packageFilesDownload = async (ctx, args) => {
440
440
  const params = z10.object({
441
441
  packageNameWithVersion: z10.string().optional(),
442
442
  remoteFilePath: z10.string().optional(),
443
443
  output: z10.string().optional()
444
- }).parse(args2);
444
+ }).parse(args);
445
445
  const { packageNameWithVersion, remoteFilePath } = params;
446
446
  const packageContent = await ctx.axios.post("/package_files/download", {
447
447
  package_name_with_version: packageNameWithVersion,
@@ -458,12 +458,12 @@ var packageFilesDownload = async (ctx, args2) => {
458
458
  import {z as z11} from "zod";
459
459
  import * as fs2 from "fs/promises";
460
460
  import kleur3 from "kleur";
461
- var packageFilesCreate = async (ctx, args2) => {
461
+ var packageFilesCreate = async (ctx, args) => {
462
462
  const params = z11.object({
463
463
  file: z11.string(),
464
464
  packageReleaseId: z11.string().optional(),
465
465
  packageNameWithVersion: z11.string().optional()
466
- }).parse(args2);
466
+ }).parse(args);
467
467
  const { file, packageNameWithVersion, packageReleaseId } = params;
468
468
  const fileContent = await fs2.readFile(file);
469
469
  const package_file = await ctx.axios.post("/package_files/create", {
@@ -476,10 +476,10 @@ var packageFilesCreate = async (ctx, args2) => {
476
476
  };
477
477
  // lib/cmd-fns/package-examples-list.ts
478
478
  import {z as z12} from "zod";
479
- var packageExamplesList = async (ctx, args2) => {
479
+ var packageExamplesList = async (ctx, args) => {
480
480
  const params = z12.object({
481
481
  packageNameWithVersion: z12.string()
482
- }).parse(args2);
482
+ }).parse(args);
483
483
  const package_examples = await ctx.axios.post("/package_examples/list", {
484
484
  package_name_with_version: params.packageNameWithVersion
485
485
  }).then((r) => r.data.package_examples);
@@ -487,10 +487,10 @@ var packageExamplesList = async (ctx, args2) => {
487
487
  };
488
488
  // lib/cmd-fns/package-examples-get.ts
489
489
  import {z as z13} from "zod";
490
- var packageExamplesGet = async (ctx, args2) => {
490
+ var packageExamplesGet = async (ctx, args) => {
491
491
  const params = z13.object({
492
492
  packageExampleId: z13.string().uuid()
493
- }).parse(args2);
493
+ }).parse(args);
494
494
  const { packageExampleId: package_example_id } = params;
495
495
  const package_example = await ctx.axios.post("/package_examples/get", {
496
496
  package_example_id
@@ -550,12 +550,12 @@ console.log(JSON.stringify(elements))
550
550
  // lib/cmd-fns/package-examples-create.ts
551
551
  import {z as z14} from "zod";
552
552
  import fs3 from "fs";
553
- var packageExamplesCreate = async (ctx, args2) => {
553
+ var packageExamplesCreate = async (ctx, args) => {
554
554
  const params = z14.object({
555
555
  packageNameWithVersion: z14.string(),
556
556
  file: z14.string(),
557
557
  export: z14.string().optional().default("default")
558
- }).parse(args2);
558
+ }).parse(args);
559
559
  const tscircuit_soup = await soupify({
560
560
  filePath: params.file,
561
561
  exportName: params.export
@@ -647,18 +647,24 @@ import $2 from "dax-sh";
647
647
  import semver from "semver";
648
648
  import {unlink as unlink2} from "fs/promises";
649
649
  import esbuild from "esbuild";
650
- var publish = async (ctx, args2) => {
650
+ var publish = async (ctx, args) => {
651
651
  const params = z15.object({
652
652
  increment: z15.boolean().optional(),
653
653
  patch: z15.boolean().optional(),
654
654
  lock: z15.boolean().optional()
655
- }).parse(args2);
655
+ }).parse(args);
656
656
  const shouldIncrement = params.increment || params.patch;
657
657
  if (!existsSync(Path2.join(ctx.cwd, "package.json"))) {
658
658
  console.log(kleur4.red("No package.json found in current directory"));
659
659
  process.exit(1);
660
660
  }
661
661
  const packageJson = JSON.parse(await readFileSync(Path2.join(ctx.cwd, "package.json"), "utf-8"));
662
+ if (!packageJson.version) {
663
+ console.log(kleur4.yellow("No version found in package.json"));
664
+ console.log(kleur4.green("Setting package.json version to 0.0.1"));
665
+ packageJson.version = "0.0.1";
666
+ await fs5.writeFile(Path2.join(ctx.cwd, "package.json"), JSON.stringify(packageJson, null, 2));
667
+ }
662
668
  await esbuild.build({
663
669
  entryPoints: ["index.ts"],
664
670
  bundle: true,
@@ -799,12 +805,12 @@ var publish = async (ctx, args2) => {
799
805
  // lib/cmd-fns/soupify.ts
800
806
  import {z as z16} from "zod";
801
807
  import {writeFileSync as writeFileSync2} from "fs";
802
- var soupifyCmd = async (ctx, args2) => {
808
+ var soupifyCmd = async (ctx, args) => {
803
809
  const params = z16.object({
804
810
  file: z16.string(),
805
811
  export: z16.string().optional(),
806
812
  output: z16.string().optional()
807
- }).parse(args2);
813
+ }).parse(args);
808
814
  const soup = await soupify({
809
815
  filePath: params.file,
810
816
  exportName: params.export
@@ -1308,12 +1314,12 @@ var getGeneratedTsconfig = () => `
1308
1314
  `.trim();
1309
1315
 
1310
1316
  // lib/cmd-fns/init/index.ts
1311
- var initCmd = async (ctx, args2) => {
1317
+ var initCmd = async (ctx, args) => {
1312
1318
  const params = z18.object({
1313
1319
  name: z18.string().optional(),
1314
1320
  dir: z18.string().optional(),
1315
1321
  runtime: z18.enum(["bun", "node"]).optional()
1316
- }).parse(args2);
1322
+ }).parse(args);
1317
1323
  if (params.name && !params.dir) {
1318
1324
  params.dir = `./${params.name.split("/").pop()}`;
1319
1325
  } else if (!params.dir) {
@@ -1394,11 +1400,11 @@ export const MyExample = () => (
1394
1400
  };
1395
1401
 
1396
1402
  // lib/cmd-fns/dev/index.ts
1397
- var devCmd = async (ctx, args2) => {
1403
+ var devCmd = async (ctx, args) => {
1398
1404
  const params = z19.object({
1399
1405
  cwd: z19.string().optional().default(process.cwd()),
1400
1406
  port: z19.coerce.number().optional().default(3020)
1401
- }).parse(args2);
1407
+ }).parse(args);
1402
1408
  const { cwd, port } = params;
1403
1409
  const isInitialized = await checkIfInitialized(ctx);
1404
1410
  if (!isInitialized) {
@@ -1456,11 +1462,11 @@ var devCmd = async (ctx, args2) => {
1456
1462
  import kleur12 from "kleur";
1457
1463
  import {z as z20} from "zod";
1458
1464
  import $4 from "dax-sh";
1459
- var addCmd = async (ctx, args2) => {
1465
+ var addCmd = async (ctx, args) => {
1460
1466
  const params = z20.object({
1461
1467
  packages: z20.array(z20.string()),
1462
1468
  flags: z20.object({ dev: z20.boolean().optional().default(false) }).optional().default({})
1463
- }).parse(args2);
1469
+ }).parse(args);
1464
1470
  params.packages = params.packages.map((p) => p.replace(/^@/, ""));
1465
1471
  await createOrModifyNpmrc({ quiet: true }, ctx);
1466
1472
  $4.cd(ctx.cwd);
@@ -1473,11 +1479,11 @@ var addCmd = async (ctx, args2) => {
1473
1479
  import kleur13 from "kleur";
1474
1480
  import {z as z21} from "zod";
1475
1481
  import $5 from "dax-sh";
1476
- var removeCmd = async (ctx, args2) => {
1482
+ var removeCmd = async (ctx, args) => {
1477
1483
  const params = z21.object({
1478
1484
  packages: z21.array(z21.string()),
1479
1485
  flags: z21.object({}).optional().default({})
1480
- }).parse(args2);
1486
+ }).parse(args);
1481
1487
  params.packages = params.packages.map((p) => p.replace(/^@/, ""));
1482
1488
  await createOrModifyNpmrc({ quiet: true }, ctx);
1483
1489
  $5.cd(ctx.cwd);
@@ -1490,11 +1496,11 @@ var removeCmd = async (ctx, args2) => {
1490
1496
  import kleur14 from "kleur";
1491
1497
  import {z as z23} from "zod";
1492
1498
  import $6 from "dax-sh";
1493
- var installCmd = async (ctx, args2) => {
1499
+ var installCmd = async (ctx, args) => {
1494
1500
  const params = z23.object({
1495
1501
  packages: z23.array(z23.string()),
1496
1502
  flags: z23.object({ dev: z23.boolean().optional().default(false) }).optional().default({})
1497
- }).parse(args2);
1503
+ }).parse(args);
1498
1504
  params.packages = params.packages.map((p) => p.replace(/^@/, ""));
1499
1505
  await createOrModifyNpmrc({ quiet: true }, ctx);
1500
1506
  $6.cd(ctx.cwd);
@@ -1509,12 +1515,12 @@ import {z as z25} from "zod";
1509
1515
  import $7 from "dax-sh";
1510
1516
  // lib/cmd-fns/dev-server-upload.ts
1511
1517
  import {z as z26} from "zod";
1512
- var devServerUpload = async (ctx, args2) => {
1518
+ var devServerUpload = async (ctx, args) => {
1513
1519
  const params = z26.object({
1514
1520
  dir: z26.string().optional().default(ctx.cwd),
1515
1521
  port: z26.coerce.number().optional().default(3020),
1516
1522
  watch: z26.boolean().optional().default(false)
1517
- }).parse(args2);
1523
+ }).parse(args);
1518
1524
  const serverUrl = `http://localhost:${params.port}`;
1519
1525
  const devServerAxios = getDevServerAxios({ serverUrl });
1520
1526
  console.log(`Loading examples...`);
@@ -1524,7 +1530,7 @@ var devServerUpload = async (ctx, args2) => {
1524
1530
  }
1525
1531
  };
1526
1532
  // lib/cmd-fns/config-clear.ts
1527
- var configClear = async (ctx, args2) => {
1533
+ var configClear = async (ctx, args) => {
1528
1534
  ctx.global_config.clear();
1529
1535
  };
1530
1536
  // lib/cmd-fns/open.ts
@@ -1532,7 +1538,7 @@ import {existsSync as existsSync5, readFileSync as readFileSync6} from "fs";
1532
1538
  import kleur16 from "kleur";
1533
1539
  import * as Path8 from "path";
1534
1540
  import open2 from "open";
1535
- var openCmd = async (ctx, args2) => {
1541
+ var openCmd = async (ctx, args) => {
1536
1542
  const packageJsonPath = Path8.join(ctx.cwd, "package.json");
1537
1543
  if (!existsSync5(packageJsonPath)) {
1538
1544
  console.log(kleur16.red("No package.json found in current directory"));
@@ -1546,7 +1552,7 @@ var openCmd = async (ctx, args2) => {
1546
1552
  // package.json
1547
1553
  var package_default = {
1548
1554
  name: "@tscircuit/cli",
1549
- version: "0.0.19",
1555
+ version: "0.0.21",
1550
1556
  private: false,
1551
1557
  type: "module",
1552
1558
  description: "Command line tool for developing, publishing and installing tscircuit circuits",
@@ -1622,61 +1628,132 @@ var package_default = {
1622
1628
  typescript: "^5.3.3"
1623
1629
  }
1624
1630
  };
1631
+ // dev-server-frontend/package.json
1632
+ var package_default2 = {
1633
+ name: "@tscircuit/dev-server-frontend",
1634
+ private: true,
1635
+ version: "0.0.0",
1636
+ type: "module",
1637
+ main: "dist/bundle.ts",
1638
+ exports: {
1639
+ ".": "./dist/bundle.ts"
1640
+ },
1641
+ scripts: {
1642
+ dev: "vite",
1643
+ start: "npm run dev",
1644
+ build: "tsc && vite build --base /preview && rm -f dist/bundle* && make-vfs --dir dist --outfile ./dist/bundle.ts",
1645
+ lint: "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 10",
1646
+ preview: "vite preview"
1647
+ },
1648
+ dependencies: {
1649
+ "@radix-ui/react-alert-dialog": "^1.0.5",
1650
+ "@radix-ui/react-context-menu": "^2.1.5",
1651
+ "@radix-ui/react-dialog": "^1.0.5",
1652
+ "@radix-ui/react-icons": "^1.3.0",
1653
+ "@radix-ui/react-menubar": "^1.0.4",
1654
+ "@radix-ui/react-navigation-menu": "^1.1.4",
1655
+ "@radix-ui/react-popover": "^1.0.7",
1656
+ "@radix-ui/react-select": "^2.0.0",
1657
+ "@radix-ui/react-slot": "^1.0.2",
1658
+ "@radix-ui/react-tabs": "^1.0.4",
1659
+ "@radix-ui/react-toggle": "^1.0.3",
1660
+ "@radix-ui/react-toggle-group": "^1.0.4",
1661
+ "@radix-ui/react-tooltip": "^1.0.7",
1662
+ "@tscircuit/pcb-viewer": "^1.2.12",
1663
+ "@tscircuit/schematic-viewer": "^1.1.5",
1664
+ axios: "^1.6.7",
1665
+ "class-variance-authority": "^0.7.0",
1666
+ clsx: "^2.1.0",
1667
+ cmdk: "^1.0.0",
1668
+ react: "^18.2.0",
1669
+ "react-dom": "^18.2.0",
1670
+ "react-hot-toast": "^2.4.1",
1671
+ "react-query": "^3.39.3",
1672
+ "tailwind-merge": "^2.2.1",
1673
+ "tailwindcss-animate": "^1.0.7",
1674
+ zod: "^3.22.4",
1675
+ zustand: "^4.5.2"
1676
+ },
1677
+ devDependencies: {
1678
+ "@types/react": "^18.2.64",
1679
+ "@types/react-dom": "^18.2.21",
1680
+ "@typescript-eslint/eslint-plugin": "^7.1.1",
1681
+ "@typescript-eslint/parser": "^7.1.1",
1682
+ "@vitejs/plugin-react": "^4.2.1",
1683
+ autoprefixer: "^10.4.18",
1684
+ eslint: "^8.57.0",
1685
+ "eslint-plugin-react-hooks": "^4.6.0",
1686
+ "eslint-plugin-react-refresh": "^0.4.5",
1687
+ "make-vfs": "1.0.10",
1688
+ postcss: "^8.4.35",
1689
+ tailwindcss: "^3.4.1",
1690
+ typescript: "^5.2.2",
1691
+ vite: "^5.1.6"
1692
+ }
1693
+ };
1625
1694
 
1626
1695
  // lib/cmd-fns/version.ts
1627
- var versionCmd = async (ctx, args2) => {
1628
- console.log(`tsci v${package_default.version}`);
1696
+ var versionCmd = async (ctx, args) => {
1697
+ const tscircuitPackageJson = await import("tscircuit/package.json").catch((e) => ({ version: "" }));
1698
+ const reactFiberPackageJson = await import("@tscircuit/react-fiber/package.json").catch((e) => ({ version: "" }));
1699
+ if (tscircuitPackageJson.version) {
1700
+ console.log(`tscircuit@${package_default.version}`);
1701
+ }
1702
+ console.log(`@tscircuit/cli@${package_default.version}`);
1703
+ console.log(`@tscircuit/react-fiber@${reactFiberPackageJson.version}`);
1704
+ console.log(`@tscircuit/schematic-viewer@${package_default2.dependencies["@tscircuit/schematic-viewer"]}`);
1705
+ console.log(`@tscircuit/pcb-viewer@${package_default2.dependencies["@tscircuit/pcb-viewer"]}`);
1629
1706
  };
1630
1707
  // lib/get-program.ts
1631
1708
  var getProgram = (ctx) => {
1632
1709
  const cmd = new Command("tsci");
1633
1710
  const authCmd = cmd.command("auth");
1634
- authCmd.command("login").action((args2) => authLogin(ctx, args2));
1635
- authCmd.command("logout").action((args2) => authLogout(ctx, args2));
1711
+ authCmd.command("login").action((args) => authLogin(ctx, args));
1712
+ authCmd.command("logout").action((args) => authLogout(ctx, args));
1636
1713
  const configCmd = cmd.command("config");
1637
- configCmd.command("reveal-location").action((args2) => configRevealLocation(ctx, args2));
1638
- configCmd.command("set-registry").requiredOption("--server <server>", "Registry URL").action((args2) => configSetRegistry(ctx, args2));
1639
- configCmd.command("set-session").requiredOption("--session-token <session_token>", "Session Token").action((args2) => configSetSession(ctx, args2));
1640
- configCmd.command("set-log-requests").requiredOption("--log-requests", "Should log requests to registry").action((args2) => configSetLogRequests(ctx, args2));
1641
- configCmd.command("print-config").action((args2) => configPrintConfig(ctx, args2));
1642
- configCmd.command("clear").action((args2) => configClear(ctx, args2));
1714
+ configCmd.command("reveal-location").action((args) => configRevealLocation(ctx, args));
1715
+ configCmd.command("set-registry").requiredOption("--server <server>", "Registry URL").action((args) => configSetRegistry(ctx, args));
1716
+ configCmd.command("set-session").requiredOption("--session-token <session_token>", "Session Token").action((args) => configSetSession(ctx, args));
1717
+ configCmd.command("set-log-requests").requiredOption("--log-requests", "Should log requests to registry").action((args) => configSetLogRequests(ctx, args));
1718
+ configCmd.command("print-config").action((args) => configPrintConfig(ctx, args));
1719
+ configCmd.command("clear").action((args) => configClear(ctx, args));
1643
1720
  const authSessionsCmd = authCmd.command("sessions");
1644
- authSessionsCmd.command("create").action((args2) => authSessionsCreate(ctx, args2));
1645
- authSessionsCmd.command("list").action((args2) => authSessionsList(ctx, args2));
1646
- authSessionsCmd.command("get").action((args2) => authSessionsGet(ctx, args2));
1721
+ authSessionsCmd.command("create").action((args) => authSessionsCreate(ctx, args));
1722
+ authSessionsCmd.command("list").action((args) => authSessionsList(ctx, args));
1723
+ authSessionsCmd.command("get").action((args) => authSessionsGet(ctx, args));
1647
1724
  const packagesCmd = cmd.command("packages");
1648
- packagesCmd.command("list").action((args2) => packagesList(ctx, args2));
1649
- packagesCmd.command("get").option("--package-id <package_id>", "Package Id").option("--name <name>", "Package name").action((args2) => packagesGet(ctx, args2));
1650
- packagesCmd.command("create").requiredOption("--name <name>", "Package name").option("--author-id <author_account_id>", "Author Id").option("--description <description>", "Package description").action((args2) => packagesCreate(ctx, args2));
1725
+ packagesCmd.command("list").action((args) => packagesList(ctx, args));
1726
+ packagesCmd.command("get").option("--package-id <package_id>", "Package Id").option("--name <name>", "Package name").action((args) => packagesGet(ctx, args));
1727
+ packagesCmd.command("create").requiredOption("--name <name>", "Package name").option("--author-id <author_account_id>", "Author Id").option("--description <description>", "Package description").action((args) => packagesCreate(ctx, args));
1651
1728
  const packageReleases = cmd.command("package_releases");
1652
- packageReleases.command("list").requiredOption("--package-name <package_name>", "Package name").option("--verbose", "Verbose objects (includes uuids)").action((args2) => packageReleasesList(ctx, args2));
1653
- packageReleases.command("get").action((args2) => packageReleasesGet(ctx, args2));
1654
- packageReleases.command("create").option("-p, --package-name-with-version <package_name_with_version>", "Package name and version").option("--package-name <package_name>", "Package name").option("--release-version <release_version>", "Version to publish").action((args2) => packageReleasesCreate(ctx, args2));
1655
- packageReleases.command("update").option("-p, --package-name-with-version <package_name_with_version>", "Package name and version").option("--is-latest", "Make package release the latest version").option("--is-locked", "Lock the release").action((args2) => packageReleasesUpdate(ctx, args2));
1729
+ packageReleases.command("list").requiredOption("--package-name <package_name>", "Package name").option("--verbose", "Verbose objects (includes uuids)").action((args) => packageReleasesList(ctx, args));
1730
+ packageReleases.command("get").action((args) => packageReleasesGet(ctx, args));
1731
+ packageReleases.command("create").option("-p, --package-name-with-version <package_name_with_version>", "Package name and version").option("--package-name <package_name>", "Package name").option("--release-version <release_version>", "Version to publish").action((args) => packageReleasesCreate(ctx, args));
1732
+ packageReleases.command("update").option("-p, --package-name-with-version <package_name_with_version>", "Package name and version").option("--is-latest", "Make package release the latest version").option("--is-locked", "Lock the release").action((args) => packageReleasesUpdate(ctx, args));
1656
1733
  const packageFiles = cmd.command("package_files");
1657
- packageFiles.command("list").option("--package-name-with-version <package_name_with_version>", "Package name with version").option("--package-name <package_name>", "Package name (use latest version)").option("--package-release-id <package_release_id>", "Package Release Id").action((args2) => packageFilesList(ctx, args2));
1658
- packageFiles.command("get").action((args2) => packageFilesGet(ctx, args2));
1659
- packageFiles.command("download").requiredOption("--package-name-with-version <package_name_with_version>", "Package name and version").requiredOption("--remote-file-path <remote_file_path>", "Remote file path").option("--output <output>", "Output file path (optional), prints to stdout if not provided").action((args2) => packageFilesDownload(ctx, args2));
1660
- packageFiles.command("create").option("-p, --package-release-id <package_release_id>", "Package Release Id").option("--package-name-with-version <package_name_with_version>", "Package name with version e.g. @tscircuit/arduino@1.2.3").requiredOption("--file <file>", "File to upload").action((args2) => packageFilesCreate(ctx, args2));
1661
- packageFiles.command("upload-directory").requiredOption("--dir <dir>", "Directory to upload").action((args2) => packageFilesUploadDirectory(ctx, args2));
1734
+ packageFiles.command("list").option("--package-name-with-version <package_name_with_version>", "Package name with version").option("--package-name <package_name>", "Package name (use latest version)").option("--package-release-id <package_release_id>", "Package Release Id").action((args) => packageFilesList(ctx, args));
1735
+ packageFiles.command("get").action((args) => packageFilesGet(ctx, args));
1736
+ packageFiles.command("download").requiredOption("--package-name-with-version <package_name_with_version>", "Package name and version").requiredOption("--remote-file-path <remote_file_path>", "Remote file path").option("--output <output>", "Output file path (optional), prints to stdout if not provided").action((args) => packageFilesDownload(ctx, args));
1737
+ packageFiles.command("create").option("-p, --package-release-id <package_release_id>", "Package Release Id").option("--package-name-with-version <package_name_with_version>", "Package name with version e.g. @tscircuit/arduino@1.2.3").requiredOption("--file <file>", "File to upload").action((args) => packageFilesCreate(ctx, args));
1738
+ packageFiles.command("upload-directory").requiredOption("--dir <dir>", "Directory to upload").action((args) => packageFilesUploadDirectory(ctx, args));
1662
1739
  const packageExamples = cmd.command("package_examples");
1663
- packageExamples.command("list").requiredOption("--package-name-with-version <package_name_with_version>").action((args2) => packageExamplesList(ctx, args2));
1664
- packageExamples.command("get").requiredOption("--package-example-id <package_example_id>").action((args2) => packageExamplesGet(ctx, args2));
1665
- packageExamples.command("create").requiredOption("--package-name-with-version <package_name_with_version>").requiredOption("--file <file>").option("--export <export>", "Name of export to soupify").action((args2) => packageExamplesCreate(ctx, args2));
1666
- cmd.command("publish").option("--increment", "Increase patch version").option("--patch", "Increase patch version").option("--lock", "Lock the release after publishing to prevent changes").action((args2) => publish(ctx, args2));
1667
- cmd.command("version").action(() => versionCmd(ctx, args));
1668
- cmd.command("login").action((args2) => authLogin(ctx, args2));
1669
- cmd.command("logout").action((args2) => authLogout(ctx, args2));
1670
- cmd.command("soupify").requiredOption("--file <file>", "Input example files").option("--export <export_name>", "Name of export to soupify, if not specified, soupify the default/only export").action((args2) => soupifyCmd(ctx, args2));
1671
- cmd.command("dev").option("--cwd <cwd>", "Current working directory").option("--port <port>", "Port to run dev server on").action((args2) => devCmd(ctx, args2));
1672
- cmd.command("init").option("--name <name>", "Name of the project").option("--runtime <runtime>", "Runtime to use (attempts to bun, otherwise node/tsx)").option("--dir <dir>", "Directory to initialize (defaults to ./<name> or . if name not provided)").action((args2) => initCmd(ctx, args2));
1740
+ packageExamples.command("list").requiredOption("--package-name-with-version <package_name_with_version>").action((args) => packageExamplesList(ctx, args));
1741
+ packageExamples.command("get").requiredOption("--package-example-id <package_example_id>").action((args) => packageExamplesGet(ctx, args));
1742
+ packageExamples.command("create").requiredOption("--package-name-with-version <package_name_with_version>").requiredOption("--file <file>").option("--export <export>", "Name of export to soupify").action((args) => packageExamplesCreate(ctx, args));
1743
+ cmd.command("publish").option("--increment", "Increase patch version").option("--patch", "Increase patch version").option("--lock", "Lock the release after publishing to prevent changes").action((args) => publish(ctx, args));
1744
+ cmd.command("version").action((args) => versionCmd(ctx, args));
1745
+ cmd.command("login").action((args) => authLogin(ctx, args));
1746
+ cmd.command("logout").action((args) => authLogout(ctx, args));
1747
+ cmd.command("soupify").requiredOption("--file <file>", "Input example files").option("--export <export_name>", "Name of export to soupify, if not specified, soupify the default/only export").action((args) => soupifyCmd(ctx, args));
1748
+ cmd.command("dev").option("--cwd <cwd>", "Current working directory").option("--port <port>", "Port to run dev server on").action((args) => devCmd(ctx, args));
1749
+ cmd.command("init").option("--name <name>", "Name of the project").option("--runtime <runtime>", "Runtime to use (attempts to bun, otherwise node/tsx)").option("--dir <dir>", "Directory to initialize (defaults to ./<name> or . if name not provided)").action((args) => initCmd(ctx, args));
1673
1750
  cmd.command("add").argument("<packages...>", "Packages to install from registry.tscircuit.com, optionally with version").option("-D, --dev", "Add to devDependencies").action((packages, flags) => addCmd(ctx, { packages, flags }));
1674
1751
  cmd.command("remove").argument("<packages...>", "Packages to remove").action((packages, flags) => removeCmd(ctx, { packages, flags }));
1675
1752
  cmd.command("install").argument("<packages...>", "Packages to install from registry.tscircuit.com, optionally with version").option("-D, --dev", "Add to devDependencies").action((packages, flags) => installCmd(ctx, { packages, flags }));
1676
1753
  cmd.command("uninstall").argument("<packages...>", "Packages to uninstall").action((packages, flags) => installCmd(ctx, { packages, flags }));
1677
1754
  const devServerCmd = cmd.command("dev-server");
1678
- devServerCmd.command("upload").option("--dir <dir>", "Directory to upload (defaults to current directory)").option("-w, --watch", "Watch for changes").option("-p, --port", "Port dev server is running on (default: 3020)").action((args2) => devServerUpload(ctx, args2));
1679
- cmd.command("open").action((args2) => openCmd(ctx, args2));
1755
+ devServerCmd.command("upload").option("--dir <dir>", "Directory to upload (defaults to current directory)").option("-w, --watch", "Watch for changes").option("-p, --port", "Port dev server is running on (default: 3020)").action((args) => devServerUpload(ctx, args));
1756
+ cmd.command("open").action((args) => openCmd(ctx, args));
1680
1757
  return cmd;
1681
1758
  };
1682
1759
 
@@ -1951,16 +2028,16 @@ var createConfigHandler = ({
1951
2028
  // lib/util/create-context-and-run-program.ts
1952
2029
  import dargs from "dargs";
1953
2030
  var createContextAndRunProgram = async (process_args) => {
1954
- const args2 = minimist(process_args);
2031
+ const args = minimist(process_args);
1955
2032
  const { global_config, profile_config, current_profile } = createConfigHandler({
1956
- profile: args2.profile
2033
+ profile: args.profile
1957
2034
  });
1958
2035
  const registry_url = profile_config.get("registry_url") ?? "https://registry-api.tscircuit.com";
1959
- args2._ = args2._.map((p) => p.toLowerCase().replace(/-/g, "_"));
1960
- for (const key in args2) {
2036
+ args._ = args._.map((p) => p.toLowerCase().replace(/-/g, "_"));
2037
+ for (const key in args) {
1961
2038
  if (key.includes("-")) {
1962
- args2[key.replace(/-/g, "_")] = args2[key];
1963
- delete args2[key];
2039
+ args[key.replace(/-/g, "_")] = args[key];
2040
+ delete args[key];
1964
2041
  }
1965
2042
  }
1966
2043
  const axios = defaultAxios2.create({
@@ -1990,24 +2067,24 @@ var createContextAndRunProgram = async (process_args) => {
1990
2067
  return Promise.reject(err);
1991
2068
  });
1992
2069
  const ctx = {
1993
- cmd: args2._,
1994
- cwd: args2.cwd ?? process.cwd(),
2070
+ cmd: args._,
2071
+ cwd: args.cwd ?? process.cwd(),
1995
2072
  current_profile,
1996
2073
  registry_url,
1997
2074
  axios,
1998
2075
  global_config,
1999
2076
  profile_config,
2000
2077
  args: {
2001
- cmd: args2._,
2002
- yes: args2.y ?? args2.yes,
2078
+ cmd: args._,
2079
+ yes: args.y ?? args.yes,
2003
2080
  help: undefined
2004
2081
  },
2005
- params: args2
2082
+ params: args
2006
2083
  };
2007
- delete args2["cwd"];
2008
- const { _: positional, ...flagsAndParams } = args2;
2084
+ delete args["cwd"];
2085
+ const { _: positional, ...flagsAndParams } = args;
2009
2086
  const args_without_globals = positional.concat(dargs(flagsAndParams));
2010
- if (args2["version"] && args2._.length === 2) {
2087
+ if (args["version"] && args._.length === 2) {
2011
2088
  await versionCmd(ctx, {});
2012
2089
  process.exit(0);
2013
2090
  }
@@ -34,6 +34,16 @@ export const publish = async (ctx: AppContext, args: any) => {
34
34
  await readFileSync(Path.join(ctx.cwd, "package.json"), "utf-8")
35
35
  )
36
36
 
37
+ if (!packageJson.version) {
38
+ console.log(kleur.yellow("No version found in package.json"))
39
+ console.log(kleur.green("Setting package.json version to 0.0.1"))
40
+ packageJson.version = "0.0.1"
41
+ await fs.writeFile(
42
+ Path.join(ctx.cwd, "package.json"),
43
+ JSON.stringify(packageJson, null, 2)
44
+ )
45
+ }
46
+
37
47
  await esbuild.build({
38
48
  entryPoints: ["index.ts"], // TODO dynamically determine entrypoint
39
49
  bundle: true,
@@ -1,6 +1,23 @@
1
1
  import { AppContext } from "lib/util/app-context"
2
- import packageJson from "./../../package.json"
2
+ import cliPackageJson from "./../../package.json"
3
+ import frontendPackageJson from "dev-server-frontend/package.json"
3
4
 
4
5
  export const versionCmd = async (ctx: AppContext, args: any) => {
5
- console.log(`tsci v${packageJson.version}`)
6
+ const tscircuitPackageJson = await import(
7
+ "tscircuit/package.json" as any
8
+ ).catch((e) => ({ version: "" }))
9
+ const reactFiberPackageJson = await import(
10
+ "@tscircuit/react-fiber/package.json"
11
+ ).catch((e) => ({ version: "" }))
12
+ if (tscircuitPackageJson.version) {
13
+ console.log(`tscircuit@${cliPackageJson.version}`)
14
+ }
15
+ console.log(`@tscircuit/cli@${cliPackageJson.version}`)
16
+ console.log(`@tscircuit/react-fiber@${reactFiberPackageJson.version}`)
17
+ console.log(
18
+ `@tscircuit/schematic-viewer@${frontendPackageJson.dependencies["@tscircuit/schematic-viewer"]}`
19
+ )
20
+ console.log(
21
+ `@tscircuit/pcb-viewer@${frontendPackageJson.dependencies["@tscircuit/pcb-viewer"]}`
22
+ )
6
23
  }
@@ -174,7 +174,7 @@ export const getProgram = (ctx: AppContext) => {
174
174
  .option("--lock", "Lock the release after publishing to prevent changes")
175
175
  .action((args) => CMDFN.publish(ctx, args))
176
176
 
177
- cmd.command("version").action(() => CMDFN.version(ctx, args))
177
+ cmd.command("version").action((args) => CMDFN.version(ctx, args))
178
178
 
179
179
  cmd.command("login").action((args) => CMDFN.authLogin(ctx, args))
180
180
  cmd.command("logout").action((args) => CMDFN.authLogout(ctx, args))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Command line tool for developing, publishing and installing tscircuit circuits",