@uniformdev/cli 19.78.1 → 19.79.0
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/index.mjs +31 -21
- package/package.json +10 -10
package/dist/index.mjs
CHANGED
|
@@ -677,7 +677,7 @@ import { createHash } from "crypto";
|
|
|
677
677
|
import fsj from "fs-jetpack";
|
|
678
678
|
import sizeOf from "image-size";
|
|
679
679
|
import PQueue from "p-queue";
|
|
680
|
-
import { join as join2 } from "path";
|
|
680
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
681
681
|
var FILES_DIRECTORY_NAME = "files";
|
|
682
682
|
var urlToHash = (url) => {
|
|
683
683
|
const hash = createHash("sha256");
|
|
@@ -723,10 +723,9 @@ var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
|
723
723
|
return;
|
|
724
724
|
}
|
|
725
725
|
const fileBuffer = await response.arrayBuffer();
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
);
|
|
726
|
+
const isPackage = isPathAPackageFile(options.directory);
|
|
727
|
+
const writeDirectory = isPackage ? dirname2(options.directory) : options.directory;
|
|
728
|
+
await fsj.writeAsync(join2(writeDirectory, FILES_DIRECTORY_NAME, fileName), Buffer.from(fileBuffer));
|
|
730
729
|
} catch {
|
|
731
730
|
console.warn(`Failed to download file ${url}`);
|
|
732
731
|
}
|
|
@@ -782,9 +781,10 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
782
781
|
};
|
|
783
782
|
}
|
|
784
783
|
})();
|
|
784
|
+
const mimeType = preferredType(url.split(".").at(-1) ?? "");
|
|
785
785
|
const { id, method, uploadUrl } = await options.fileClient.insert({
|
|
786
786
|
name: fileName,
|
|
787
|
-
mediaType:
|
|
787
|
+
mediaType: mimeType,
|
|
788
788
|
size: fileBuffer.length,
|
|
789
789
|
width,
|
|
790
790
|
height,
|
|
@@ -792,7 +792,11 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
792
792
|
});
|
|
793
793
|
const uploadResponse = await fetch(uploadUrl, {
|
|
794
794
|
method,
|
|
795
|
-
body: fileBuffer
|
|
795
|
+
body: fileBuffer,
|
|
796
|
+
headers: {
|
|
797
|
+
"Content-Type": mimeType,
|
|
798
|
+
"Content-Length": fileBuffer.length.toString()
|
|
799
|
+
}
|
|
796
800
|
});
|
|
797
801
|
if (!uploadResponse.ok) {
|
|
798
802
|
console.warn(`Failed to upload file ${url}`);
|
|
@@ -851,16 +855,16 @@ var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
|
851
855
|
return JSON.parse(objectAsString);
|
|
852
856
|
};
|
|
853
857
|
var updateAssetFileIdBasedOnUrl = async (asset, options) => {
|
|
854
|
-
var _a;
|
|
855
|
-
const fileUrl = (_a = asset.asset.
|
|
856
|
-
if (!fileUrl || !asset.asset.file) {
|
|
858
|
+
var _a, _b, _c;
|
|
859
|
+
const fileUrl = (_b = (_a = asset.asset.fields) == null ? void 0 : _a.url) == null ? void 0 : _b.value;
|
|
860
|
+
if (!fileUrl || !((_c = asset.asset.fields) == null ? void 0 : _c.file)) {
|
|
857
861
|
return asset;
|
|
858
862
|
}
|
|
859
863
|
const file = await options.fileClient.get({ url: fileUrl }).catch(() => null);
|
|
860
864
|
if (!file) {
|
|
861
865
|
return asset;
|
|
862
866
|
}
|
|
863
|
-
asset.asset.file.value = file.id;
|
|
867
|
+
asset.asset.fields.file.value = file.id;
|
|
864
868
|
return asset;
|
|
865
869
|
};
|
|
866
870
|
|
|
@@ -870,8 +874,8 @@ import { convertAssetToPutAsset } from "@uniformdev/assets";
|
|
|
870
874
|
// src/commands/canvas/commands/asset/_util.ts
|
|
871
875
|
var selectAssetIdentifier = (e) => e.asset._id;
|
|
872
876
|
var selectAssetDisplayName = (e) => {
|
|
873
|
-
var _a;
|
|
874
|
-
return `${((_a = e.asset.
|
|
877
|
+
var _a, _b;
|
|
878
|
+
return `${((_b = (_a = e.asset.fields) == null ? void 0 : _a.title) == null ? void 0 : _b.value) ?? "Untitled"} (pid: ${selectAssetIdentifier(e)})`;
|
|
875
879
|
};
|
|
876
880
|
|
|
877
881
|
// src/commands/canvas/util.ts
|
|
@@ -1005,12 +1009,12 @@ var AssetPullModule = {
|
|
|
1005
1009
|
let target;
|
|
1006
1010
|
const isPackage = isPathAPackageFile(directory);
|
|
1007
1011
|
const onBeforeDeleteObject = async (id, object) => {
|
|
1008
|
-
var _a;
|
|
1012
|
+
var _a, _b;
|
|
1009
1013
|
const asset = object.object;
|
|
1010
|
-
if (!((_a = asset.asset.
|
|
1014
|
+
if (!((_b = (_a = asset.asset.fields) == null ? void 0 : _a.url) == null ? void 0 : _b.value)) {
|
|
1011
1015
|
return;
|
|
1012
1016
|
}
|
|
1013
|
-
await deleteDownloadedFileByUrl(asset.asset.url.value, {
|
|
1017
|
+
await deleteDownloadedFileByUrl(asset.asset.fields.url.value, {
|
|
1014
1018
|
directory
|
|
1015
1019
|
});
|
|
1016
1020
|
};
|
|
@@ -3024,7 +3028,12 @@ var EntryGetModule = {
|
|
|
3024
3028
|
handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId }) => {
|
|
3025
3029
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3026
3030
|
const client = new ContentClient7({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
3027
|
-
const res = await client.getEntries({
|
|
3031
|
+
const res = await client.getEntries({
|
|
3032
|
+
offset: 0,
|
|
3033
|
+
limit: 1,
|
|
3034
|
+
entryIDs: [id],
|
|
3035
|
+
skipOverridesResolution: true
|
|
3036
|
+
});
|
|
3028
3037
|
if (res.entries.length !== 1) {
|
|
3029
3038
|
throw new Error(`Entry with ID ${id} not found`);
|
|
3030
3039
|
}
|
|
@@ -3041,7 +3050,7 @@ var EntryListModule = {
|
|
|
3041
3050
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3042
3051
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3043
3052
|
const client = new ContentClient8({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
3044
|
-
const res = await client.getEntries({ offset: 0, limit: 1e3 });
|
|
3053
|
+
const res = await client.getEntries({ offset: 0, limit: 1e3, skipOverridesResolution: true });
|
|
3045
3054
|
emitWithFormat(res.entries, format, filename);
|
|
3046
3055
|
}
|
|
3047
3056
|
};
|
|
@@ -3067,6 +3076,7 @@ function createEntryEngineDataSource({
|
|
|
3067
3076
|
offset: 0,
|
|
3068
3077
|
limit: 1e3,
|
|
3069
3078
|
skipDataResolution: true,
|
|
3079
|
+
skipOverridesResolution: true,
|
|
3070
3080
|
state: stateId,
|
|
3071
3081
|
withComponentIDs: true
|
|
3072
3082
|
});
|
|
@@ -5441,7 +5451,7 @@ import { PostHog } from "posthog-node";
|
|
|
5441
5451
|
// package.json
|
|
5442
5452
|
var package_default = {
|
|
5443
5453
|
name: "@uniformdev/cli",
|
|
5444
|
-
version: "19.
|
|
5454
|
+
version: "19.79.0",
|
|
5445
5455
|
description: "Uniform command line interface tool",
|
|
5446
5456
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
5447
5457
|
main: "./cli.js",
|
|
@@ -5495,8 +5505,8 @@ var package_default = {
|
|
|
5495
5505
|
devDependencies: {
|
|
5496
5506
|
"@types/diff": "5.0.8",
|
|
5497
5507
|
"@types/inquirer": "9.0.3",
|
|
5498
|
-
"@types/js-yaml": "4.0.
|
|
5499
|
-
"@types/jsonwebtoken": "9.0.
|
|
5508
|
+
"@types/js-yaml": "4.0.9",
|
|
5509
|
+
"@types/jsonwebtoken": "9.0.5",
|
|
5500
5510
|
"@types/lodash.isequalwith": "4.4.7",
|
|
5501
5511
|
"@types/node": "18.17.18",
|
|
5502
5512
|
"@types/yargs": "17.0.24"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/cli",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.79.0",
|
|
4
4
|
"description": "Uniform command line interface tool",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./cli.js",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@thi.ng/mime": "^2.2.23",
|
|
20
|
-
"@uniformdev/assets": "19.
|
|
21
|
-
"@uniformdev/canvas": "19.
|
|
22
|
-
"@uniformdev/context": "19.
|
|
23
|
-
"@uniformdev/files": "19.
|
|
24
|
-
"@uniformdev/project-map": "19.
|
|
25
|
-
"@uniformdev/redirect": "19.
|
|
20
|
+
"@uniformdev/assets": "19.79.0",
|
|
21
|
+
"@uniformdev/canvas": "19.79.0",
|
|
22
|
+
"@uniformdev/context": "19.79.0",
|
|
23
|
+
"@uniformdev/files": "19.79.0",
|
|
24
|
+
"@uniformdev/project-map": "19.79.0",
|
|
25
|
+
"@uniformdev/redirect": "19.79.0",
|
|
26
26
|
"call-bind": "^1.0.2",
|
|
27
27
|
"colorette": "2.0.20",
|
|
28
28
|
"cosmiconfig": "8.3.6",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/diff": "5.0.8",
|
|
56
56
|
"@types/inquirer": "9.0.3",
|
|
57
|
-
"@types/js-yaml": "4.0.
|
|
58
|
-
"@types/jsonwebtoken": "9.0.
|
|
57
|
+
"@types/js-yaml": "4.0.9",
|
|
58
|
+
"@types/jsonwebtoken": "9.0.5",
|
|
59
59
|
"@types/lodash.isequalwith": "4.4.7",
|
|
60
60
|
"@types/node": "18.17.18",
|
|
61
61
|
"@types/yargs": "17.0.24"
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "78f5ededbaa1a67d58d808eac23ab64769e14e10"
|
|
73
73
|
}
|