@tscircuit/cli 0.1.1095 → 0.1.1096

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.
package/dist/cli/main.js CHANGED
@@ -71664,7 +71664,7 @@ var registerStaticAssetLoaders = () => {
71664
71664
  // cli/main.ts
71665
71665
  var import_perfect_cli = __toESM2(require_dist2(), 1);
71666
71666
  // package.json
71667
- var version = "0.1.1094";
71667
+ var version = "0.1.1095";
71668
71668
  var package_default = {
71669
71669
  name: "@tscircuit/cli",
71670
71670
  version,
@@ -81400,6 +81400,27 @@ var findBoardFiles = ({
81400
81400
  };
81401
81401
 
81402
81402
  // cli/build/get-build-entrypoints.ts
81403
+ class BuildNoMatchingFilesError extends Error {
81404
+ directoryPath;
81405
+ includeBoardFilePatterns;
81406
+ constructor({
81407
+ directoryPath,
81408
+ includeBoardFilePatterns,
81409
+ hasConfiguredIncludeBoardFiles,
81410
+ projectDir
81411
+ }) {
81412
+ const relativeDirectory = path35.relative(projectDir, directoryPath) || ".";
81413
+ const patternSourceMessage = hasConfiguredIncludeBoardFiles ? "Searched using tscircuit.config.json includeBoardFiles" : "Searched using default includeBoardFiles";
81414
+ super([
81415
+ `No buildable files found in directory: "${relativeDirectory}"`,
81416
+ `${patternSourceMessage}: ${JSON.stringify(includeBoardFilePatterns)}`
81417
+ ].join(`
81418
+ `));
81419
+ this.name = "BuildNoMatchingFilesError";
81420
+ this.directoryPath = directoryPath;
81421
+ this.includeBoardFilePatterns = includeBoardFilePatterns;
81422
+ }
81423
+ }
81403
81424
  var isSubPath2 = (maybeChild, maybeParent) => {
81404
81425
  const relative3 = path35.relative(maybeParent, maybeChild);
81405
81426
  return relative3 === "" || !relative3.startsWith("..") && !path35.isAbsolute(relative3);
@@ -81478,12 +81499,18 @@ async function getBuildEntrypoints({
81478
81499
  const resolvedPreviewComponentPath2 = projectConfig2?.previewComponentPath ? path35.resolve(resolvedRoot, projectConfig2.previewComponentPath) : undefined;
81479
81500
  const resolvedSiteDefaultComponentPath2 = projectConfig2?.siteDefaultComponentPath ? path35.resolve(resolvedRoot, projectConfig2.siteDefaultComponentPath) : undefined;
81480
81501
  if (includeBoardFiles) {
81481
- const circuitFiles = findBoardFiles({
81482
- projectDir: resolvedRoot,
81483
- filePaths: [resolved]
81484
- }).filter((file) => isSubPath2(file, resolved));
81502
+ const hasConfiguredIncludeBoardFiles = Boolean(projectConfig2?.includeBoardFiles?.some((pattern) => pattern.trim()));
81503
+ const matchedFiles = findBoardFiles({
81504
+ projectDir: resolvedRoot
81505
+ });
81506
+ const circuitFiles = matchedFiles.filter((file) => isSubPath2(file, resolved));
81485
81507
  if (circuitFiles.length === 0) {
81486
- throw new Error(`There were no files to build found matching the includeBoardFiles globs: ${JSON.stringify(includeBoardFilePatterns)}`);
81508
+ throw new BuildNoMatchingFilesError({
81509
+ directoryPath: resolved,
81510
+ includeBoardFilePatterns,
81511
+ hasConfiguredIncludeBoardFiles,
81512
+ projectDir: resolvedRoot
81513
+ });
81487
81514
  }
81488
81515
  return {
81489
81516
  projectDir: resolvedRoot,
@@ -82758,6 +82785,10 @@ var registerBuild = (program2) => {
82758
82785
  }
82759
82786
  exitBuild(0, "build finished successfully");
82760
82787
  } catch (error) {
82788
+ if (error instanceof BuildNoMatchingFilesError) {
82789
+ console.error(error.message);
82790
+ exitBuild(1, "no matching build files found");
82791
+ }
82761
82792
  const message = error instanceof Error ? error.message : String(error);
82762
82793
  console.error(message);
82763
82794
  exitBuild(1, "unexpected exception");
package/dist/lib/index.js CHANGED
@@ -60435,7 +60435,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
60435
60435
  }));
60436
60436
  };
60437
60437
  // package.json
60438
- var version = "0.1.1094";
60438
+ var version = "0.1.1095";
60439
60439
  var package_default = {
60440
60440
  name: "@tscircuit/cli",
60441
60441
  version,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1095",
3
+ "version": "0.1.1096",
4
4
  "main": "dist/cli/main.js",
5
5
  "exports": {
6
6
  ".": "./dist/cli/main.js",