@tscircuit/cli 0.1.192 → 0.1.194

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 +24 -20
  2. package/package.json +2 -3
package/dist/main.js CHANGED
@@ -68081,7 +68081,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
68081
68081
  import { execSync as execSync2 } from "node:child_process";
68082
68082
  var import_semver2 = __toESM2(require_semver2(), 1);
68083
68083
  // package.json
68084
- var version = "0.1.191";
68084
+ var version = "0.1.193";
68085
68085
  var package_default = {
68086
68086
  name: "@tscircuit/cli",
68087
68087
  version,
@@ -68107,7 +68107,6 @@ var package_default = {
68107
68107
  "bun-match-svg": "^0.0.12",
68108
68108
  chokidar: "4.0.1",
68109
68109
  "circuit-json-to-readable-netlist": "^0.0.13",
68110
- "circuit-json-to-simple-3d": "^0.0.5",
68111
68110
  commander: "^14.0.0",
68112
68111
  conf: "^13.1.0",
68113
68112
  configstore: "^7.0.0",
@@ -68128,7 +68127,7 @@ var package_default = {
68128
68127
  redaxios: "^0.5.1",
68129
68128
  semver: "^7.6.3",
68130
68129
  tempy: "^3.1.0",
68131
- tscircuit: "^0.0.559-libonly",
68130
+ tscircuit: "^0.0.574-libonly",
68132
68131
  tsx: "^4.7.1",
68133
68132
  "typed-ky": "^0.0.4",
68134
68133
  zod: "3"
@@ -77944,7 +77943,7 @@ var registerBuild = (program3) => {
77944
77943
  };
77945
77944
 
77946
77945
  // lib/shared/snapshot-project.ts
77947
- import fs27 from "node:fs";
77946
+ import fs28 from "node:fs";
77948
77947
  import path27 from "node:path";
77949
77948
  var import_sharp = __toESM2(require_lib2(), 1);
77950
77949
  import looksSame2 from "looks-same";
@@ -77956,19 +77955,24 @@ import { convertCircuitJsonToSimple3dSvg } from "circuit-json-to-simple-3d";
77956
77955
 
77957
77956
  // lib/shared/compare-images.ts
77958
77957
  import looksSame from "looks-same";
77958
+ import fs27 from "node:fs/promises";
77959
77959
  var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
77960
77960
  const { equal } = await looksSame(buffer1, buffer2, {
77961
77961
  strict: false,
77962
77962
  tolerance: 2
77963
77963
  });
77964
77964
  if (!equal) {
77965
- await looksSame.createDiff({
77966
- reference: buffer1,
77967
- current: buffer2,
77968
- diff: diffPath,
77969
- highlightColor: "#ff00ff",
77970
- tolerance: 2
77971
- });
77965
+ if (diffPath.endsWith(".png")) {
77966
+ await looksSame.createDiff({
77967
+ reference: buffer1,
77968
+ current: buffer2,
77969
+ diff: diffPath,
77970
+ highlightColor: "#ff00ff",
77971
+ tolerance: 2
77972
+ });
77973
+ } else {
77974
+ await fs27.writeFile(diffPath, buffer2);
77975
+ }
77972
77976
  }
77973
77977
  return { equal };
77974
77978
  };
@@ -78007,7 +78011,7 @@ var snapshotProject = async ({
78007
78011
  const schSvg = convertCircuitJsonToSchematicSvg2(circuitJson);
78008
78012
  const svg3d = threeD ? await convertCircuitJsonToSimple3dSvg(circuitJson) : null;
78009
78013
  const snapDir = path27.join(path27.dirname(file), "__snapshots__");
78010
- fs27.mkdirSync(snapDir, { recursive: true });
78014
+ fs28.mkdirSync(snapDir, { recursive: true });
78011
78015
  const base = path27.basename(file).replace(/\.tsx$/, "");
78012
78016
  const pairs2 = [];
78013
78017
  if (pcbOnly || !schematicOnly)
@@ -78023,23 +78027,23 @@ var snapshotProject = async ({
78023
78027
  for (const [type, newSvg] of pairs2) {
78024
78028
  const is3d = type === "3d";
78025
78029
  const snapPath = path27.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
78026
- const existing = fs27.existsSync(snapPath);
78030
+ const existing = fs28.existsSync(snapPath);
78027
78031
  const newContentBuffer = is3d ? await import_sharp.default(Buffer.from(newSvg)).png().toBuffer() : Buffer.from(newSvg, "utf8");
78028
78032
  const newContentForFile = is3d ? newContentBuffer : newSvg;
78029
78033
  if (!existing) {
78030
- fs27.writeFileSync(snapPath, newContentForFile);
78034
+ fs28.writeFileSync(snapPath, newContentForFile);
78031
78035
  console.log("✅", kleur_default.gray(path27.relative(projectDir, snapPath)));
78032
78036
  didUpdate = true;
78033
78037
  continue;
78034
78038
  }
78035
- const oldContentBuffer = fs27.readFileSync(snapPath);
78036
- const diffPath = snapPath.replace(is3d ? ".snap.png" : ".snap.svg", ".diff.png");
78039
+ const oldContentBuffer = fs28.readFileSync(snapPath);
78040
+ const diffPath = snapPath.replace(is3d ? ".snap.png" : ".snap.svg", is3d ? ".diff.png" : ".diff.svg");
78037
78041
  const { equal } = await compareAndCreateDiff(oldContentBuffer, newContentBuffer, diffPath);
78038
78042
  if (update) {
78039
78043
  if (!forceUpdate && equal) {
78040
78044
  console.log("✅", kleur_default.gray(path27.relative(projectDir, snapPath)));
78041
78045
  } else {
78042
- fs27.writeFileSync(snapPath, newContentForFile);
78046
+ fs28.writeFileSync(snapPath, newContentForFile);
78043
78047
  console.log("✅", kleur_default.gray(path27.relative(projectDir, snapPath)));
78044
78048
  didUpdate = true;
78045
78049
  }
@@ -78084,13 +78088,13 @@ var registerSnapshot = (program3) => {
78084
78088
  };
78085
78089
 
78086
78090
  // lib/shared/setup-github-actions.ts
78087
- import fs28 from "node:fs";
78091
+ import fs29 from "node:fs";
78088
78092
  import path28 from "node:path";
78089
78093
  var setupGithubActions = (projectDir = process.cwd()) => {
78090
78094
  const findGitRoot = (startDir) => {
78091
78095
  let dir = path28.resolve(startDir);
78092
78096
  while (dir !== path28.parse(dir).root) {
78093
- if (fs28.existsSync(path28.join(dir, ".git"))) {
78097
+ if (fs29.existsSync(path28.join(dir, ".git"))) {
78094
78098
  return dir;
78095
78099
  }
78096
78100
  dir = path28.dirname(dir);
@@ -78099,7 +78103,7 @@ var setupGithubActions = (projectDir = process.cwd()) => {
78099
78103
  };
78100
78104
  const gitRoot = findGitRoot(projectDir) ?? projectDir;
78101
78105
  const workflowsDir = path28.join(gitRoot, ".github", "workflows");
78102
- fs28.mkdirSync(workflowsDir, { recursive: true });
78106
+ fs29.mkdirSync(workflowsDir, { recursive: true });
78103
78107
  const buildWorkflow = `name: tscircuit Build
78104
78108
 
78105
78109
  on:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.192",
3
+ "version": "0.1.194",
4
4
  "main": "dist/main.js",
5
5
  "devDependencies": {
6
6
  "@babel/standalone": "^7.26.9",
@@ -23,7 +23,6 @@
23
23
  "bun-match-svg": "^0.0.12",
24
24
  "chokidar": "4.0.1",
25
25
  "circuit-json-to-readable-netlist": "^0.0.13",
26
- "circuit-json-to-simple-3d": "^0.0.5",
27
26
  "commander": "^14.0.0",
28
27
  "conf": "^13.1.0",
29
28
  "configstore": "^7.0.0",
@@ -44,7 +43,7 @@
44
43
  "redaxios": "^0.5.1",
45
44
  "semver": "^7.6.3",
46
45
  "tempy": "^3.1.0",
47
- "tscircuit": "^0.0.559-libonly",
46
+ "tscircuit": "^0.0.574-libonly",
48
47
  "tsx": "^4.7.1",
49
48
  "typed-ky": "^0.0.4",
50
49
  "zod": "3"