@tscircuit/cli 0.1.2372 → 0.1.2373
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 +2 -2
- package/dist/lib/index.js +75 -48
- package/package.json +3 -2
package/dist/cli/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/dist/cli/main.js
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 46951130 bytes
|
|
4
|
+
sha256: 7f0d1c6ae9572d5bfb510f1606d5e4f75c4dccfaf186e1258acf21b60b62cce3
|
package/dist/lib/index.js
CHANGED
|
@@ -69121,7 +69121,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
|
|
|
69121
69121
|
}));
|
|
69122
69122
|
};
|
|
69123
69123
|
// package.json
|
|
69124
|
-
var version = "0.1.
|
|
69124
|
+
var version = "0.1.2371";
|
|
69125
69125
|
var package_default = {
|
|
69126
69126
|
name: "@tscircuit/cli",
|
|
69127
69127
|
version,
|
|
@@ -69144,7 +69144,7 @@ var package_default = {
|
|
|
69144
69144
|
"@tscircuit/circuit-json-schematic-placement-analysis": "https://jscdn.tscircuit.com/@tscircuit/circuit-json-schematic-placement-analysis/0.0.68.tgz",
|
|
69145
69145
|
"@tscircuit/circuit-json-util": "^0.0.121",
|
|
69146
69146
|
"@tscircuit/eval": "0.0.1619",
|
|
69147
|
-
"@tscircuit/fake-snippets": "^0.0.
|
|
69147
|
+
"@tscircuit/fake-snippets": "^0.0.226",
|
|
69148
69148
|
"@tscircuit/file-server": "^0.0.32",
|
|
69149
69149
|
"@tscircuit/footprinter": "^0.0.438",
|
|
69150
69150
|
"@tscircuit/image-utils": "^0.0.8",
|
|
@@ -69205,6 +69205,7 @@ var package_default = {
|
|
|
69205
69205
|
ky: "^1.7.4",
|
|
69206
69206
|
"make-vfs": "^1.0.15",
|
|
69207
69207
|
md5: "^2.3.0",
|
|
69208
|
+
"mime-types": "^3.0.2",
|
|
69208
69209
|
"pdf-lib": "^1.17.1",
|
|
69209
69210
|
"perfect-cli": "^1.0.21",
|
|
69210
69211
|
playwright: "^1.57.0",
|
|
@@ -84773,19 +84774,19 @@ var findPushProject = async ({
|
|
|
84773
84774
|
}) ?? undefined;
|
|
84774
84775
|
return { snippetFilePath, packageJsonPath, projectDir };
|
|
84775
84776
|
};
|
|
84776
|
-
var
|
|
84777
|
-
const
|
|
84778
|
-
|
|
84779
|
-
|
|
84780
|
-
|
|
84781
|
-
|
|
84782
|
-
|
|
84783
|
-
|
|
84784
|
-
|
|
84785
|
-
|
|
84786
|
-
|
|
84787
|
-
|
|
84788
|
-
|
|
84777
|
+
var getUploadFiles = (filePaths, projectDir) => filePaths.map((fullFilePath) => {
|
|
84778
|
+
const relativeFilePath = path28.relative(projectDir, fullFilePath).split(path28.sep).join("/");
|
|
84779
|
+
const fileBuffer = fs24.readFileSync(fullFilePath);
|
|
84780
|
+
const isBinary = isBinaryFile(relativeFilePath) || hasBinaryContent(fileBuffer);
|
|
84781
|
+
return isBinary ? {
|
|
84782
|
+
file_path: relativeFilePath,
|
|
84783
|
+
content_base64: fileBuffer.toString("base64")
|
|
84784
|
+
} : {
|
|
84785
|
+
file_path: relativeFilePath,
|
|
84786
|
+
content_text: fileBuffer.toString("utf8")
|
|
84787
|
+
};
|
|
84788
|
+
});
|
|
84789
|
+
var createArchivePayload = (files, packageNameWithVersion) => {
|
|
84789
84790
|
const archive = gzipSync(JSON.stringify({ files }), { level: 9 });
|
|
84790
84791
|
return {
|
|
84791
84792
|
package_name_with_version: packageNameWithVersion,
|
|
@@ -84992,53 +84993,79 @@ var pushSnippet = async ({
|
|
|
84992
84993
|
const filePaths = getPackageFilePaths(projectDir, includeDist ? [] : ["**/dist/**"]);
|
|
84993
84994
|
const uploadResults = { succeeded: [], failed: [] };
|
|
84994
84995
|
const packageNameWithVersion = `${scopedPackageName}@${releaseVersion}`;
|
|
84996
|
+
const files = getUploadFiles(filePaths, projectDir);
|
|
84997
|
+
let filesToUpload = files;
|
|
84995
84998
|
if (compress) {
|
|
84996
84999
|
log(kleur_default.gray("Uploading package archive..."));
|
|
84997
85000
|
try {
|
|
84998
|
-
const archivePayload =
|
|
85001
|
+
const archivePayload = createArchivePayload(files, packageNameWithVersion);
|
|
84999
85002
|
await ky.post("package_files/upload_archive", {
|
|
85000
85003
|
json: archivePayload
|
|
85001
85004
|
});
|
|
85002
|
-
for (const
|
|
85003
|
-
|
|
85004
|
-
uploadResults.succeeded.push(relativeFilePath);
|
|
85005
|
+
for (const file of files) {
|
|
85006
|
+
uploadResults.succeeded.push(file.file_path);
|
|
85005
85007
|
}
|
|
85008
|
+
filesToUpload = [];
|
|
85006
85009
|
log(kleur_default.gray(`\uD83D\uDCE6 Uploaded archive with ${filePaths.length} files`));
|
|
85007
85010
|
} catch (error) {
|
|
85008
|
-
|
|
85009
|
-
|
|
85010
|
-
|
|
85011
|
-
|
|
85012
|
-
|
|
85013
|
-
|
|
85014
|
-
|
|
85015
|
-
|
|
85016
|
-
|
|
85017
|
-
|
|
85018
|
-
|
|
85019
|
-
|
|
85020
|
-
|
|
85021
|
-
|
|
85011
|
+
const status = error?.response?.status;
|
|
85012
|
+
if (status === undefined || status === 408 || status >= 500) {
|
|
85013
|
+
log(kleur_default.yellow(`Archive upload outcome unknown, checking release files: ${error}`));
|
|
85014
|
+
try {
|
|
85015
|
+
const { package_files: remoteFiles } = await ky.get("package_files/list", {
|
|
85016
|
+
searchParams: {
|
|
85017
|
+
package_name_with_version: packageNameWithVersion
|
|
85018
|
+
}
|
|
85019
|
+
}).json();
|
|
85020
|
+
const remoteIds = new Map(remoteFiles.map((file) => [file.file_path, file.package_file_id]));
|
|
85021
|
+
filesToUpload = [];
|
|
85022
|
+
for (const file of files) {
|
|
85023
|
+
const remoteId = remoteIds.get(file.file_path);
|
|
85024
|
+
if (remoteId) {
|
|
85025
|
+
const remoteContent = await ky.get("package_files/download", {
|
|
85026
|
+
searchParams: { package_file_id: remoteId }
|
|
85027
|
+
}).arrayBuffer();
|
|
85028
|
+
const localContent = file.content_base64 !== undefined ? Buffer.from(file.content_base64, "base64") : Buffer.from(file.content_text, "utf8");
|
|
85029
|
+
if (localContent.equals(Buffer.from(remoteContent))) {
|
|
85030
|
+
uploadResults.succeeded.push(file.file_path);
|
|
85031
|
+
continue;
|
|
85032
|
+
}
|
|
85033
|
+
}
|
|
85034
|
+
filesToUpload.push(file);
|
|
85035
|
+
}
|
|
85036
|
+
log(kleur_default.gray(`Verified ${uploadResults.succeeded.length} archive files; ${filesToUpload.length} files still need uploading`));
|
|
85037
|
+
} catch (verificationError) {
|
|
85038
|
+
onError(`Could not verify archive upload outcome: ${verificationError}. No files were retransmitted; check ${packageNameWithVersion} before retrying.`);
|
|
85039
|
+
return onExit(1);
|
|
85040
|
+
}
|
|
85022
85041
|
} else {
|
|
85023
|
-
|
|
85042
|
+
log(kleur_default.yellow(`Archive upload failed, falling back to file-by-file upload: ${error}`));
|
|
85024
85043
|
}
|
|
85025
|
-
|
|
85026
|
-
|
|
85027
|
-
|
|
85028
|
-
|
|
85029
|
-
|
|
85030
|
-
|
|
85031
|
-
|
|
85032
|
-
|
|
85044
|
+
}
|
|
85045
|
+
}
|
|
85046
|
+
for (const file of filesToUpload) {
|
|
85047
|
+
const relativeFilePath = file.file_path;
|
|
85048
|
+
const isBinary = file.content_base64 !== undefined;
|
|
85049
|
+
const payload = {
|
|
85050
|
+
...file,
|
|
85051
|
+
package_name_with_version: packageNameWithVersion
|
|
85052
|
+
};
|
|
85053
|
+
await ky.post("package_files/create", {
|
|
85054
|
+
json: payload
|
|
85055
|
+
}).then(() => {
|
|
85056
|
+
const icon = isBinary ? "\uD83D\uDCE6" : "⬆︎";
|
|
85057
|
+
console.log(kleur_default.gray(`${icon} ${relativeFilePath}`));
|
|
85058
|
+
uploadResults.succeeded.push(relativeFilePath);
|
|
85059
|
+
}).catch(async (error) => {
|
|
85060
|
+
const errorDetails = String(error)?.split(`
|
|
85033
85061
|
|
|
85034
85062
|
Request Body:`)?.[0];
|
|
85035
|
-
|
|
85036
|
-
|
|
85037
|
-
|
|
85038
|
-
|
|
85039
|
-
});
|
|
85063
|
+
console.log(kleur_default.red(` ${relativeFilePath} - failed`));
|
|
85064
|
+
uploadResults.failed.push({
|
|
85065
|
+
file: relativeFilePath,
|
|
85066
|
+
error: errorDetails
|
|
85040
85067
|
});
|
|
85041
|
-
}
|
|
85068
|
+
});
|
|
85042
85069
|
}
|
|
85043
85070
|
log(`
|
|
85044
85071
|
`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2373",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/tscircuit/cli"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@tscircuit/circuit-json-schematic-placement-analysis": "https://jscdn.tscircuit.com/@tscircuit/circuit-json-schematic-placement-analysis/0.0.68.tgz",
|
|
21
21
|
"@tscircuit/circuit-json-util": "^0.0.121",
|
|
22
22
|
"@tscircuit/eval": "0.0.1619",
|
|
23
|
-
"@tscircuit/fake-snippets": "^0.0.
|
|
23
|
+
"@tscircuit/fake-snippets": "^0.0.226",
|
|
24
24
|
"@tscircuit/file-server": "^0.0.32",
|
|
25
25
|
"@tscircuit/footprinter": "^0.0.438",
|
|
26
26
|
"@tscircuit/image-utils": "^0.0.8",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"ky": "^1.7.4",
|
|
82
82
|
"make-vfs": "^1.0.15",
|
|
83
83
|
"md5": "^2.3.0",
|
|
84
|
+
"mime-types": "^3.0.2",
|
|
84
85
|
"pdf-lib": "^1.17.1",
|
|
85
86
|
"perfect-cli": "^1.0.21",
|
|
86
87
|
"playwright": "^1.57.0",
|