@tscircuit/cli 0.1.1916 → 0.1.1917

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/cli/main.js +13 -5
  2. package/package.json +1 -1
package/dist/cli/main.js CHANGED
@@ -156194,7 +156194,8 @@ var formatPlacementDiagnostics = ({
156194
156194
  return lines.join(`
156195
156195
  `);
156196
156196
  };
156197
- var checkPlacement = async (file, refdes) => {
156197
+ var isPlacementAnalysisIssueRelatedToRefdes = (issue, refdes) => issue.componentA === refdes || issue.componentB === refdes;
156198
+ var getCheckPlacementResult = async (file, refdes) => {
156198
156199
  const resolvedInputFilePath = await resolveCheckInputFilePath(file);
156199
156200
  const circuitJson = await getCircuitJsonForCheck({
156200
156201
  filePath: resolvedInputFilePath,
@@ -156204,17 +156205,24 @@ var checkPlacement = async (file, refdes) => {
156204
156205
  },
156205
156206
  allowPrebuiltCircuitJson: true
156206
156207
  });
156207
- const analysisReport = refdes ? analyzeComponentPlacement(circuitJson, refdes).getString() : analyzeAllPlacements(circuitJson).getString();
156208
+ const placementAnalysis = analyzeAllPlacements(circuitJson);
156209
+ const analysisReport = refdes ? analyzeComponentPlacement(circuitJson, refdes).getString() : placementAnalysis.getString();
156210
+ const placementAnalysisIssues = refdes ? placementAnalysis.getIssues().filter((issue) => isPlacementAnalysisIssueRelatedToRefdes(issue, refdes)) : placementAnalysis.getIssues();
156208
156211
  const placementDiagnostics = getPlacementDiagnostics(circuitJson, refdes);
156209
- return `${analysisReport.trimEnd()}
156212
+ return {
156213
+ output: `${analysisReport.trimEnd()}
156210
156214
 
156211
- ${formatPlacementDiagnostics(placementDiagnostics)}`;
156215
+ ${formatPlacementDiagnostics(placementDiagnostics)}`,
156216
+ hasErrors: placementDiagnostics.errors.length > 0 || placementAnalysisIssues.length > 0
156217
+ };
156212
156218
  };
156213
156219
  var registerCheckPlacement = (program2) => {
156214
156220
  program2.commands.find((c) => c.name() === "check").command("placement").description("Partially build and validate the placement").argument("[file]", "Path to the entry file").argument("[refdes]", "Optional refdes to scope the check").action(async (file, refdes) => {
156215
156221
  try {
156216
- const output = await checkPlacement(file, refdes);
156222
+ const { output, hasErrors } = await getCheckPlacementResult(file, refdes);
156217
156223
  console.log(output);
156224
+ if (hasErrors)
156225
+ process.exitCode = 1;
156218
156226
  } catch (error) {
156219
156227
  console.error(error instanceof Error ? error.message : String(error));
156220
156228
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1916",
3
+ "version": "0.1.1917",
4
4
  "main": "dist/cli/main.js",
5
5
  "exports": {
6
6
  ".": "./dist/cli/main.js",