@tscircuit/cli 0.1.141 → 0.1.143

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/main.js +29 -26
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -54,7 +54,7 @@ Commands:
54
54
  add <component> Add a tscircuit component package to your project
55
55
  remove <component> Remove a tscircuit component package from your
56
56
  project
57
- snapshot [options] Generate schematic and PCB snapshots (add --3d for
57
+ snapshot [options] [file] Generate schematic and PCB snapshots (add --3d for
58
58
  3d preview)
59
59
  setup Setup utilities like GitHub Actions
60
60
  upgrade Upgrade CLI to the latest version
package/dist/main.js CHANGED
@@ -442238,7 +442238,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
442238
442238
  import { execSync as execSync2 } from "node:child_process";
442239
442239
  var import_semver2 = __toESM2(require_semver2(), 1);
442240
442240
  // package.json
442241
- var version = "0.1.140";
442241
+ var version = "0.1.142";
442242
442242
  var package_default = {
442243
442243
  name: "@tscircuit/cli",
442244
442244
  version,
@@ -498742,6 +498742,7 @@ var snapshotProject = async ({
498742
498742
  threeD = false,
498743
498743
  pcbOnly = false,
498744
498744
  schematicOnly = false,
498745
+ filePaths = [],
498745
498746
  onExit = (code) => process.exit(code),
498746
498747
  onError = (msg) => console.error(msg),
498747
498748
  onSuccess = (msg) => console.log(msg)
@@ -498751,20 +498752,25 @@ var snapshotProject = async ({
498751
498752
  ...DEFAULT_IGNORED_PATTERNS,
498752
498753
  ...ignored.map(normalizeIgnorePattern)
498753
498754
  ];
498754
- const boardFiles = globbySync(["**/*.board.tsx", "**/*.circuit.tsx"], {
498755
- cwd: projectDir,
498756
- ignore
498757
- });
498758
- let files = boardFiles.map((f) => path26.join(projectDir, f));
498759
- const entry = await getEntrypoint({
498760
- projectDir,
498761
- onError,
498762
- onSuccess: () => {}
498763
- });
498764
- if (entry) {
498765
- const resolved = path26.resolve(projectDir, entry);
498766
- if (!files.includes(resolved)) {
498767
- files.unshift(resolved);
498755
+ let files = [];
498756
+ if (filePaths.length > 0) {
498757
+ files = filePaths.map((f) => path26.resolve(projectDir, f));
498758
+ } else {
498759
+ const boardFiles = globbySync(["**/*.board.tsx", "**/*.circuit.tsx"], {
498760
+ cwd: projectDir,
498761
+ ignore
498762
+ });
498763
+ files = boardFiles.map((f) => path26.join(projectDir, f));
498764
+ const entry = await getEntrypoint({
498765
+ projectDir,
498766
+ onError,
498767
+ onSuccess: () => {}
498768
+ });
498769
+ if (entry) {
498770
+ const resolved = path26.resolve(projectDir, entry);
498771
+ if (!files.includes(resolved)) {
498772
+ files.unshift(resolved);
498773
+ }
498768
498774
  }
498769
498775
  }
498770
498776
  if (files.length === 0) {
@@ -498808,7 +498814,9 @@ var snapshotProject = async ({
498808
498814
  if (mismatches.length > 0) {
498809
498815
  onError(`Snapshot mismatch:
498810
498816
  ${mismatches.join(`
498811
- `)}`);
498817
+ `)}
498818
+
498819
+ Run with --update to fix.`);
498812
498820
  return onExit(1);
498813
498821
  }
498814
498822
  onSuccess("All snapshots match");
@@ -498817,12 +498825,13 @@ ${mismatches.join(`
498817
498825
 
498818
498826
  // cli/snapshot/register.ts
498819
498827
  var registerSnapshot = (program3) => {
498820
- program3.command("snapshot").description("Generate schematic and PCB snapshots (add --3d for 3d preview)").option("-u, --update", "Update snapshots on disk").option("--3d", "Generate 3d preview snapshots").option("--pcb-only", "Generate only PCB snapshots").option("--schematic-only", "Generate only schematic snapshots").action(async (options) => {
498828
+ program3.command("snapshot").argument("[file]", "Path to the board or circuit file").description("Generate schematic and PCB snapshots (add --3d for 3d preview)").option("-u, --update", "Update snapshots on disk").option("--3d", "Generate 3d preview snapshots").option("--pcb-only", "Generate only PCB snapshots").option("--schematic-only", "Generate only schematic snapshots").action(async (file, options) => {
498821
498829
  await snapshotProject({
498822
498830
  update: options.update ?? false,
498823
498831
  threeD: options["3d"] ?? false,
498824
498832
  pcbOnly: options.pcbOnly ?? false,
498825
498833
  schematicOnly: options.schematicOnly ?? false,
498834
+ filePaths: file ? [file] : [],
498826
498835
  onExit: (code) => process.exit(code),
498827
498836
  onError: (msg) => console.error(msg),
498828
498837
  onSuccess: (msg) => console.log(msg)
@@ -498868,6 +498877,7 @@ jobs:
498868
498877
  on:
498869
498878
  push:
498870
498879
  branches: [main]
498880
+ pull_request:
498871
498881
 
498872
498882
  jobs:
498873
498883
  snapshot:
@@ -498876,14 +498886,7 @@ jobs:
498876
498886
  - uses: actions/checkout@v4
498877
498887
  - uses: oven-sh/setup-bun@v2
498878
498888
  - run: bun install
498879
- - run: bunx tsci snapshot --update
498880
- - name: Commit snapshots
498881
- run: |
498882
- git config --global user.name "github-actions[bot]"
498883
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
498884
- git add .
498885
- git commit -m "Update snapshots" || echo "No changes to commit"
498886
- git push
498889
+ - run: bunx tsci snapshot
498887
498890
  `;
498888
498891
  writeFileIfNotExists(path27.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
498889
498892
  writeFileIfNotExists(path27.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
@@ -498900,7 +498903,7 @@ var registerSetup = (program3) => {
498900
498903
  {
498901
498904
  title: "GitHub Action",
498902
498905
  value: "github-action",
498903
- description: "Automatically build, check and commit snapshots to the main branch",
498906
+ description: "Automatically build and check snapshots on push/pull-request",
498904
498907
  selected: true
498905
498908
  }
498906
498909
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.141",
3
+ "version": "0.1.143",
4
4
  "main": "dist/main.js",
5
5
  "devDependencies": {
6
6
  "@babel/standalone": "^7.26.9",