@tscircuit/cli 0.1.726 → 0.1.728

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/main.js CHANGED
@@ -73245,6 +73245,7 @@ var projectConfigSchema = z.object({
73245
73245
  ignoredFiles: z.array(z.string()).optional(),
73246
73246
  includeBoardFiles: z.array(z.string()).optional(),
73247
73247
  snapshotsDir: z.string().optional(),
73248
+ buildCommand: z.string().optional(),
73248
73249
  build: z.object({
73249
73250
  circuitJson: z.boolean().optional(),
73250
73251
  kicadLibrary: z.boolean().optional(),
@@ -74123,7 +74124,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
74123
74124
  import { execSync as execSync2 } from "node:child_process";
74124
74125
  var import_semver2 = __toESM2(require_semver2(), 1);
74125
74126
  // package.json
74126
- var version = "0.1.724";
74127
+ var version = "0.1.727";
74127
74128
  var package_default = {
74128
74129
  name: "@tscircuit/cli",
74129
74130
  version,
@@ -74337,7 +74338,12 @@ class PrettyHttpError extends Error {
74337
74338
  }
74338
74339
  var prettyResponseErrorHook = async (request, _options, response) => {
74339
74340
  if (!response.ok) {
74340
- const errorData = await response.json();
74341
+ let errorData = null;
74342
+ let responseText = "";
74343
+ try {
74344
+ responseText = await response.clone().text();
74345
+ errorData = JSON.parse(responseText);
74346
+ } catch {}
74341
74347
  let requestBody = "";
74342
74348
  try {
74343
74349
  requestBody = await request.clone().text();
@@ -74345,12 +74351,13 @@ var prettyResponseErrorHook = async (request, _options, response) => {
74345
74351
  const apiError = errorData?.error;
74346
74352
  const errorString = apiError ? `
74347
74353
  ${apiError.error_code}: ${apiError.message}` : "";
74354
+ const bodyDisplay = errorData ? JSON.stringify(errorData, null, 2) : responseText.slice(0, 20);
74348
74355
  throw new PrettyHttpError(`FAIL [${response.status}]: ${request.method} ${new URL(request.url).pathname}${errorString}${requestBody ? `
74349
74356
 
74350
74357
  Request Body:
74351
74358
  ${requestBody}` : ""}
74352
74359
 
74353
- ${JSON.stringify(errorData, null, 2)}`, request, response);
74360
+ ${bodyDisplay}`, request, response);
74354
74361
  }
74355
74362
  };
74356
74363
  var getRegistryApiKy = ({
@@ -78677,9 +78684,8 @@ var pushSnippet = async ({
78677
78684
  onError(`Error creating release: ${error}`);
78678
78685
  return onExit(1);
78679
78686
  });
78680
- log(`
78681
- `);
78682
78687
  const filePaths = getPackageFilePaths(projectDir, includeDist ? [] : ["**/dist/**"]);
78688
+ const uploadResults = { succeeded: [], failed: [] };
78683
78689
  for (const fullFilePath of filePaths) {
78684
78690
  const relativeFilePath = path15.relative(projectDir, fullFilePath);
78685
78691
  const fileBuffer = fs13.readFileSync(fullFilePath);
@@ -78695,22 +78701,42 @@ var pushSnippet = async ({
78695
78701
  }
78696
78702
  await ky2.post("package_files/create", {
78697
78703
  json: payload
78698
- }).json().then((response) => {
78704
+ }).then(() => {
78699
78705
  const icon = isBinary ? "\uD83D\uDCE6" : "⬆︎";
78700
78706
  console.log(kleur_default.gray(`${icon} ${relativeFilePath}`));
78707
+ uploadResults.succeeded.push(relativeFilePath);
78701
78708
  }).catch(async (error) => {
78702
- let errorDetails = "";
78703
- try {
78704
- const errorResponse = await error.response?.json();
78705
- if (errorResponse?.error?.message) {
78706
- errorDetails = `: ${errorResponse.error.message}`;
78707
- }
78708
- } catch {}
78709
- onError(`Error uploading file "${relativeFilePath}"${errorDetails}
78710
- ` + ` Full path: ${fullFilePath}`);
78711
- return onExit(1);
78709
+ const errorDetails = String(error)?.split(`
78710
+
78711
+ Request Body:`)?.[0];
78712
+ console.log(kleur_default.red(` ${relativeFilePath} - failed`));
78713
+ uploadResults.failed.push({
78714
+ file: relativeFilePath,
78715
+ error: errorDetails
78716
+ });
78712
78717
  });
78713
78718
  }
78719
+ log(`
78720
+ `);
78721
+ log(kleur_default.bold("Upload Summary"));
78722
+ log(kleur_default.green(` Succeeded: ${uploadResults.succeeded.length} files`));
78723
+ if (uploadResults.failed.length > 0) {
78724
+ log(kleur_default.red(` Failed: ${uploadResults.failed.length} files`));
78725
+ for (const { file, error } of uploadResults.failed) {
78726
+ log(kleur_default.red(` - ${file}`));
78727
+ log(kleur_default.gray(` ${error}`));
78728
+ }
78729
+ }
78730
+ if (uploadResults.failed.length > 0 && uploadResults.succeeded.length === 0) {
78731
+ onError(`
78732
+ Publish completed with ${uploadResults.failed.length} failed upload(s)`);
78733
+ return onExit(1);
78734
+ }
78735
+ if (uploadResults.failed.length > 0 && uploadResults.succeeded.length > 0) {
78736
+ onSuccess(`
78737
+ Publish completed with ${uploadResults.succeeded.length} files uploaded and ${uploadResults.failed.length} failed upload(s)`);
78738
+ return onExit(1);
78739
+ }
78714
78740
  await ky2.post("package_releases/update", {
78715
78741
  json: {
78716
78742
  package_name_with_version: `${scopedPackageName}@${releaseVersion}`,
@@ -84760,11 +84786,12 @@ var availableGlobalConfigKeys = [
84760
84786
  ];
84761
84787
  var availableProjectConfigKeys = [
84762
84788
  "mainEntrypoint",
84763
- "previewComponentPath"
84789
+ "previewComponentPath",
84790
+ "buildCommand"
84764
84791
  ];
84765
84792
  var registerConfigSet = (program3) => {
84766
84793
  const configCommand = program3.commands.find((c) => c.name() === "config");
84767
- configCommand.command("set").description("Set a configuration value (global or project-specific)").argument("<key>", "Configuration key (e.g., alwaysCloneWithAuthorName, mainEntrypoint, previewComponentPath)").argument("<value>", "Value to set").action((key, value) => {
84794
+ configCommand.command("set").description("Set a configuration value (global or project-specific)").argument("<key>", "Configuration key (e.g., alwaysCloneWithAuthorName, mainEntrypoint, previewComponentPath, buildCommand)").argument("<value>", "Value to set").action((key, value) => {
84768
84795
  if (availableGlobalConfigKeys.some((k) => k === key)) {
84769
84796
  if (key === "alwaysCloneWithAuthorName") {
84770
84797
  const booleanValue = value.toLowerCase() === "true";
@@ -84773,7 +84800,7 @@ var registerConfigSet = (program3) => {
84773
84800
  }
84774
84801
  } else if (availableProjectConfigKeys.some((k) => k === key)) {
84775
84802
  const projectDir = process.cwd();
84776
- if (key === "mainEntrypoint" || key === "previewComponentPath") {
84803
+ if (key === "mainEntrypoint" || key === "previewComponentPath" || key === "buildCommand") {
84777
84804
  const projectConfig = loadProjectConfig(projectDir) ?? {};
84778
84805
  projectConfig[key] = value;
84779
84806
  if (saveProjectConfig(projectConfig, projectDir)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.726",
3
+ "version": "0.1.728",
4
4
  "main": "dist/main.js",
5
5
  "devDependencies": {
6
6
  "@babel/standalone": "^7.26.9",
@@ -36,6 +36,10 @@
36
36
  "type": "string",
37
37
  "description": "Directory path for storing snapshots."
38
38
  },
39
+ "buildCommand": {
40
+ "type": "string",
41
+ "description": "Override command used for cloud builds."
42
+ },
39
43
  "build": {
40
44
  "type": "object",
41
45
  "additionalProperties": false,