@tscircuit/cli 0.1.156 → 0.1.157

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 +29 -25
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -240539,7 +240539,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
240539
240539
  import { execSync as execSync2 } from "node:child_process";
240540
240540
  var import_semver2 = __toESM2(require_semver2(), 1);
240541
240541
  // package.json
240542
- var version = "0.1.155";
240542
+ var version = "0.1.156";
240543
240543
  var package_default = {
240544
240544
  name: "@tscircuit/cli",
240545
240545
  version,
@@ -281059,34 +281059,39 @@ async function getBuildEntrypoints({
281059
281059
  const resolved = path24.resolve(resolvedRoot, fileOrDir);
281060
281060
  if (fs24.existsSync(resolved) && fs24.statSync(resolved).isDirectory()) {
281061
281061
  const projectDir2 = resolved;
281062
- const files2 = globbySync(["**/*.circuit.tsx", "**/*.board.tsx"], {
281062
+ const circuitFiles2 = [];
281063
+ const mainEntrypoint2 = await getEntrypoint({
281064
+ projectDir: projectDir2,
281065
+ onError: () => {}
281066
+ });
281067
+ const files2 = globbySync("**/*.circuit.tsx", {
281063
281068
  cwd: projectDir2,
281064
281069
  ignore: DEFAULT_IGNORED_PATTERNS
281065
281070
  });
281071
+ for (const f of files2) {
281072
+ circuitFiles2.push(path24.join(projectDir2, f));
281073
+ }
281066
281074
  return {
281067
281075
  projectDir: projectDir2,
281068
- circuitFiles: files2.map((f) => path24.join(projectDir2, f))
281076
+ mainEntrypoint: mainEntrypoint2 || undefined,
281077
+ circuitFiles: circuitFiles2
281069
281078
  };
281070
281079
  }
281071
281080
  return { projectDir: path24.dirname(resolved), circuitFiles: [resolved] };
281072
281081
  }
281073
281082
  const projectDir = resolvedRoot;
281074
- const files = globbySync(["**/*.circuit.tsx", "**/*.board.tsx"], {
281083
+ const circuitFiles = [];
281084
+ const mainEntrypoint = await getEntrypoint({ projectDir, onError: () => {} });
281085
+ const files = globbySync("**/*.circuit.tsx", {
281075
281086
  cwd: projectDir,
281076
281087
  ignore: DEFAULT_IGNORED_PATTERNS
281077
281088
  });
281078
- const circuitFiles = files.map((f) => path24.join(projectDir, f));
281079
- if (circuitFiles.length === 0) {
281080
- const mainEntrypoint = await getEntrypoint({
281081
- projectDir,
281082
- onError: () => {}
281083
- });
281084
- if (mainEntrypoint) {
281085
- circuitFiles.push(mainEntrypoint);
281086
- }
281089
+ for (const f of files) {
281090
+ circuitFiles.push(path24.join(projectDir, f));
281087
281091
  }
281088
281092
  return {
281089
281093
  projectDir,
281094
+ mainEntrypoint: mainEntrypoint || undefined,
281090
281095
  circuitFiles
281091
281096
  };
281092
281097
  }
@@ -281094,27 +281099,26 @@ async function getBuildEntrypoints({
281094
281099
  // cli/build/register.ts
281095
281100
  var registerBuild = (program3) => {
281096
281101
  program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--disable-pcb", "Disable PCB outputs").action(async (file, options) => {
281097
- const { projectDir, circuitFiles } = await getBuildEntrypoints({
281098
- fileOrDir: file
281099
- });
281102
+ const { projectDir, mainEntrypoint, circuitFiles } = await getBuildEntrypoints({ fileOrDir: file });
281100
281103
  const platformConfig = {
281101
281104
  pcbDisabled: options?.disablePcb
281102
281105
  };
281103
281106
  const distDir = path25.join(projectDir, "dist");
281104
281107
  fs25.mkdirSync(distDir, { recursive: true });
281105
281108
  let hasErrors = false;
281109
+ if (mainEntrypoint) {
281110
+ const outputPath = path25.join(distDir, "circuit.json");
281111
+ const ok = await buildFile(mainEntrypoint, outputPath, projectDir, {
281112
+ ...options,
281113
+ platformConfig
281114
+ });
281115
+ if (!ok)
281116
+ hasErrors = true;
281117
+ }
281106
281118
  for (const filePath of circuitFiles) {
281107
281119
  const relative7 = path25.relative(projectDir, filePath);
281108
281120
  const isCircuit = filePath.endsWith(".circuit.tsx");
281109
- const isBoard = filePath.endsWith(".board.tsx");
281110
- let outputPath;
281111
- if (isCircuit) {
281112
- outputPath = path25.join(distDir, relative7.replace(/\.circuit\.tsx$/, ""), "circuit.json");
281113
- } else if (isBoard) {
281114
- outputPath = path25.join(distDir, relative7.replace(/\.board\.tsx$/, ""), "circuit.json");
281115
- } else {
281116
- outputPath = path25.join(distDir, "circuit.json");
281117
- }
281121
+ const outputPath = isCircuit ? path25.join(distDir, relative7.replace(/\.circuit\.tsx$/, ""), "circuit.json") : path25.join(distDir, "circuit.json");
281118
281122
  const ok = await buildFile(filePath, outputPath, projectDir, options);
281119
281123
  if (!ok)
281120
281124
  hasErrors = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.156",
3
+ "version": "0.1.157",
4
4
  "main": "dist/main.js",
5
5
  "devDependencies": {
6
6
  "@babel/standalone": "^7.26.9",