@tscircuit/cli 0.0.9 → 0.0.15
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.
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Release Workflow
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build_and_release:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout code
|
|
14
|
+
uses: actions/checkout@v2
|
|
15
|
+
|
|
16
|
+
- uses: actions/setup-node@v4
|
|
17
|
+
with:
|
|
18
|
+
node-version: 20
|
|
19
|
+
registry-url: https://registry.npmjs.org/
|
|
20
|
+
|
|
21
|
+
- name: Setup bun
|
|
22
|
+
uses: oven-sh/setup-bun@v1
|
|
23
|
+
with:
|
|
24
|
+
bun-version: latest
|
|
25
|
+
|
|
26
|
+
- name: Install project dependencies
|
|
27
|
+
run: bun run bootstrap
|
|
28
|
+
|
|
29
|
+
- name: Build project
|
|
30
|
+
run: bun run build
|
|
31
|
+
|
|
32
|
+
- name: Run pver release
|
|
33
|
+
run: npx pver release
|
|
34
|
+
env:
|
|
35
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/dist/cli.js
CHANGED
|
@@ -209,13 +209,13 @@ import {Command} from "commander";
|
|
|
209
209
|
// package.json
|
|
210
210
|
var package_default = {
|
|
211
211
|
name: "@tscircuit/cli",
|
|
212
|
-
version: "0.0.
|
|
212
|
+
version: "0.0.14",
|
|
213
213
|
private: false,
|
|
214
214
|
type: "module",
|
|
215
215
|
description: "Command line tool for developing, publishing and installing tscircuit circuits",
|
|
216
216
|
main: "./dist/cli.js",
|
|
217
217
|
scripts: {
|
|
218
|
-
bootstrap: "bun i && cd dev-server-api && bun i && cd ../dev-server-frontend && bun i",
|
|
218
|
+
bootstrap: "bun i --frozen-lockfile && cd dev-server-api && bun i --frozen-lockfile && cd ../dev-server-frontend && bun i --frozen-lockfile",
|
|
219
219
|
start: "bun cli.ts",
|
|
220
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
221
|
"start:dev-server": "bun build:dev-server && bun cli.ts dev -y --cwd ./tests/assets/example-project",
|
|
@@ -228,7 +228,13 @@ var package_default = {
|
|
|
228
228
|
tscircuit: "./dist/cli.js",
|
|
229
229
|
tsci: "./dist/cli.js"
|
|
230
230
|
},
|
|
231
|
-
keywords: [
|
|
231
|
+
keywords: [
|
|
232
|
+
"circuit",
|
|
233
|
+
"react",
|
|
234
|
+
"electronics",
|
|
235
|
+
"pcb",
|
|
236
|
+
"schematic"
|
|
237
|
+
],
|
|
232
238
|
author: "",
|
|
233
239
|
license: "ISC",
|
|
234
240
|
dependencies: {
|
|
@@ -281,35 +287,35 @@ var package_default = {
|
|
|
281
287
|
};
|
|
282
288
|
|
|
283
289
|
// lib/cmd-fns/config-reveal-location.ts
|
|
284
|
-
var configRevealLocation = async (ctx,
|
|
290
|
+
var configRevealLocation = async (ctx, args2) => {
|
|
285
291
|
console.log(`tsci config path: ${ctx.global_config.path}`);
|
|
286
292
|
};
|
|
287
293
|
// lib/cmd-fns/config-set-registry.ts
|
|
288
294
|
import {z} from "zod";
|
|
289
|
-
var configSetRegistry = async (ctx,
|
|
290
|
-
const params = z.object({ server: z.string().url() }).parse(
|
|
295
|
+
var configSetRegistry = async (ctx, args2) => {
|
|
296
|
+
const params = z.object({ server: z.string().url() }).parse(args2);
|
|
291
297
|
ctx.profile_config.set("registry_url", params.server);
|
|
292
298
|
};
|
|
293
299
|
// lib/cmd-fns/config-set-session.ts
|
|
294
300
|
import {z as z2} from "zod";
|
|
295
|
-
var configSetSession = async (ctx,
|
|
296
|
-
const params = z2.object({ sessionToken: z2.string() }).parse(
|
|
301
|
+
var configSetSession = async (ctx, args2) => {
|
|
302
|
+
const params = z2.object({ sessionToken: z2.string() }).parse(args2);
|
|
297
303
|
ctx.profile_config.set("session_token", params.sessionToken);
|
|
298
304
|
};
|
|
299
305
|
// lib/cmd-fns/config-set-log-requests.ts
|
|
300
306
|
import {z as z3} from "zod";
|
|
301
|
-
var configSetLogRequests = async (ctx,
|
|
302
|
-
const params = z3.object({ logRequests: z3.boolean() }).parse(
|
|
307
|
+
var configSetLogRequests = async (ctx, args2) => {
|
|
308
|
+
const params = z3.object({ logRequests: z3.boolean() }).parse(args2);
|
|
303
309
|
ctx.global_config.set("log_requests", params.logRequests);
|
|
304
310
|
};
|
|
305
311
|
// lib/cmd-fns/config-print-config.ts
|
|
306
312
|
import {readFile} from "fs/promises";
|
|
307
|
-
var configPrintConfig = async (ctx,
|
|
313
|
+
var configPrintConfig = async (ctx, args2) => {
|
|
308
314
|
console.log((await readFile(ctx.global_config.path)).toString());
|
|
309
315
|
};
|
|
310
316
|
// lib/cmd-fns/auth-login.ts
|
|
311
317
|
import delay from "delay";
|
|
312
|
-
var authLogin = async (ctx,
|
|
318
|
+
var authLogin = async (ctx, args2) => {
|
|
313
319
|
const {
|
|
314
320
|
data: { login_page }
|
|
315
321
|
} = await ctx.axios.post("/sessions/login_page/create", {});
|
|
@@ -348,22 +354,22 @@ var authLogin = async (ctx, args) => {
|
|
|
348
354
|
};
|
|
349
355
|
// lib/cmd-fns/auth-logout.ts
|
|
350
356
|
import kleur from "kleur";
|
|
351
|
-
var authLogout = async (ctx,
|
|
357
|
+
var authLogout = async (ctx, args2) => {
|
|
352
358
|
ctx.profile_config.delete("session_token");
|
|
353
359
|
console.log(kleur.green("Logged out!"));
|
|
354
360
|
};
|
|
355
361
|
// lib/cmd-fns/auth-sessions-create.ts
|
|
356
|
-
var authSessionsCreate = async (ctx,
|
|
362
|
+
var authSessionsCreate = async (ctx, args2) => {
|
|
357
363
|
};
|
|
358
364
|
// lib/cmd-fns/auth-sessions-list.ts
|
|
359
|
-
var authSessionsList = async (ctx,
|
|
365
|
+
var authSessionsList = async (ctx, args2) => {
|
|
360
366
|
await ctx.axios.get("/sessions/list");
|
|
361
367
|
};
|
|
362
368
|
// lib/cmd-fns/auth-sessions-get.ts
|
|
363
|
-
var authSessionsGet = async (ctx,
|
|
369
|
+
var authSessionsGet = async (ctx, args2) => {
|
|
364
370
|
};
|
|
365
371
|
// lib/cmd-fns/packages-list.ts
|
|
366
|
-
var packagesList = async (ctx,
|
|
372
|
+
var packagesList = async (ctx, args2) => {
|
|
367
373
|
const {
|
|
368
374
|
data: { packages }
|
|
369
375
|
} = await ctx.axios.post("/packages/list", {});
|
|
@@ -378,9 +384,9 @@ var packagesList = async (ctx, args) => {
|
|
|
378
384
|
};
|
|
379
385
|
// lib/cmd-fns/packages-get.ts
|
|
380
386
|
import {z as z4} from "zod";
|
|
381
|
-
var packagesGet = async (ctx,
|
|
382
|
-
|
|
383
|
-
const params = z4.object({ package_id: z4.string() }).or(z4.object({ name: z4.string() })).parse(
|
|
387
|
+
var packagesGet = async (ctx, args2) => {
|
|
388
|
+
args2.packageId = args2.package_id;
|
|
389
|
+
const params = z4.object({ package_id: z4.string() }).or(z4.object({ name: z4.string() })).parse(args2);
|
|
384
390
|
const {
|
|
385
391
|
data: { package: pkg }
|
|
386
392
|
} = await ctx.axios.post("/packages/get", params);
|
|
@@ -388,25 +394,25 @@ var packagesGet = async (ctx, args) => {
|
|
|
388
394
|
};
|
|
389
395
|
// lib/cmd-fns/packages-create.ts
|
|
390
396
|
import {z as z5} from "zod";
|
|
391
|
-
var packagesCreate = async (ctx,
|
|
397
|
+
var packagesCreate = async (ctx, args2) => {
|
|
392
398
|
const params = z5.object({
|
|
393
399
|
name: z5.string(),
|
|
394
400
|
description: z5.string().optional(),
|
|
395
401
|
authorAccountId: z5.string().optional()
|
|
396
|
-
}).parse(
|
|
402
|
+
}).parse(args2);
|
|
397
403
|
await ctx.axios.post("/packages/create", params);
|
|
398
404
|
console.log(`Package "${params.name}" created!`);
|
|
399
405
|
};
|
|
400
406
|
// lib/cmd-fns/package-files-upload-directory.ts
|
|
401
|
-
var packageFilesUploadDirectory = async (ctx,
|
|
407
|
+
var packageFilesUploadDirectory = async (ctx, args2) => {
|
|
402
408
|
};
|
|
403
409
|
// lib/cmd-fns/package-releases-list.ts
|
|
404
410
|
import {z as z6} from "zod";
|
|
405
|
-
var packageReleasesList = async (ctx,
|
|
411
|
+
var packageReleasesList = async (ctx, args2) => {
|
|
406
412
|
const params = z6.object({
|
|
407
413
|
packageName: z6.string().optional(),
|
|
408
414
|
verbose: z6.boolean().optional()
|
|
409
|
-
}).parse(
|
|
415
|
+
}).parse(args2);
|
|
410
416
|
const package_releases = await ctx.axios.post("/package_releases/list", {
|
|
411
417
|
package_name: params.packageName
|
|
412
418
|
}).then((r) => r.data.package_releases);
|
|
@@ -421,13 +427,13 @@ var packageReleasesList = async (ctx, args) => {
|
|
|
421
427
|
}
|
|
422
428
|
};
|
|
423
429
|
// lib/cmd-fns/package-releases-get.ts
|
|
424
|
-
var packageReleasesGet = async (ctx,
|
|
430
|
+
var packageReleasesGet = async (ctx, args2) => {
|
|
425
431
|
};
|
|
426
432
|
// lib/cmd-fns/package-releases-create.ts
|
|
427
433
|
import {z as z7} from "zod";
|
|
428
434
|
import kleur2 from "kleur";
|
|
429
|
-
var packageReleasesCreate = async (ctx,
|
|
430
|
-
|
|
435
|
+
var packageReleasesCreate = async (ctx, args2) => {
|
|
436
|
+
args2.version = args2.releaseVersion;
|
|
431
437
|
const params = z7.object({
|
|
432
438
|
packageNameWithVersion: z7.string().optional(),
|
|
433
439
|
packageName: z7.string().optional(),
|
|
@@ -438,7 +444,7 @@ var packageReleasesCreate = async (ctx, args) => {
|
|
|
438
444
|
if (d.packageName && d.version)
|
|
439
445
|
return true;
|
|
440
446
|
return false;
|
|
441
|
-
}, "Either packageNameWithVersion or packageName and version must be provided").parse(
|
|
447
|
+
}, "Either packageNameWithVersion or packageName and version must be provided").parse(args2);
|
|
442
448
|
let { packageNameWithVersion, packageName, version } = params;
|
|
443
449
|
if (!packageNameWithVersion) {
|
|
444
450
|
packageNameWithVersion = `${packageName}@${version}`;
|
|
@@ -450,13 +456,13 @@ var packageReleasesCreate = async (ctx, args) => {
|
|
|
450
456
|
};
|
|
451
457
|
// lib/cmd-fns/package-files-list.ts
|
|
452
458
|
import {z as z8} from "zod";
|
|
453
|
-
var packageFilesList = async (ctx,
|
|
459
|
+
var packageFilesList = async (ctx, args2) => {
|
|
454
460
|
const params = z8.object({
|
|
455
461
|
packageReleaseId: z8.string().optional(),
|
|
456
462
|
packageName: z8.string().optional(),
|
|
457
463
|
packageNameWithVersion: z8.string().optional(),
|
|
458
464
|
verbose: z8.boolean().optional()
|
|
459
|
-
}).parse(
|
|
465
|
+
}).parse(args2);
|
|
460
466
|
const package_files = await ctx.axios.post("/package_files/list", {
|
|
461
467
|
package_release_id: params.packageReleaseId,
|
|
462
468
|
package_name: params.packageName,
|
|
@@ -470,17 +476,17 @@ var packageFilesList = async (ctx, args) => {
|
|
|
470
476
|
}
|
|
471
477
|
};
|
|
472
478
|
// lib/cmd-fns/package-files-get.ts
|
|
473
|
-
var packageFilesGet = async (ctx,
|
|
479
|
+
var packageFilesGet = async (ctx, args2) => {
|
|
474
480
|
};
|
|
475
481
|
// lib/cmd-fns/package-files-download.ts
|
|
476
482
|
import {z as z9} from "zod";
|
|
477
483
|
import * as fs from "fs/promises";
|
|
478
|
-
var packageFilesDownload = async (ctx,
|
|
484
|
+
var packageFilesDownload = async (ctx, args2) => {
|
|
479
485
|
const params = z9.object({
|
|
480
486
|
packageNameWithVersion: z9.string().optional(),
|
|
481
487
|
remoteFilePath: z9.string().optional(),
|
|
482
488
|
output: z9.string().optional()
|
|
483
|
-
}).parse(
|
|
489
|
+
}).parse(args2);
|
|
484
490
|
const { packageNameWithVersion, remoteFilePath } = params;
|
|
485
491
|
const packageContent = await ctx.axios.post("/package_files/download", {
|
|
486
492
|
package_name_with_version: packageNameWithVersion,
|
|
@@ -497,12 +503,12 @@ var packageFilesDownload = async (ctx, args) => {
|
|
|
497
503
|
import {z as z10} from "zod";
|
|
498
504
|
import * as fs2 from "fs/promises";
|
|
499
505
|
import kleur3 from "kleur";
|
|
500
|
-
var packageFilesCreate = async (ctx,
|
|
506
|
+
var packageFilesCreate = async (ctx, args2) => {
|
|
501
507
|
const params = z10.object({
|
|
502
508
|
file: z10.string(),
|
|
503
509
|
packageReleaseId: z10.string().optional(),
|
|
504
510
|
packageNameWithVersion: z10.string().optional()
|
|
505
|
-
}).parse(
|
|
511
|
+
}).parse(args2);
|
|
506
512
|
const { file, packageNameWithVersion, packageReleaseId } = params;
|
|
507
513
|
const fileContent = await fs2.readFile(file);
|
|
508
514
|
const package_file = await ctx.axios.post("/package_files/create", {
|
|
@@ -515,10 +521,10 @@ var packageFilesCreate = async (ctx, args) => {
|
|
|
515
521
|
};
|
|
516
522
|
// lib/cmd-fns/package-examples-list.ts
|
|
517
523
|
import {z as z11} from "zod";
|
|
518
|
-
var packageExamplesList = async (ctx,
|
|
524
|
+
var packageExamplesList = async (ctx, args2) => {
|
|
519
525
|
const params = z11.object({
|
|
520
526
|
packageNameWithVersion: z11.string()
|
|
521
|
-
}).parse(
|
|
527
|
+
}).parse(args2);
|
|
522
528
|
const package_examples = await ctx.axios.post("/package_examples/list", {
|
|
523
529
|
package_name_with_version: params.packageNameWithVersion
|
|
524
530
|
}).then((r) => r.data.package_examples);
|
|
@@ -526,10 +532,10 @@ var packageExamplesList = async (ctx, args) => {
|
|
|
526
532
|
};
|
|
527
533
|
// lib/cmd-fns/package-examples-get.ts
|
|
528
534
|
import {z as z12} from "zod";
|
|
529
|
-
var packageExamplesGet = async (ctx,
|
|
535
|
+
var packageExamplesGet = async (ctx, args2) => {
|
|
530
536
|
const params = z12.object({
|
|
531
537
|
packageExampleId: z12.string().uuid()
|
|
532
|
-
}).parse(
|
|
538
|
+
}).parse(args2);
|
|
533
539
|
const { packageExampleId: package_example_id } = params;
|
|
534
540
|
const package_example = await ctx.axios.post("/package_examples/get", {
|
|
535
541
|
package_example_id
|
|
@@ -589,12 +595,12 @@ console.log(JSON.stringify(elements))
|
|
|
589
595
|
// lib/cmd-fns/package-examples-create.ts
|
|
590
596
|
import {z as z13} from "zod";
|
|
591
597
|
import fs3 from "fs";
|
|
592
|
-
var packageExamplesCreate = async (ctx,
|
|
598
|
+
var packageExamplesCreate = async (ctx, args2) => {
|
|
593
599
|
const params = z13.object({
|
|
594
600
|
packageNameWithVersion: z13.string(),
|
|
595
601
|
file: z13.string(),
|
|
596
602
|
export: z13.string().optional().default("default")
|
|
597
|
-
}).parse(
|
|
603
|
+
}).parse(args2);
|
|
598
604
|
const tscircuit_soup = await soupify({
|
|
599
605
|
filePath: params.file,
|
|
600
606
|
exportName: params.export
|
|
@@ -641,6 +647,9 @@ var getGeneratedReadme = ({
|
|
|
641
647
|
}) => {
|
|
642
648
|
return `
|
|
643
649
|
# ${name}
|
|
650
|
+
|
|
651
|
+
[})](https://registry.tscircuit.com/${name.replace("@", "")})
|
|
652
|
+
|
|
644
653
|
${shouldHaveProjectGeneratedNotice ? `\n\n> This project was generated using [tsci](https://github.com/tscircuit/tscircuit)\n` : ""}
|
|
645
654
|
To develop and view the examples, run \`tsci dev\` and open [http://localhost:3020](http://localhost:3020) in your browser.
|
|
646
655
|
|
|
@@ -683,12 +692,12 @@ import $2 from "dax-sh";
|
|
|
683
692
|
import semver from "semver";
|
|
684
693
|
import {unlink as unlink2} from "fs/promises";
|
|
685
694
|
import esbuild from "esbuild";
|
|
686
|
-
var publish = async (ctx,
|
|
695
|
+
var publish = async (ctx, args2) => {
|
|
687
696
|
const params = z14.object({
|
|
688
697
|
increment: z14.boolean().optional(),
|
|
689
698
|
patch: z14.boolean().optional(),
|
|
690
699
|
lock: z14.boolean().optional()
|
|
691
|
-
}).parse(
|
|
700
|
+
}).parse(args2);
|
|
692
701
|
if (typeof Bun === "undefined") {
|
|
693
702
|
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---------------------"));
|
|
694
703
|
process.exit(1);
|
|
@@ -839,12 +848,12 @@ var publish = async (ctx, args) => {
|
|
|
839
848
|
// lib/cmd-fns/soupify.ts
|
|
840
849
|
import {z as z15} from "zod";
|
|
841
850
|
import {writeFileSync as writeFileSync2} from "fs";
|
|
842
|
-
var soupifyCmd = async (ctx,
|
|
851
|
+
var soupifyCmd = async (ctx, args2) => {
|
|
843
852
|
const params = z15.object({
|
|
844
853
|
file: z15.string(),
|
|
845
854
|
export: z15.string().optional(),
|
|
846
855
|
output: z15.string().optional()
|
|
847
|
-
}).parse(
|
|
856
|
+
}).parse(args2);
|
|
848
857
|
const soup = await soupify({
|
|
849
858
|
filePath: params.file,
|
|
850
859
|
exportName: params.export
|
|
@@ -1347,12 +1356,12 @@ var getGeneratedTsconfig = () => `
|
|
|
1347
1356
|
`.trim();
|
|
1348
1357
|
|
|
1349
1358
|
// lib/cmd-fns/init/index.ts
|
|
1350
|
-
var initCmd = async (ctx,
|
|
1359
|
+
var initCmd = async (ctx, args2) => {
|
|
1351
1360
|
const params = z17.object({
|
|
1352
1361
|
name: z17.string().optional(),
|
|
1353
1362
|
dir: z17.string().optional(),
|
|
1354
1363
|
runtime: z17.enum(["bun", "node"]).optional()
|
|
1355
|
-
}).parse(
|
|
1364
|
+
}).parse(args2);
|
|
1356
1365
|
if (params.name && !params.dir) {
|
|
1357
1366
|
params.dir = `./${params.name.split("/").pop()}`;
|
|
1358
1367
|
} else if (!params.dir) {
|
|
@@ -1433,11 +1442,11 @@ export const MyExample = () => (
|
|
|
1433
1442
|
};
|
|
1434
1443
|
|
|
1435
1444
|
// lib/cmd-fns/dev/index.ts
|
|
1436
|
-
var devCmd = async (ctx,
|
|
1445
|
+
var devCmd = async (ctx, args2) => {
|
|
1437
1446
|
const params = z18.object({
|
|
1438
1447
|
cwd: z18.string().optional().default(process.cwd()),
|
|
1439
1448
|
port: z18.coerce.number().optional().default(3020)
|
|
1440
|
-
}).parse(
|
|
1449
|
+
}).parse(args2);
|
|
1441
1450
|
const { cwd, port } = params;
|
|
1442
1451
|
const isInitialized = await checkIfInitialized(ctx);
|
|
1443
1452
|
if (!isInitialized) {
|
|
@@ -1495,11 +1504,11 @@ var devCmd = async (ctx, args) => {
|
|
|
1495
1504
|
import kleur12 from "kleur";
|
|
1496
1505
|
import {z as z19} from "zod";
|
|
1497
1506
|
import $4 from "dax-sh";
|
|
1498
|
-
var addCmd = async (ctx,
|
|
1507
|
+
var addCmd = async (ctx, args2) => {
|
|
1499
1508
|
const params = z19.object({
|
|
1500
1509
|
packages: z19.array(z19.string()),
|
|
1501
1510
|
flags: z19.object({ dev: z19.boolean().optional().default(false) }).optional().default({})
|
|
1502
|
-
}).parse(
|
|
1511
|
+
}).parse(args2);
|
|
1503
1512
|
params.packages = params.packages.map((p) => p.replace(/^@/, ""));
|
|
1504
1513
|
await createOrModifyNpmrc({ quiet: true }, ctx);
|
|
1505
1514
|
$4.cd(ctx.cwd);
|
|
@@ -1512,11 +1521,11 @@ var addCmd = async (ctx, args) => {
|
|
|
1512
1521
|
import kleur13 from "kleur";
|
|
1513
1522
|
import {z as z20} from "zod";
|
|
1514
1523
|
import $5 from "dax-sh";
|
|
1515
|
-
var removeCmd = async (ctx,
|
|
1524
|
+
var removeCmd = async (ctx, args2) => {
|
|
1516
1525
|
const params = z20.object({
|
|
1517
1526
|
packages: z20.array(z20.string()),
|
|
1518
1527
|
flags: z20.object({}).optional().default({})
|
|
1519
|
-
}).parse(
|
|
1528
|
+
}).parse(args2);
|
|
1520
1529
|
params.packages = params.packages.map((p) => p.replace(/^@/, ""));
|
|
1521
1530
|
await createOrModifyNpmrc({ quiet: true }, ctx);
|
|
1522
1531
|
$5.cd(ctx.cwd);
|
|
@@ -1529,11 +1538,11 @@ var removeCmd = async (ctx, args) => {
|
|
|
1529
1538
|
import kleur14 from "kleur";
|
|
1530
1539
|
import {z as z21} from "zod";
|
|
1531
1540
|
import $6 from "dax-sh";
|
|
1532
|
-
var installCmd = async (ctx,
|
|
1541
|
+
var installCmd = async (ctx, args2) => {
|
|
1533
1542
|
const params = z21.object({
|
|
1534
1543
|
packages: z21.array(z21.string()),
|
|
1535
1544
|
flags: z21.object({ dev: z21.boolean().optional().default(false) }).optional().default({})
|
|
1536
|
-
}).parse(
|
|
1545
|
+
}).parse(args2);
|
|
1537
1546
|
params.packages = params.packages.map((p) => p.replace(/^@/, ""));
|
|
1538
1547
|
await createOrModifyNpmrc({ quiet: true }, ctx);
|
|
1539
1548
|
$6.cd(ctx.cwd);
|
|
@@ -1548,12 +1557,12 @@ import {z as z23} from "zod";
|
|
|
1548
1557
|
import $7 from "dax-sh";
|
|
1549
1558
|
// lib/cmd-fns/dev-server-upload.ts
|
|
1550
1559
|
import {z as z25} from "zod";
|
|
1551
|
-
var devServerUpload = async (ctx,
|
|
1560
|
+
var devServerUpload = async (ctx, args2) => {
|
|
1552
1561
|
const params = z25.object({
|
|
1553
1562
|
dir: z25.string().optional().default(ctx.cwd),
|
|
1554
1563
|
port: z25.coerce.number().optional().default(3020),
|
|
1555
1564
|
watch: z25.boolean().optional().default(false)
|
|
1556
|
-
}).parse(
|
|
1565
|
+
}).parse(args2);
|
|
1557
1566
|
const serverUrl = `http://localhost:${params.port}`;
|
|
1558
1567
|
const devServerAxios = getDevServerAxios({ serverUrl });
|
|
1559
1568
|
console.log(`Loading examples...`);
|
|
@@ -1567,7 +1576,7 @@ import {existsSync as existsSync4, readFileSync as readFileSync6} from "fs";
|
|
|
1567
1576
|
import kleur16 from "kleur";
|
|
1568
1577
|
import * as Path8 from "path";
|
|
1569
1578
|
import open2 from "open";
|
|
1570
|
-
var openCmd = async (ctx,
|
|
1579
|
+
var openCmd = async (ctx, args2) => {
|
|
1571
1580
|
const packageJsonPath = Path8.join(ctx.cwd, "package.json");
|
|
1572
1581
|
if (!existsSync4(packageJsonPath)) {
|
|
1573
1582
|
console.log(kleur16.red("No package.json found in current directory"));
|
|
@@ -1583,50 +1592,50 @@ var getProgram = (ctx) => {
|
|
|
1583
1592
|
const cmd = new Command("tsci");
|
|
1584
1593
|
cmd.version(package_default.version);
|
|
1585
1594
|
const authCmd = cmd.command("auth");
|
|
1586
|
-
authCmd.command("login").action((
|
|
1587
|
-
authCmd.command("logout").action((
|
|
1595
|
+
authCmd.command("login").action((args2) => authLogin(ctx, args2));
|
|
1596
|
+
authCmd.command("logout").action((args2) => authLogout(ctx, args2));
|
|
1588
1597
|
const configCmd = cmd.command("config");
|
|
1589
|
-
configCmd.command("reveal-location").action((
|
|
1590
|
-
configCmd.command("set-registry").requiredOption("--server <server>", "Registry URL").action((
|
|
1591
|
-
configCmd.command("set-session").requiredOption("--session-token <session_token>", "Session Token").action((
|
|
1592
|
-
configCmd.command("set-log-requests").requiredOption("--log-requests", "Should log requests to registry").action((
|
|
1593
|
-
configCmd.command("print-config").action((
|
|
1598
|
+
configCmd.command("reveal-location").action((args2) => configRevealLocation(ctx, args2));
|
|
1599
|
+
configCmd.command("set-registry").requiredOption("--server <server>", "Registry URL").action((args2) => configSetRegistry(ctx, args2));
|
|
1600
|
+
configCmd.command("set-session").requiredOption("--session-token <session_token>", "Session Token").action((args2) => configSetSession(ctx, args2));
|
|
1601
|
+
configCmd.command("set-log-requests").requiredOption("--log-requests", "Should log requests to registry").action((args2) => configSetLogRequests(ctx, args2));
|
|
1602
|
+
configCmd.command("print-config").action((args2) => configPrintConfig(ctx, args2));
|
|
1594
1603
|
const authSessionsCmd = authCmd.command("sessions");
|
|
1595
|
-
authSessionsCmd.command("create").action((
|
|
1596
|
-
authSessionsCmd.command("list").action((
|
|
1597
|
-
authSessionsCmd.command("get").action((
|
|
1604
|
+
authSessionsCmd.command("create").action((args2) => authSessionsCreate(ctx, args2));
|
|
1605
|
+
authSessionsCmd.command("list").action((args2) => authSessionsList(ctx, args2));
|
|
1606
|
+
authSessionsCmd.command("get").action((args2) => authSessionsGet(ctx, args2));
|
|
1598
1607
|
const packagesCmd = cmd.command("packages");
|
|
1599
|
-
packagesCmd.command("list").action((
|
|
1600
|
-
packagesCmd.command("get").option("--package-id <package_id>", "Package Id").option("--name <name>", "Package name").action((
|
|
1601
|
-
packagesCmd.command("create").requiredOption("--name <name>", "Package name").option("--author-id <author_account_id>", "Author Id").option("--description <description>", "Package description").action((
|
|
1608
|
+
packagesCmd.command("list").action((args2) => packagesList(ctx, args2));
|
|
1609
|
+
packagesCmd.command("get").option("--package-id <package_id>", "Package Id").option("--name <name>", "Package name").action((args2) => packagesGet(ctx, args2));
|
|
1610
|
+
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));
|
|
1602
1611
|
const packageReleases = cmd.command("package_releases");
|
|
1603
|
-
packageReleases.command("list").requiredOption("--package-name <package_name>", "Package name").option("--verbose", "Verbose objects (includes uuids)").action((
|
|
1604
|
-
packageReleases.command("get").action((
|
|
1605
|
-
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((
|
|
1612
|
+
packageReleases.command("list").requiredOption("--package-name <package_name>", "Package name").option("--verbose", "Verbose objects (includes uuids)").action((args2) => packageReleasesList(ctx, args2));
|
|
1613
|
+
packageReleases.command("get").action((args2) => packageReleasesGet(ctx, args2));
|
|
1614
|
+
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));
|
|
1606
1615
|
const packageFiles = cmd.command("package_files");
|
|
1607
|
-
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((
|
|
1608
|
-
packageFiles.command("get").action((
|
|
1609
|
-
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((
|
|
1610
|
-
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((
|
|
1611
|
-
packageFiles.command("upload-directory").requiredOption("--dir <dir>", "Directory to upload").action((
|
|
1616
|
+
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
|
+
packageFiles.command("get").action((args2) => packageFilesGet(ctx, args2));
|
|
1618
|
+
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));
|
|
1619
|
+
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));
|
|
1620
|
+
packageFiles.command("upload-directory").requiredOption("--dir <dir>", "Directory to upload").action((args2) => packageFilesUploadDirectory(ctx, args2));
|
|
1612
1621
|
const packageExamples = cmd.command("package_examples");
|
|
1613
|
-
packageExamples.command("list").requiredOption("--package-name-with-version <package_name_with_version>").action((
|
|
1614
|
-
packageExamples.command("get").requiredOption("--package-example-id <package_example_id>").action((
|
|
1615
|
-
packageExamples.command("create").requiredOption("--package-name-with-version <package_name_with_version>").requiredOption("--file <file>").option("--export <export>", "Name of export to soupify").action((
|
|
1616
|
-
cmd.command("publish").option("--increment", "Increase patch version").option("--patch", "Increase patch version").option("--lock", "Lock the release after publishing to prevent changes").action((
|
|
1617
|
-
cmd.command("version").action(() =>
|
|
1618
|
-
cmd.command("login").action((
|
|
1619
|
-
cmd.command("logout").action((
|
|
1620
|
-
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((
|
|
1621
|
-
cmd.command("dev").option("--cwd <cwd>", "Current working directory").option("--port <port>", "Port to run dev server on").action((
|
|
1622
|
-
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((
|
|
1622
|
+
packageExamples.command("list").requiredOption("--package-name-with-version <package_name_with_version>").action((args2) => packageExamplesList(ctx, args2));
|
|
1623
|
+
packageExamples.command("get").requiredOption("--package-example-id <package_example_id>").action((args2) => packageExamplesGet(ctx, args2));
|
|
1624
|
+
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
|
+
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));
|
|
1627
|
+
cmd.command("login").action((args2) => authLogin(ctx, args2));
|
|
1628
|
+
cmd.command("logout").action((args2) => authLogout(ctx, args2));
|
|
1629
|
+
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));
|
|
1630
|
+
cmd.command("dev").option("--cwd <cwd>", "Current working directory").option("--port <port>", "Port to run dev server on").action((args2) => devCmd(ctx, args2));
|
|
1631
|
+
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));
|
|
1623
1632
|
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 }));
|
|
1624
1633
|
cmd.command("remove").argument("<packages...>", "Packages to remove").action((packages, flags) => removeCmd(ctx, { packages, flags }));
|
|
1625
1634
|
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 }));
|
|
1626
1635
|
cmd.command("uninstall").argument("<packages...>", "Packages to uninstall").action((packages, flags) => installCmd(ctx, { packages, flags }));
|
|
1627
1636
|
const devServerCmd = cmd.command("dev-server");
|
|
1628
|
-
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((
|
|
1629
|
-
cmd.command("open").action((
|
|
1637
|
+
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));
|
|
1638
|
+
cmd.command("open").action((args2) => openCmd(ctx, args2));
|
|
1630
1639
|
return cmd;
|
|
1631
1640
|
};
|
|
1632
1641
|
|
|
@@ -1761,12 +1770,12 @@ var interactForPackageNameWithVersion = async ({
|
|
|
1761
1770
|
]
|
|
1762
1771
|
});
|
|
1763
1772
|
if (selectedPackage.endsWith("@...")) {
|
|
1764
|
-
const { version } = await prompts3({
|
|
1773
|
+
const { version: version2 } = await prompts3({
|
|
1765
1774
|
type: "text",
|
|
1766
1775
|
name: "version",
|
|
1767
1776
|
message: "Enter the version"
|
|
1768
1777
|
});
|
|
1769
|
-
return selectedPackage.replace("@...", `@${
|
|
1778
|
+
return selectedPackage.replace("@...", `@${version2}`);
|
|
1770
1779
|
}
|
|
1771
1780
|
if (selectedPackage === "Enter Manually") {
|
|
1772
1781
|
const { packageName } = await prompts3({
|
|
@@ -1868,17 +1877,24 @@ var createConfigHandler = ({
|
|
|
1868
1877
|
|
|
1869
1878
|
// lib/util/create-context-and-run-program.ts
|
|
1870
1879
|
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
|
|
1871
1887
|
var createContextAndRunProgram = async (process_args) => {
|
|
1872
|
-
const
|
|
1888
|
+
const args2 = minimist(process_args);
|
|
1873
1889
|
const { global_config, profile_config, current_profile } = createConfigHandler({
|
|
1874
|
-
profile:
|
|
1890
|
+
profile: args2.profile
|
|
1875
1891
|
});
|
|
1876
1892
|
const registry_url = profile_config.get("registry_url") ?? "https://registry-api.tscircuit.com";
|
|
1877
|
-
|
|
1878
|
-
for (const key in
|
|
1893
|
+
args2._ = args2._.map((p) => p.toLowerCase().replace(/-/g, "_"));
|
|
1894
|
+
for (const key in args2) {
|
|
1879
1895
|
if (key.includes("-")) {
|
|
1880
|
-
|
|
1881
|
-
delete
|
|
1896
|
+
args2[key.replace(/-/g, "_")] = args2[key];
|
|
1897
|
+
delete args2[key];
|
|
1882
1898
|
}
|
|
1883
1899
|
}
|
|
1884
1900
|
const axios = defaultAxios2.create({
|
|
@@ -1907,23 +1923,27 @@ var createContextAndRunProgram = async (process_args) => {
|
|
|
1907
1923
|
return Promise.reject(err);
|
|
1908
1924
|
});
|
|
1909
1925
|
const ctx = {
|
|
1910
|
-
cmd:
|
|
1911
|
-
cwd:
|
|
1926
|
+
cmd: args2._,
|
|
1927
|
+
cwd: args2.cwd ?? process.cwd(),
|
|
1912
1928
|
current_profile,
|
|
1913
1929
|
registry_url,
|
|
1914
1930
|
axios,
|
|
1915
1931
|
global_config,
|
|
1916
1932
|
profile_config,
|
|
1917
1933
|
args: {
|
|
1918
|
-
cmd:
|
|
1919
|
-
yes:
|
|
1934
|
+
cmd: args2._,
|
|
1935
|
+
yes: args2.y ?? args2.yes,
|
|
1920
1936
|
help: undefined
|
|
1921
1937
|
},
|
|
1922
|
-
params:
|
|
1938
|
+
params: args2
|
|
1923
1939
|
};
|
|
1924
|
-
delete
|
|
1925
|
-
const { _: positional, ...flagsAndParams } =
|
|
1940
|
+
delete args2["cwd"];
|
|
1941
|
+
const { _: positional, ...flagsAndParams } = args2;
|
|
1926
1942
|
const args_without_globals = positional.concat(dargs(flagsAndParams));
|
|
1943
|
+
if (args2["version"] && args2._.length === 2) {
|
|
1944
|
+
await versionCmd(ctx, {});
|
|
1945
|
+
process.exit(0);
|
|
1946
|
+
}
|
|
1927
1947
|
await perfectCli(getProgram(ctx), args_without_globals, {
|
|
1928
1948
|
async customParamHandler({ commandPath, optionName }, { prompts: prompts3 }) {
|
|
1929
1949
|
const optionNameHandler = PARAM_HANDLERS_BY_PARAM_NAME[_.snakeCase(optionName)];
|
|
@@ -7,6 +7,12 @@ export const getGeneratedReadme = ({
|
|
|
7
7
|
}) => {
|
|
8
8
|
return `
|
|
9
9
|
# ${name}
|
|
10
|
+
|
|
11
|
+
[})](https://registry.tscircuit.com/${name.replace("@", "")})
|
|
15
|
+
|
|
10
16
|
${
|
|
11
17
|
shouldHaveProjectGeneratedNotice
|
|
12
18
|
? `\n\n> This project was generated using [tsci](https://github.com/tscircuit/tscircuit)\n`
|
package/lib/get-program.ts
CHANGED
|
@@ -166,9 +166,7 @@ export const getProgram = (ctx: AppContext) => {
|
|
|
166
166
|
.option("--lock", "Lock the release after publishing to prevent changes")
|
|
167
167
|
.action((args) => CMDFN.publish(ctx, args))
|
|
168
168
|
|
|
169
|
-
cmd
|
|
170
|
-
.command("version")
|
|
171
|
-
.action(() => console.log(`tsci v${packageJson.version}`))
|
|
169
|
+
cmd.command("version").action(() => CMDFN.version(ctx, args))
|
|
172
170
|
|
|
173
171
|
cmd.command("login").action((args) => CMDFN.authLogin(ctx, args))
|
|
174
172
|
cmd.command("logout").action((args) => CMDFN.authLogout(ctx, args))
|
|
@@ -10,6 +10,7 @@ import kleur from "kleur"
|
|
|
10
10
|
import { PARAM_HANDLERS_BY_PARAM_NAME } from "lib/param-handlers"
|
|
11
11
|
import { createConfigHandler } from "lib/create-config-manager"
|
|
12
12
|
import dargs from "dargs"
|
|
13
|
+
import { versionCmd } from "lib/cmd-fns/version"
|
|
13
14
|
|
|
14
15
|
export type CliArgs = {
|
|
15
16
|
cmd: string[]
|
|
@@ -112,6 +113,11 @@ export const createContextAndRunProgram = async (process_args: any) => {
|
|
|
112
113
|
const { _: positional, ...flagsAndParams } = args
|
|
113
114
|
const args_without_globals = positional.concat(dargs(flagsAndParams))
|
|
114
115
|
|
|
116
|
+
if (args["version"] && args._.length === 2) {
|
|
117
|
+
await versionCmd(ctx, {})
|
|
118
|
+
process.exit(0)
|
|
119
|
+
}
|
|
120
|
+
|
|
115
121
|
await perfectCli(getProgram(ctx), args_without_globals, {
|
|
116
122
|
async customParamHandler({ commandPath, optionName }, { prompts }) {
|
|
117
123
|
const optionNameHandler =
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Command line tool for developing, publishing and installing tscircuit circuits",
|
|
7
7
|
"main": "./dist/cli.js",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"bootstrap": "bun i && cd dev-server-api && bun i && cd ../dev-server-frontend && bun i",
|
|
9
|
+
"bootstrap": "bun i --frozen-lockfile && cd dev-server-api && bun i --frozen-lockfile && cd ../dev-server-frontend && bun i --frozen-lockfile",
|
|
10
10
|
"start": "bun cli.ts",
|
|
11
11
|
"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'",
|
|
12
12
|
"start:dev-server": "bun build:dev-server && bun cli.ts dev -y --cwd ./tests/assets/example-project",
|
|
@@ -19,7 +19,13 @@
|
|
|
19
19
|
"tscircuit": "./dist/cli.js",
|
|
20
20
|
"tsci": "./dist/cli.js"
|
|
21
21
|
},
|
|
22
|
-
"keywords": [
|
|
22
|
+
"keywords": [
|
|
23
|
+
"circuit",
|
|
24
|
+
"react",
|
|
25
|
+
"electronics",
|
|
26
|
+
"pcb",
|
|
27
|
+
"schematic"
|
|
28
|
+
],
|
|
23
29
|
"author": "",
|
|
24
30
|
"license": "ISC",
|
|
25
31
|
"dependencies": {
|