@tscircuit/cli 0.1.357 → 0.1.359

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 +14 -6
  2. package/package.json +2 -2
package/dist/main.js CHANGED
@@ -71530,7 +71530,8 @@ import { z } from "zod";
71530
71530
  var projectConfigSchema = z.object({
71531
71531
  mainEntrypoint: z.string().optional(),
71532
71532
  ignoredFiles: z.array(z.string()).optional(),
71533
- includeBoardFiles: z.array(z.string()).optional()
71533
+ includeBoardFiles: z.array(z.string()).optional(),
71534
+ snapshotsDir: z.string().optional()
71534
71535
  });
71535
71536
 
71536
71537
  // lib/project-config/index.ts
@@ -71561,6 +71562,10 @@ var getBoardFilePatterns = (projectDir = process.cwd()) => {
71561
71562
  }
71562
71563
  return DEFAULT_BOARD_FILE_PATTERNS;
71563
71564
  };
71565
+ var getSnapshotsDir = (projectDir = process.cwd()) => {
71566
+ const config = loadProjectConfig(projectDir);
71567
+ return config?.snapshotsDir;
71568
+ };
71564
71569
  var saveProjectConfig = (config, projectDir = process.cwd()) => {
71565
71570
  const configPath = path9.join(projectDir, CONFIG_FILENAME);
71566
71571
  try {
@@ -72193,7 +72198,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
72193
72198
  import { execSync as execSync2 } from "node:child_process";
72194
72199
  var import_semver2 = __toESM2(require_semver2(), 1);
72195
72200
  // package.json
72196
- var version = "0.1.356";
72201
+ var version = "0.1.358";
72197
72202
  var package_default = {
72198
72203
  name: "@tscircuit/cli",
72199
72204
  version,
@@ -72205,7 +72210,7 @@ var package_default = {
72205
72210
  "@tscircuit/fake-snippets": "^0.0.110",
72206
72211
  "@tscircuit/file-server": "^0.0.32",
72207
72212
  "@tscircuit/math-utils": "0.0.21",
72208
- "@tscircuit/props": "^0.0.356",
72213
+ "@tscircuit/props": "^0.0.371",
72209
72214
  "@tscircuit/runframe": "^0.0.1123",
72210
72215
  "@tscircuit/schematic-match-adapt": "^0.0.22",
72211
72216
  "@types/bun": "^1.2.2",
@@ -77238,7 +77243,7 @@ var registerDev = (program3) => {
77238
77243
 
77239
77244
  ${kleur_default.green(`@tscircuit/cli@${getVersion()}`)} ${kleur_default.gray("ready in")} ${kleur_default.white(`${Math.round(timeToStart)}ms`)}`);
77240
77245
  console.log(`
77241
- ${kleur_default.bold("➜ Local:")} ${kleur_default.underline(kleur_default.cyan(`http://localhost:${port}`))}
77246
+ ${kleur_default.bold("➜ Local:")} ${kleur_default.underline(kleur_default.cyan(`http://localhost:${port}`))}${server.componentFilePath ? kleur_default.underline(kleur_default.cyan(`/#file=${encodeURIComponent(path20.relative(process.cwd(), server.componentFilePath).replaceAll("\\", "/"))}`)) : ""}
77242
77247
 
77243
77248
  `);
77244
77249
  console.log(kleur_default.gray(`Watching ${kleur_default.underline(server.projectDir.split("/").slice(-2).join("/"))} for changes...`));
@@ -195964,6 +195969,7 @@ var snapshotProject = async ({
195964
195969
  console.log("No entrypoint found. Run 'tsci init' to bootstrap a project or specify a file with 'tsci snapshot <file>'");
195965
195970
  return onExit(0);
195966
195971
  }
195972
+ const snapshotsDirName = getSnapshotsDir(projectDir);
195967
195973
  const mismatches = [];
195968
195974
  let didUpdate = false;
195969
195975
  for (const file of boardFiles) {
@@ -196021,7 +196027,9 @@ var snapshotProject = async ({
196021
196027
  } catch (error) {
196022
196028
  const errorMessage = error instanceof Error ? error.message : String(error);
196023
196029
  if (errorMessage.includes("No pcb_board found in circuit JSON")) {
196024
- const snapDir2 = path31.join(path31.dirname(file), "__snapshots__");
196030
+ const fileDir = path31.dirname(file);
196031
+ const relativeDir = path31.relative(projectDir, fileDir);
196032
+ const snapDir2 = snapshotsDirName ? path31.join(projectDir, snapshotsDirName, relativeDir) : path31.join(fileDir, "__snapshots__");
196025
196033
  const base2 = path31.basename(file).replace(/\.tsx$/, "");
196026
196034
  const snap3dPath = path31.join(snapDir2, `${base2}-3d.snap.png`);
196027
196035
  const existing3dSnapshot = fs33.existsSync(snap3dPath);
@@ -196045,7 +196053,7 @@ var snapshotProject = async ({
196045
196053
  }
196046
196054
  }
196047
196055
  }
196048
- const snapDir = path31.join(path31.dirname(file), "__snapshots__");
196056
+ const snapDir = snapshotsDirName ? path31.join(projectDir, snapshotsDirName, path31.relative(projectDir, path31.dirname(file))) : path31.join(path31.dirname(file), "__snapshots__");
196049
196057
  fs33.mkdirSync(snapDir, { recursive: true });
196050
196058
  const base = path31.basename(file).replace(/\.tsx$/, "");
196051
196059
  const snapshots = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.357",
3
+ "version": "0.1.359",
4
4
  "main": "dist/main.js",
5
5
  "devDependencies": {
6
6
  "@babel/standalone": "^7.26.9",
@@ -9,7 +9,7 @@
9
9
  "@tscircuit/fake-snippets": "^0.0.110",
10
10
  "@tscircuit/file-server": "^0.0.32",
11
11
  "@tscircuit/math-utils": "0.0.21",
12
- "@tscircuit/props": "^0.0.356",
12
+ "@tscircuit/props": "^0.0.371",
13
13
  "@tscircuit/runframe": "^0.0.1123",
14
14
  "@tscircuit/schematic-match-adapt": "^0.0.22",
15
15
  "@types/bun": "^1.2.2",