@tscircuit/cli 0.0.15 → 0.0.16

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
@@ -206,85 +206,6 @@ import {perfectCli} from "perfect-cli";
206
206
 
207
207
  // lib/get-program.ts
208
208
  import {Command} from "commander";
209
- // package.json
210
- var package_default = {
211
- name: "@tscircuit/cli",
212
- version: "0.0.14",
213
- private: false,
214
- type: "module",
215
- description: "Command line tool for developing, publishing and installing tscircuit circuits",
216
- main: "./dist/cli.js",
217
- scripts: {
218
- bootstrap: "bun i --frozen-lockfile && cd dev-server-api && bun i --frozen-lockfile && cd ../dev-server-frontend && bun i --frozen-lockfile",
219
- start: "bun cli.ts",
220
- "start:dev-server:dev": "TSCI_DEV_SERVER_DB=$(pwd)/.tscircuit/dev-server.db concurrently 'cd dev-server-api && bun start' 'cd dev-server-frontend && bun start'",
221
- "start:dev-server": "bun build:dev-server && bun cli.ts dev -y --cwd ./tests/assets/example-project",
222
- "build:dev-server": "cd dev-server-api && bun run build && cd ../dev-server-frontend && bun run build",
223
- "build:cli": "bun build-cli.ts",
224
- build: "bun build:dev-server && npm run build:cli",
225
- "test:init": "bun cli.ts init --dir ./tmp/test --name test"
226
- },
227
- bin: {
228
- tscircuit: "./dist/cli.js",
229
- tsci: "./dist/cli.js"
230
- },
231
- keywords: [
232
- "circuit",
233
- "react",
234
- "electronics",
235
- "pcb",
236
- "schematic"
237
- ],
238
- author: "",
239
- license: "ISC",
240
- dependencies: {
241
- "@edge-runtime/primitives": "^4.1.0",
242
- "@hono/node-server": "^1.8.2",
243
- "@tscircuit/builder": "^1.5.4",
244
- "@tscircuit/react-fiber": "^1.0.6",
245
- axios: "^1.6.7",
246
- "better-sqlite3": "^9.4.3",
247
- chokidar: "^3.6.0",
248
- commander: "^12.0.0",
249
- configstore: "^6.0.0",
250
- dargs: "^8.1.0",
251
- "dax-sh": "^0.39.2",
252
- delay: "^6.0.0",
253
- edgespec: "^0.0.69",
254
- esbuild: "^0.20.2",
255
- glob: "^10.3.10",
256
- hono: "^4.1.0",
257
- ignore: "^5.3.1",
258
- kleur: "^4.1.5",
259
- "kysely-bun-sqlite": "^0.3.2",
260
- lodash: "^4.17.21",
261
- "mime-types": "^2.1.35",
262
- minimist: "^1.2.8",
263
- "node-persist": "^4.0.1",
264
- open: "^10.1.0",
265
- "perfect-cli": "^1.0.16",
266
- prompts: "^2.4.2",
267
- react: "^18.2.0",
268
- semver: "^7.6.0",
269
- zod: "latest"
270
- },
271
- devDependencies: {
272
- "@types/bun": "^1.0.8",
273
- "@types/chokidar": "^2.1.3",
274
- "@types/configstore": "^6.0.2",
275
- "@types/lodash": "^4.14.202",
276
- "@types/mime-types": "^2.1.4",
277
- "@types/minimist": "^1.2.5",
278
- "@types/node": "^20.10.6",
279
- "@types/prompts": "^2.4.9",
280
- "@types/react": "^18.2.64",
281
- "@types/semver": "^7.5.8",
282
- ava: "^6.1.1",
283
- concurrently: "^8.2.2",
284
- tsx: "^4.7.1",
285
- typescript: "^5.3.3"
286
- }
287
- };
288
209
 
289
210
  // lib/cmd-fns/config-reveal-location.ts
290
211
  var configRevealLocation = async (ctx, args2) => {
@@ -454,14 +375,47 @@ var packageReleasesCreate = async (ctx, args2) => {
454
375
  }).then((r) => r.data.package_release);
455
376
  console.log(`Package release created! ${kleur2.gray(package_release.package_release_id)}`);
456
377
  };
457
- // lib/cmd-fns/package-files-list.ts
378
+ // lib/cmd-fns/package-releases-update.ts
458
379
  import {z as z8} from "zod";
