@tscircuit/cli 0.1.725 → 0.1.727
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 +45 -18
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -74123,7 +74123,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
74123
74123
|
import { execSync as execSync2 } from "node:child_process";
|
|
74124
74124
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
74125
74125
|
// package.json
|
|
74126
|
-
var version = "0.1.
|
|
74126
|
+
var version = "0.1.726";
|
|
74127
74127
|
var package_default = {
|
|
74128
74128
|
name: "@tscircuit/cli",
|
|
74129
74129
|
version,
|
|
@@ -74337,7 +74337,12 @@ class PrettyHttpError extends Error {
|
|
|
74337
74337
|
}
|
|
74338
74338
|
var prettyResponseErrorHook = async (request, _options, response) => {
|
|
74339
74339
|
if (!response.ok) {
|
|
74340
|
-
|
|
74340
|
+
let errorData = null;
|
|
74341
|
+
let responseText = "";
|
|
74342
|
+
try {
|
|
74343
|
+
responseText = await response.clone().text();
|
|
74344
|
+
errorData = JSON.parse(responseText);
|
|
74345
|
+
} catch {}
|
|
74341
74346
|
let requestBody = "";
|
|
74342
74347
|
try {
|
|
74343
74348
|
requestBody = await request.clone().text();
|
|
@@ -74345,12 +74350,13 @@ var prettyResponseErrorHook = async (request, _options, response) => {
|
|
|
74345
74350
|
const apiError = errorData?.error;
|
|
74346
74351
|
const errorString = apiError ? `
|
|
74347
74352
|
${apiError.error_code}: ${apiError.message}` : "";
|
|
74353
|
+
const bodyDisplay = errorData ? JSON.stringify(errorData, null, 2) : responseText.slice(0, 20);
|
|
74348
74354
|
throw new PrettyHttpError(`FAIL [${response.status}]: ${request.method} ${new URL(request.url).pathname}${errorString}${requestBody ? `
|
|
74349
74355
|
|
|
74350
74356
|
Request Body:
|
|
74351
74357
|
${requestBody}` : ""}
|
|
74352
74358
|
|
|
74353
|
-
${
|
|
74359
|
+
${bodyDisplay}`, request, response);
|
|
74354
74360
|
}
|
|
74355
74361
|
};
|
|
74356
74362
|
var getRegistryApiKy = ({
|
|
@@ -78472,6 +78478,7 @@ var pushSnippet = async ({
|
|
|
78472
78478
|
filePath,
|
|
78473
78479
|
isPrivate,
|
|
78474
78480
|
versionTag,
|
|
78481
|
+
includeDist = false,
|
|
78475
78482
|
log = console.log,
|
|
78476
78483
|
onExit = (code) => process.exit(code),
|
|
78477
78484
|
onError = (message) => console.error(message),
|
|
@@ -78676,9 +78683,8 @@ var pushSnippet = async ({
|
|
|
78676
78683
|
onError(`Error creating release: ${error}`);
|
|
78677
78684
|
return onExit(1);
|
|
78678
78685
|
});
|
|
78679
|
-
|
|
78680
|
-
|
|
78681
|
-
const filePaths = getPackageFilePaths(projectDir);
|
|
78686
|
+
const filePaths = getPackageFilePaths(projectDir, includeDist ? [] : ["**/dist/**"]);
|
|
78687
|
+
const uploadResults = { succeeded: [], failed: [] };
|
|
78682
78688
|
for (const fullFilePath of filePaths) {
|
|
78683
78689
|
const relativeFilePath = path15.relative(projectDir, fullFilePath);
|
|
78684
78690
|
const fileBuffer = fs13.readFileSync(fullFilePath);
|
|
@@ -78694,22 +78700,42 @@ var pushSnippet = async ({
|
|
|
78694
78700
|
}
|
|
78695
78701
|
await ky2.post("package_files/create", {
|
|
78696
78702
|
json: payload
|
|
78697
|
-
}).
|
|
78703
|
+
}).then(() => {
|
|
78698
78704
|
const icon = isBinary ? "\uD83D\uDCE6" : "⬆︎";
|
|
78699
78705
|
console.log(kleur_default.gray(`${icon} ${relativeFilePath}`));
|
|
78706
|
+
uploadResults.succeeded.push(relativeFilePath);
|
|
78700
78707
|
}).catch(async (error) => {
|
|
78701
|
-
|
|
78702
|
-
|
|
78703
|
-
|
|
78704
|
-
|
|
78705
|
-
|
|
78706
|
-
|
|
78707
|
-
|
|
78708
|
-
|
|
78709
|
-
` + ` Full path: ${fullFilePath}`);
|
|
78710
|
-
return onExit(1);
|
|
78708
|
+
const errorDetails = String(error)?.split(`
|
|
78709
|
+
|
|
78710
|
+
Request Body:`)?.[0];
|
|
78711
|
+
console.log(kleur_default.red(` ${relativeFilePath} - failed`));
|
|
78712
|
+
uploadResults.failed.push({
|
|
78713
|
+
file: relativeFilePath,
|
|
78714
|
+
error: errorDetails
|
|
78715
|
+
});
|
|
78711
78716
|
});
|
|
78712
78717
|
}
|
|
78718
|
+
log(`
|
|
78719
|
+
`);
|
|
78720
|
+
log(kleur_default.bold("Upload Summary"));
|
|
78721
|
+
log(kleur_default.green(` Succeeded: ${uploadResults.succeeded.length} files`));
|
|
78722
|
+
if (uploadResults.failed.length > 0) {
|
|
78723
|
+
log(kleur_default.red(` Failed: ${uploadResults.failed.length} files`));
|
|
78724
|
+
for (const { file, error } of uploadResults.failed) {
|
|
78725
|
+
log(kleur_default.red(` - ${file}`));
|
|
78726
|
+
log(kleur_default.gray(` ${error}`));
|
|
78727
|
+
}
|
|
78728
|
+
}
|
|
78729
|
+
if (uploadResults.failed.length > 0 && uploadResults.succeeded.length === 0) {
|
|
78730
|
+
onError(`
|
|
78731
|
+
Publish completed with ${uploadResults.failed.length} failed upload(s)`);
|
|
78732
|
+
return onExit(1);
|
|
78733
|
+
}
|
|
78734
|
+
if (uploadResults.failed.length > 0 && uploadResults.succeeded.length > 0) {
|
|
78735
|
+
onSuccess(`
|
|
78736
|
+
Publish completed with ${uploadResults.succeeded.length} files uploaded and ${uploadResults.failed.length} failed upload(s)`);
|
|
78737
|
+
return onExit(1);
|
|
78738
|
+
}
|
|
78713
78739
|
await ky2.post("package_releases/update", {
|
|
78714
78740
|
json: {
|
|
78715
78741
|
package_name_with_version: `${scopedPackageName}@${releaseVersion}`,
|
|
@@ -84719,11 +84745,12 @@ Logged in user:
|
|
|
84719
84745
|
|
|
84720
84746
|
// cli/push/register.ts
|
|
84721
84747
|
var registerPush = (program3) => {
|
|
84722
|
-
program3.command("push").description("Save package code to Registry API").argument("[file]", "Path to the package file").option("--private", "Make the package private").option("--version-tag <tag>", "Publish as a non-latest version using the provided tag").action(async (filePath, options = {}) => {
|
|
84748
|
+
program3.command("push").description("Save package code to Registry API").argument("[file]", "Path to the package file").option("--private", "Make the package private").option("--version-tag <tag>", "Publish as a non-latest version using the provided tag").option("--include-dist", "Include the dist directory in the push").action(async (filePath, options = {}) => {
|
|
84723
84749
|
await pushSnippet({
|
|
84724
84750
|
filePath,
|
|
84725
84751
|
isPrivate: options.private ?? false,
|
|
84726
84752
|
versionTag: options.versionTag,
|
|
84753
|
+
includeDist: options.includeDist ?? false,
|
|
84727
84754
|
onExit: (code) => process.exit(code),
|
|
84728
84755
|
onError: (message) => console.error(message),
|
|
84729
84756
|
onSuccess: (message) => console.log(message)
|