@tscircuit/cli 0.1.447 → 0.1.448

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 (2) hide show
  1. package/dist/main.js +38 -24
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -72198,7 +72198,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
72198
72198
  import { execSync as execSync2 } from "node:child_process";
72199
72199
  var import_semver2 = __toESM2(require_semver2(), 1);
72200
72200
  // package.json
72201
- var version = "0.1.446";
72201
+ var version = "0.1.447";
72202
72202
  var package_default = {
72203
72203
  name: "@tscircuit/cli",
72204
72204
  version,
@@ -77140,6 +77140,9 @@ var isSubPath = (maybeChild, maybeParent) => {
77140
77140
  const relative5 = path19.relative(maybeParent, maybeChild);
77141
77141
  return relative5 === "" || !relative5.startsWith("..") && !path19.isAbsolute(relative5);
77142
77142
  };
77143
+ var isGlobPattern = (str) => {
77144
+ return /[*?[\]{}]/.test(str);
77145
+ };
77143
77146
  var findBoardFiles = ({
77144
77147
  projectDir = process.cwd(),
77145
77148
  ignore = DEFAULT_IGNORED_PATTERNS,
@@ -77153,32 +77156,43 @@ var findBoardFiles = ({
77153
77156
  });
77154
77157
  const absoluteBoardFiles = relativeBoardFiles.map((f) => path19.join(resolvedProjectDir, f));
77155
77158
  const boardFileSet = new Set;
77156
- const resolvedPaths = filePaths.map((f) => path19.resolve(resolvedProjectDir, f));
77157
- if (resolvedPaths.length > 0) {
77158
- for (const targetPath of resolvedPaths) {
77159
- if (!fs19.existsSync(targetPath)) {
77160
- continue;
77161
- }
77162
- const stat4 = fs19.statSync(targetPath);
77163
- if (stat4.isDirectory()) {
77164
- const resolvedDir = path19.resolve(targetPath);
77165
- if (isSubPath(resolvedDir, resolvedProjectDir)) {
77166
- for (const boardFile of absoluteBoardFiles) {
77167
- if (isSubPath(boardFile, resolvedDir)) {
77168
- boardFileSet.add(boardFile);
77159
+ if (filePaths.length > 0) {
77160
+ for (const inputPath of filePaths) {
77161
+ if (isGlobPattern(inputPath)) {
77162
+ const matches = globbySync(inputPath, {
77163
+ cwd: resolvedProjectDir,
77164
+ ignore,
77165
+ absolute: true
77166
+ });
77167
+ for (const match of matches) {
77168
+ boardFileSet.add(match);
77169
+ }
77170
+ } else {
77171
+ const targetPath = path19.resolve(resolvedProjectDir, inputPath);
77172
+ if (!fs19.existsSync(targetPath)) {
77173
+ continue;
77174
+ }
77175
+ const stat4 = fs19.statSync(targetPath);
77176
+ if (stat4.isDirectory()) {
77177
+ const resolvedDir = path19.resolve(targetPath);
77178
+ if (isSubPath(resolvedDir, resolvedProjectDir)) {
77179
+ for (const boardFile of absoluteBoardFiles) {
77180
+ if (isSubPath(boardFile, resolvedDir)) {
77181
+ boardFileSet.add(boardFile);
77182
+ }
77183
+ }
77184
+ } else {
77185
+ const externalMatches = globbySync(boardFilePatterns, {
77186
+ cwd: resolvedDir,
77187
+ ignore
77188
+ }).map((f) => path19.join(resolvedDir, f));
77189
+ for (const match of externalMatches) {
77190
+ boardFileSet.add(match);
77169
77191
  }
77170
77192
  }
77171
77193
  } else {
77172
- const externalMatches = globbySync(boardFilePatterns, {
77173
- cwd: resolvedDir,
77174
- ignore
77175
- }).map((f) => path19.join(resolvedDir, f));
77176
- for (const match of externalMatches) {
77177
- boardFileSet.add(match);
77178
- }
77194
+ boardFileSet.add(targetPath);
77179
77195
  }
77180
- } else {
77181
- boardFileSet.add(targetPath);
77182
77196
  }
77183
77197
  }
77184
77198
  } else {
@@ -196248,7 +196262,7 @@ Run with --update to fix.`);
196248
196262
 
196249
196263
  // cli/snapshot/register.ts
196250
196264
  var registerSnapshot = (program3) => {
196251
- program3.command("snapshot").argument("[path]", "Path to the board, circuit file, or directory containing them").description("Generate schematic and PCB snapshots (add --3d for 3d preview)").option("-u, --update", "Update snapshots on disk").option("--force-update", "Force update snapshots even if they match").option("--3d", "Generate 3d preview snapshots").option("--pcb-only", "Generate only PCB snapshots").option("--schematic-only", "Generate only schematic snapshots").option("--disable-parts-engine", "Disable the parts engine").action(async (target, options) => {
196265
+ program3.command("snapshot").argument("[path]", "Path to file, directory, or glob pattern (e.g., 'examples/**/*.tsx')").description("Generate schematic and PCB snapshots (add --3d for 3d preview)").option("-u, --update", "Update snapshots on disk").option("--force-update", "Force update snapshots even if they match").option("--3d", "Generate 3d preview snapshots").option("--pcb-only", "Generate only PCB snapshots").option("--schematic-only", "Generate only schematic snapshots").option("--disable-parts-engine", "Disable the parts engine").action(async (target, options) => {
196252
196266
  await snapshotProject({
196253
196267
  update: options.update ?? false,
196254
196268
  threeD: options["3d"] ?? false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.447",
3
+ "version": "0.1.448",
4
4
  "main": "dist/main.js",
5
5
  "devDependencies": {
6
6
  "@babel/standalone": "^7.26.9",