459
- var packageFilesList = async (ctx, args2) => {
380
+ var packageReleasesUpdate = async (ctx, args2) => {
460
381
  const params = z8.object({
461
- packageReleaseId: z8.string().optional(),
462
- packageName: z8.string().optional(),
463
382
  packageNameWithVersion: z8.string().optional(),
464
- verbose: z8.boolean().optional()
383
+ packageName: z8.string().optional(),
384
+ version: z8.string().optional(),
385
+ isLatest: z8.boolean().optional(),
386
+ isLocked: z8.boolean().optional()
387
+ }).refine((d) => {
388
+ if (d.packageNameWithVersion)
389
+ return true;
390
+ if (d.packageName && d.version)
391
+ return true;
392
+ return false;
393
+ }, "Either packageNameWithVersion or packageName and version must be provided").parse(args2);
394
+ let { packageNameWithVersion, packageName, version } = params;
395
+ if (!packageNameWithVersion) {
396
+ packageNameWithVersion = `${packageName}@${version}`;
397
+ }
398
+ const delta = {};
399
+ if (params.isLatest !== undefined) {
400
+ delta.is_latest = params.isLatest;
401
+ }
402
+ if (params.isLocked !== undefined) {
403
+ delta.is_locked = params.isLocked;
404
+ }
405
+ await ctx.axios.post("/package_releases/update", {
406
+ package_name_with_version: packageNameWithVersion,
407
+ ...delta
408
+ });
409
+ console.log(`Package release updated!`);
410
+ };
411
+ // lib/cmd-fns/package-files-list.ts
412
+ import {z as z9} from "zod";
413
+ var packageFilesList = async (ctx, args2) => {
414
+ const params = z9.object({
415
+ packageReleaseId: z9.string().optional(),
416
+ packageName: z9.string().optional(),
417
+ packageNameWithVersion: z9.string().optional(),
418
+ verbose: z9.boolean().optional()
465
419
  }).parse(args2);
466
420
  const package_files = await ctx.axios.post("/package_files/list", {
467
421
  package_release_id: params.packageReleaseId,
@@ -479,13 +433,13 @@ var packageFilesList = async (ctx, args2) => {
479
433
  var packageFilesGet = async (ctx, args2) => {
480
434
  };
481
435
  // lib/cmd-fns/package-files-download.ts
482
- import {z as z9} from "zod";
436
+ import {z as z10} from "zod";
483
437
  import * as fs from "fs/promises";
484
438
  var packageFilesDownload = async (ctx, args2) => {
485
- const params = z9.object({
486
- packageNameWithVersion: z9.string().optional(),
487
- remoteFilePath: z9.string().optional(),
488
- output: z9.string().optional()
439
+ const params = z10.object({
440
+ packageNameWithVersion: z10.string().optional(),
441
+ remoteFilePath: z10.string().optional(),
442
+ output: z10.string().optional()
489
443
  }).parse(args2);
490
444
  const { packageNameWithVersion, remoteFilePath } = params;
491
445
  const packageContent = await ctx.axios.post("/package_files/download", {
@@ -500,14 +454,14 @@ var packageFilesDownload = async (ctx, args2) => {
500
454
  }
501
455
  };
502
456
  // lib/cmd-fns/package-files-create.ts
503
- import {z as z10} from "zod";
457
+ import {z as z11} from "zod";
504
458
  import * as fs2 from "fs/promises";
505
459
  import kleur3 from "kleur";
506
460
  var packageFilesCreate = async (ctx, args2) => {
507
- const params = z10.object({
508
- file: z10.string(),
509
- packageReleaseId: z10.string().optional(),
510
- packageNameWithVersion: z10.string().optional()
461
+ const params = z11.object({
462
+ file: z11.string(),
463
+ packageReleaseId: z11.string().optional(),
464
+ packageNameWithVersion: z11.string().optional()
511
465
  }).parse(args2);
512
466
  const { file, packageNameWithVersion, packageReleaseId } = params;
513
467
  const fileContent = await fs2.readFile(file);
@@ -520,10 +474,10 @@ var packageFilesCreate = async (ctx, args2) => {
520
474
  console.log(`Package file created ${kleur3.gray(package_file.package_file_id)}`);
521
475
  };
522
476
  // lib/cmd-fns/package-examples-list.ts
523
- import {z as z11} from "zod";
477
+ import {z as z12} from "zod";
524
478
  var packageExamplesList = async (ctx, args2) => {
525
- const params = z11.object({
526
- packageNameWithVersion: z11.string()
479
+ const params = z12.object({
480
+ packageNameWithVersion: z12.string()
527
481
  }).parse(args2);
528
482
  const package_examples = await ctx.axios.post("/package_examples/list", {
529
483
  package_name_with_version: params.packageNameWithVersion
@@ -531,10 +485,10 @@ var packageExamplesList = async (ctx, args2) => {
531
485
  console.log(package_examples);
532
486
  };
533
487
  // lib/cmd-fns/package-examples-get.ts
534
- import {z as z12} from "zod";
488
+ import {z as z13} from "zod";
535
489
  var packageExamplesGet = async (ctx, args2) => {
536
- const params = z12.object({
537
- packageExampleId: z12.string().uuid()
490
+ const params = z13.object({
491
+ packageExampleId: z13.string().uuid()
538
492
  }).parse(args2);
539
493
  const { packageExampleId: package_example_id } = params;
540
494
  const package_example = await ctx.axios.post("/package_examples/get", {
@@ -593,13 +547,13 @@ console.log(JSON.stringify(elements))
593
547
  };
594
548
 
595
549
  // lib/cmd-fns/package-examples-create.ts
596
- import {z as z13} from "zod";
550
+ import {z as z14} from "zod";
597
551
  import fs3 from "fs";
598
552
  var packageExamplesCreate = async (ctx, args2) => {
599
- const params = z13.object({
600
- packageNameWithVersion: z13.string(),
601
- file: z13.string(),
602
- export: z13.string().optional().default("default")
553
+ const params = z14.object({
554
+ packageNameWithVersion: z14.string(),
555
+ file: z14.string(),
556
+ export: z14.string().optional().default("default")
603
557
  }).parse(args2);
604
558
  const tscircuit_soup = await soupify({
605
559
  filePath: params.file,
@@ -617,7 +571,7 @@ var packageExamplesCreate = async (ctx, args2) => {
617
571
  };
618
572
  // lib/cmd-fns/publish/index.ts
619
573
  import kleur4 from "kleur";
620
- import {z as z14} from "zod";
574
+ import {z as z15} from "zod";
621
575
  import * as Path2 from "path";
622
576
  import * as fs5 from "fs/promises";
623
577
  import {readFileSync} from "fs";
@@ -693,10 +647,10 @@ import semver from "semver";
693
647
  import {unlink as unlink2} from "fs/promises";
694
648
  import esbuild from "esbuild";
695
649
  var publish = async (ctx, args2) => {
696
- const params = z14.object({
697
- increment: z14.boolean().optional(),
698
- patch: z14.boolean().optional(),
699
- lock: z14.boolean().optional()
650
+ const params = z15.object({
651
+ increment: z15.boolean().optional(),
652
+ patch: z15.boolean().optional(),
653
+ lock: z15.boolean().optional()
700
654
  }).parse(args2);
701
655
  if (typeof Bun === "undefined") {
702
656
  console.log(kleur4.red("\n\n----------------------------------\nBun is currently required for publishing packages to the tscircuit registry. Try installing bun:\nhhttps://bun.sh/docs/installation\n\n---------------------"));
@@ -846,13 +800,13 @@ var publish = async (ctx, args2) => {
846
800
  console.log(kleur4.green(`Published ${name}@${version}!\nhttps://registry.tscircuit.com/${name}`));
847
801
  };
848
802
  // lib/cmd-fns/soupify.ts
849
- import {z as z15} from "zod";
803
+ import {z as z16} from "zod";
850
804
  import {writeFileSync as writeFileSync2} from "fs";
851
805
  var soupifyCmd = async (ctx, args2) => {
852
- const params = z15.object({
853
- file: z15.string(),
854
- export: z15.string().optional(),
855
- output: z15.string().optional()
806
+ const params = z16.object({
807
+ file: z16.string(),
808
+ export: z16.string().optional(),
809
+ output: z16.string().optional()
856
810
  }).parse(args2);
857
811
  const soup = await soupify({
858
812
  filePath: params.file,
@@ -865,7 +819,7 @@ var soupifyCmd = async (ctx, args2) => {
865
819
  }
866
820
  };
867
821
  // lib/cmd-fns/dev/index.ts
868
- import {z as z18} from "zod";
822
+ import {z as z19} from "zod";
869
823
  import kleur11 from "kleur";
870
824
  import prompts2 from "prompts";
871
825
  import open from "open";
@@ -879,7 +833,7 @@ import {mkdirSync} from "fs";
879
833
  import * as Path3 from "path";
880
834
  import kleur5 from "kleur";
881
835
  import"edgespec/middleware";
882
- import {z as z16} from "zod";
836
+ import {z as z17} from "zod";
883
837
  import {NotFoundError as NotFoundError2} from "edgespec/middleware";
884
838
  import {z as z22} from "zod";
885
839
  import {z as z32} from "zod";
@@ -962,17 +916,17 @@ var withEdgeSpec = createWithEdgeSpec({
962
916
  });
963
917
  var create_default = withEdgeSpec({
964
918
  methods: ["POST"],
965
- jsonBody: z16.object({
966
- file_path: z16.string(),
967
- export_name: z16.string().default("default"),
968
- tscircuit_soup: z16.any()
919
+ jsonBody: z17.object({
920
+ file_path: z17.string(),
921
+ export_name: z17.string().default("default"),
922
+ tscircuit_soup: z17.any()
969
923
  }),
970
- jsonResponse: z16.object({
971
- dev_package_example: z16.object({
972
- dev_package_example_id: z16.coerce.number(),
973
- file_path: z16.string(),
974
- tscircuit_soup: z16.any(),
975
- last_updated_at: z16.string().datetime()
924
+ jsonResponse: z17.object({
925
+ dev_package_example: z17.object({
926
+ dev_package_example_id: z17.coerce.number(),
927
+ file_path: z17.string(),
928
+ tscircuit_soup: z17.any(),
929
+ last_updated_at: z17.string().datetime()
976
930
  })
977
931
  }),
978
932
  auth: "none"
@@ -1161,6 +1115,7 @@ var getDevServerAxios = ({ serverUrl }) => {
1161
1115
  const devServerAxios = defaultAxios.create({
1162
1116
  baseURL: serverUrl
1163
1117
  });
1118
+ devServerAxios.defaults.headers.common["Accept-Encoding"] = "gzip";
1164
1119
  devServerAxios.interceptors.response.use((res) => res, (err) => {
1165
1120
  console.log(kleur6.red(`[ERR] ${err.response?.status} ${err.config.method?.toUpperCase()} ${err.config.url}\n\n${JSON.stringify(err.response?.data, null, " ")}`.replace(/\\n/g, "\n").replace(/\\"/g, '"')));
1166
1121
  console.log(kleur6.yellow("[Request Body]:"), err.config.data);
@@ -1309,7 +1264,7 @@ var checkIfInitialized = async (ctx) => {
1309
1264
  };
1310
1265
 
1311
1266
  // lib/cmd-fns/init/index.ts
1312
- import {z as z17} from "zod";
1267
+ import {z as z18} from "zod";
1313
1268
  import {
1314
1269
  readFileSync as readFileSync5,
1315
1270
  writeFileSync as writeFileSync4,
@@ -1357,10 +1312,10 @@ var getGeneratedTsconfig = () => `
1357
1312
 
1358
1313
  // lib/cmd-fns/init/index.ts
1359
1314
  var initCmd = async (ctx, args2) => {
1360
- const params = z17.object({
1361
- name: z17.string().optional(),
1362
- dir: z17.string().optional(),
1363
- runtime: z17.enum(["bun", "node"]).optional()
1315
+ const params = z18.object({
1316
+ name: z18.string().optional(),
1317
+ dir: z18.string().optional(),
1318
+ runtime: z18.enum(["bun", "node"]).optional()
1364
1319
  }).parse(args2);
1365
1320
  if (params.name && !params.dir) {
1366
1321
  params.dir = `./${params.name.split("/").pop()}`;
@@ -1443,9 +1398,9 @@ export const MyExample = () => (
1443
1398
 
1444
1399
  // lib/cmd-fns/dev/index.ts
1445
1400
  var devCmd = async (ctx, args2) => {
1446
- const params = z18.object({
1447
- cwd: z18.string().optional().default(process.cwd()),
1448
- port: z18.coerce.number().optional().default(3020)
1401
+ const params = z19.object({
1402
+ cwd: z19.string().optional().default(process.cwd()),
1403
+ port: z19.coerce.number().optional().default(3020)
1449
1404
  }).parse(args2);
1450
1405
  const { cwd, port } = params;
1451
1406
  const isInitialized = await checkIfInitialized(ctx);
@@ -1502,12 +1457,12 @@ var devCmd = async (ctx, args2) => {
1502
1457
  };
1503
1458
  // lib/cmd-fns/add.ts
1504
1459
  import kleur12 from "kleur";
1505
- import {z as z19} from "zod";
1460
+ import {z as z20} from "zod";
1506
1461
  import $4 from "dax-sh";
1507
1462
  var addCmd = async (ctx, args2) => {
1508
- const params = z19.object({
1509
- packages: z19.array(z19.string()),
1510
- flags: z19.object({ dev: z19.boolean().optional().default(false) }).optional().default({})
1463
+ const params = z20.object({
1464
+ packages: z20.array(z20.string()),
1465
+ flags: z20.object({ dev: z20.boolean().optional().default(false) }).optional().default({})
1511
1466
  }).parse(args2);
1512
1467
  params.packages = params.packages.map((p) => p.replace(/^@/, ""));
1513
1468
  await createOrModifyNpmrc({ quiet: true }, ctx);
@@ -1519,12 +1474,12 @@ var addCmd = async (ctx, args2) => {
1519
1474
  };
1520
1475
  // lib/cmd-fns/remove.ts
1521
1476
  import kleur13 from "kleur";
1522
- import {z as z20} from "zod";
1477
+ import {z as z21} from "zod";
1523
1478
  import $5 from "dax-sh";
1524
1479
  var removeCmd = async (ctx, args2) => {
1525
- const params = z20.object({
1526
- packages: z20.array(z20.string()),
1527
- flags: z20.object({}).optional().default({})
1480
+ const params = z21.object({
1481
+ packages: z21.array(z21.string()),
1482
+ flags: z21.object({}).optional().default({})
1528
1483
  }).parse(args2);
1529
1484
  params.packages = params.packages.map((p) => p.replace(/^@/, ""));
1530
1485
  await createOrModifyNpmrc({ quiet: true }, ctx);
@@ -1536,12 +1491,12 @@ var removeCmd = async (ctx, args2) => {
1536
1491
  };
1537
1492
  // lib/cmd-fns/install.ts
1538
1493
  import kleur14 from "kleur";
1539
- import {z as z21} from "zod";
1494
+ import {z as z23} from "zod";
1540
1495
  import $6 from "dax-sh";
1541
1496
  var installCmd = async (ctx, args2) => {
1542
- const params = z21.object({
1543
- packages: z21.array(z21.string()),
1544
- flags: z21.object({ dev: z21.boolean().optional().default(false) }).optional().default({})
1497
+ const params = z23.object({
1498
+ packages: z23.array(z23.string()),
1499
+ flags: z23.object({ dev: z23.boolean().optional().default(false) }).optional().default({})
1545
1500
  }).parse(args2);
1546
1501
  params.packages = params.packages.map((p) => p.replace(/^@/, ""));
1547
1502
  await createOrModifyNpmrc({ quiet: true }, ctx);
@@ -1553,15 +1508,15 @@ var installCmd = async (ctx, args2) => {
1553
1508
  };
1554
1509
  // lib/cmd-fns/uninstall.ts
1555
1510
  import kleur15 from "kleur";
1556
- import {z as z23} from "zod";
1511
+ import {z as z25} from "zod";
1557
1512
  import $7 from "dax-sh";
1558
1513
  // lib/cmd-fns/dev-server-upload.ts
1559
- import {z as z25} from "zod";
1514
+ import {z as z26} from "zod";
1560
1515
  var devServerUpload = async (ctx, args2) => {
1561
- const params = z25.object({
1562
- dir: z25.string().optional().default(ctx.cwd),
1563
- port: z25.coerce.number().optional().default(3020),
1564
- watch: z25.boolean().optional().default(false)
1516
+ const params = z26.object({
1517
+ dir: z26.string().optional().default(ctx.cwd),
1518
+ port: z26.coerce.number().optional().default(3020),
1519
+ watch: z26.boolean().optional().default(false)
1565
1520
  }).parse(args2);
1566
1521
  const serverUrl = `http://localhost:${params.port}`;
1567
1522
  const devServerAxios = getDevServerAxios({ serverUrl });
@@ -1587,10 +1542,93 @@ var openCmd = async (ctx, args2) => {
1587
1542
  console.log(`Opening ${registryUrl} in your browser...`);
1588
1543
  await open2(registryUrl);
1589
1544
  };
1545
+ // package.json
1546
+ var package_default = {
1547
+ name: "@tscircuit/cli",
1548
+ version: "0.0.15",
1549
+ private: false,
1550
+ type: "module",
1551
+ description: "Command line tool for developing, publishing and installing tscircuit circuits",
1552
+ main: "./dist/cli.js",
1553
+ scripts: {
1554
+ bootstrap: "bun i --frozen-lockfile && cd dev-server-api && bun i --frozen-lockfile && cd ../dev-server-frontend && bun i --frozen-lockfile",
1555
+ start: "bun cli.ts",
1556
+ "start:dev-server:dev": "TSCI_DEV_SERVER_DB=$(pwd)/.tscircuit/dev-server.db concurrently 'cd dev-server-api && bun start' 'cd dev-server-frontend && bun start'",
1557
+ "start:dev-server": "bun build:dev-server && bun cli.ts dev -y --cwd ./tests/assets/example-project",
1558
+ "build:dev-server": "cd dev-server-api && bun run build && cd ../dev-server-frontend && bun run build",
1559
+ "build:cli": "bun build-cli.ts",
1560
+ build: "bun build:dev-server && npm run build:cli",
1561
+ "test:init": "bun cli.ts init --dir ./tmp/test --name test"
1562
+ },
1563
+ bin: {
1564
+ tscircuit: "./dist/cli.js",
1565
+ tsci: "./dist/cli.js"
1566
+ },
1567
+ keywords: [
1568
+ "circuit",
1569
+ "react",
1570
+ "electronics",
1571
+ "pcb",
1572
+ "schematic"
1573
+ ],
1574
+ author: "",
1575
+ license: "ISC",
1576
+ dependencies: {
1577
+ "@edge-runtime/primitives": "^4.1.0",
1578
+ "@hono/node-server": "^1.8.2",
1579
+ "@tscircuit/builder": "^1.5.4",
1580
+ "@tscircuit/react-fiber": "^1.0.6",
1581
+ axios: "^1.6.7",
1582
+ "better-sqlite3": "^9.4.3",
1583
+ chokidar: "^3.6.0",
1584
+ commander: "^12.0.0",
1585
+ configstore: "^6.0.0",
1586
+ dargs: "^8.1.0",
1587
+ "dax-sh": "^0.39.2",
1588
+ delay: "^6.0.0",
1589
+ edgespec: "^0.0.69",
1590
+ esbuild: "^0.20.2",
1591
+ glob: "^10.3.10",
1592
+ hono: "^4.1.0",
1593
+ ignore: "^5.3.1",
1594
+ kleur: "^4.1.5",
1595
+ "kysely-bun-sqlite": "^0.3.2",
1596
+ lodash: "^4.17.21",
1597
+ "mime-types": "^2.1.35",
1598
+ minimist: "^1.2.8",
1599
+ "node-persist": "^4.0.1",
1600
+ open: "^10.1.0",
1601
+ "perfect-cli": "^1.0.16",
1602
+ prompts: "^2.4.2",
1603
+ react: "^18.2.0",
1604
+ semver: "^7.6.0",
1605
+ zod: "latest"
1606
+ },
1607
+ devDependencies: {
1608
+ "@types/bun": "^1.0.8",
1609
+ "@types/chokidar": "^2.1.3",
1610
+ "@types/configstore": "^6.0.2",
1611
+ "@types/lodash": "^4.14.202",
1612
+ "@types/mime-types": "^2.1.4",
1613
+ "@types/minimist": "^1.2.5",
1614
+ "@types/node": "^20.10.6",
1615
+ "@types/prompts": "^2.4.9",
1616
+ "@types/react": "^18.2.64",
1617
+ "@types/semver": "^7.5.8",
1618
+ ava: "^6.1.1",
1619
+ concurrently: "^8.2.2",
1620
+ tsx: "^4.7.1",
1621
+ typescript: "^5.3.3"
1622
+ }
1623
+ };
1624
+
1625
+ // lib/cmd-fns/version.ts
1626
+ var versionCmd = async (ctx, args2) => {
1627
+ console.log(`tsci v${package_default.version}`);
1628
+ };
1590
1629
  // lib/get-program.ts
1591
1630
  var getProgram = (ctx) => {
1592
1631
  const cmd = new Command("tsci");
1593
- cmd.version(package_default.version);
1594
1632
  const authCmd = cmd.command("auth");
1595
1633
  authCmd.command("login").action((args2) => authLogin(ctx, args2));
1596
1634
  authCmd.command("logout").action((args2) => authLogout(ctx, args2));
@@ -1612,6 +1650,7 @@ var getProgram = (ctx) => {
1612
1650
  packageReleases.command("list").requiredOption("--package-name <package_name>", "Package name").option("--verbose", "Verbose objects (includes uuids)").action((args2) => packageReleasesList(ctx, args2));
1613
1651
  packageReleases.command("get").action((args2) => packageReleasesGet(ctx, args2));
1614
1652
  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));
1653
+ 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));
1615
1654
  const packageFiles = cmd.command("package_files");
1616
1655
  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));
1617
1656
  packageFiles.command("get").action((args2) => packageFilesGet(ctx, args2));
@@ -1623,7 +1662,7 @@ var getProgram = (ctx) => {
1623
1662
  packageExamples.command("get").requiredOption("--package-example-id <package_example_id>").action((args2) => packageExamplesGet(ctx, args2));
1624
1663
  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));
1625
1664
  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));
1626
- cmd.command("version").action(() => undefined(ctx, args));
1665
+ cmd.command("version").action(() => versionCmd(ctx, args));
1627
1666
  cmd.command("login").action((args2) => authLogin(ctx, args2));
1628
1667
  cmd.command("logout").action((args2) => authLogout(ctx, args2));
1629
1668
  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));
@@ -1770,12 +1809,12 @@ var interactForPackageNameWithVersion = async ({
1770
1809
  ]
1771
1810
  });
1772
1811
  if (selectedPackage.endsWith("@...")) {
1773
- const { version: version2 } = await prompts3({
1812
+ const { version } = await prompts3({
1774
1813
  type: "text",
1775
1814
  name: "version",
1776
1815
  message: "Enter the version"
1777
1816
  });
1778
- return selectedPackage.replace("@...", `@${version2}`);
1817
+ return selectedPackage.replace("@...", `@${version}`);
1779
1818
  }
1780
1819
  if (selectedPackage === "Enter Manually") {
1781
1820
  const { packageName } = await prompts3({
@@ -1877,13 +1916,6 @@ var createConfigHandler = ({
1877
1916
 
1878
1917
  // lib/util/create-context-and-run-program.ts
1879
1918
  import dargs from "dargs";
1880
-
1881
- // lib/cmd-fns/version.ts
1882
- var versionCmd = async (ctx, args2) => {
1883
- console.log(`tsci v${package_default.version}`);
1884
- };
1885
-
1886
- // lib/util/create-context-and-run-program.ts
1887
1919
  var createContextAndRunProgram = async (process_args) => {
1888
1920
  const args2 = minimist(process_args);
1889
1921
  const { global_config, profile_config, current_profile } = createConfigHandler({
@@ -1903,6 +1935,7 @@ var createContextAndRunProgram = async (process_args) => {
1903
1935
  Authorization: `Bearer ${profile_config.get("session_token")}`
1904
1936
  }
1905
1937
  });
1938
+ axios.defaults.headers.common["Accept-Encoding"] = "gzip";
1906
1939
  if (global_config.get("log_requests")) {
1907
1940
  console.log(`Using registry_url: ${registry_url}`);
1908
1941
  axios.interceptors.request.use((req) => {
@@ -5,6 +5,10 @@ export const getDevServerAxios = ({ serverUrl }: { serverUrl: string }) => {
5
5
  const devServerAxios = defaultAxios.create({
6
6
  baseURL: serverUrl,
7
7
  })
8
+
9
+ // https://github.com/oven-sh/bun/issues/267
10
+ devServerAxios.defaults.headers.common["Accept-Encoding"] = "gzip"
11
+
8
12
  devServerAxios.interceptors.response.use(
9
13
  (res) => res,
10
14
  (err) => {
@@ -15,6 +15,7 @@ export { packageFilesUploadDirectory } from "./package-files-upload-directory"
15
15
  export { packageReleasesList } from "./package-releases-list"
16
16
  export { packageReleasesGet } from "./package-releases-get"
17
17
  export { packageReleasesCreate } from "./package-releases-create"
18
+ export { packageReleasesUpdate } from "./package-releases-update"
18
19
  export { packageFilesList } from "./package-files-list"
19
20
  export { packageFilesGet } from "./package-files-get"
20
21
  export { packageFilesDownload } from "./package-files-download"
@@ -33,3 +34,4 @@ export { uninstallCmd as uninstall } from "./uninstall"
33
34
  export { devServerUpload } from "./dev-server-upload"
34
35
  export { configClear } from "./config-clear"
35
36
  export { openCmd as open } from "./open"
37
+ export { versionCmd as version } from "./version"
@@ -0,0 +1,45 @@
1
+ import { AppContext } from "../util/app-context"
2
+ import { z } from "zod"
3
+ import kleur from "kleur"
4
+
5
+ export const packageReleasesUpdate = async (ctx: AppContext, args: any) => {
6
+ const params = z
7
+ .object({
8
+ packageNameWithVersion: z.string().optional(),
9
+ packageName: z.string().optional(),
10
+ version: z.string().optional(),
11
+ isLatest: z.boolean().optional(),
12
+ isLocked: z.boolean().optional(),
13
+ })
14
+ .refine((d) => {
15
+ if (d.packageNameWithVersion) return true
16
+ if (d.packageName && d.version) return true
17
+ return false
18
+ }, "Either packageNameWithVersion or packageName and version must be provided")
19
+ .parse(args)
20
+
21
+ let { packageNameWithVersion, packageName, version } = params
22
+
23
+ if (!packageNameWithVersion) {
24
+ packageNameWithVersion = `${packageName}@${version}`
25
+ }
26
+
27
+ const delta: {
28
+ is_latest?: boolean
29
+ is_locked?: boolean
30
+ } = {}
31
+
32
+ if (params.isLatest !== undefined) {
33
+ delta.is_latest = params.isLatest
34
+ }
35
+ if (params.isLocked !== undefined) {
36
+ delta.is_locked = params.isLocked
37
+ }
38
+
39
+ await ctx.axios.post("/package_releases/update", {
40
+ package_name_with_version: packageNameWithVersion,
41
+ ...delta,
42
+ })
43
+
44
+ console.log(`Package release updated!`)
45
+ }
@@ -23,8 +23,6 @@ import * as CMDFN from "lib/cmd-fns"
23
23
  export const getProgram = (ctx: AppContext) => {
24
24
  const cmd = new Command("tsci")
25
25
 
26
- cmd.version(packageJson.version)
27
-
28
26
  const authCmd = cmd.command("auth")
29
27
  authCmd.command("login").action((args) => CMDFN.authLogin(ctx, args))
30
28
  authCmd.command("logout").action((args) => CMDFN.authLogout(ctx, args))
@@ -96,6 +94,15 @@ export const getProgram = (ctx: AppContext) => {
96
94
  .option("--package-name <package_name>", "Package name")
97
95
  .option("--release-version <release_version>", "Version to publish")
98
96
  .action((args) => CMDFN.packageReleasesCreate(ctx, args))
97
+ packageReleases
98
+ .command("update")
99
+ .option(
100
+ "-p, --package-name-with-version <package_name_with_version>",
101
+ "Package name and version"
102
+ )
103
+ .option("--is-latest", "Make package release the latest version")
104
+ .option("--is-locked", "Lock the release")
105
+ .action((args) => CMDFN.packageReleasesUpdate(ctx, args))
99
106
 
100
107
  const packageFiles = cmd.command("package_files")
101
108
 
@@ -48,6 +48,9 @@ export const createContextAndRunProgram = async (process_args: any) => {
48
48
  },
49
49
  })
50
50
 
51
+ // https://github.com/oven-sh/bun/issues/267
52
+ axios.defaults.headers.common["Accept-Encoding"] = "gzip"
53
+
51
54
  if (global_config.get("log_requests")) {
52
55
  console.log(`Using registry_url: ${registry_url}`)
53
56
  axios.interceptors.request.use((req) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Command line tool for developing, publishing and installing tscircuit circuits",