@uniformdev/cli 19.78.1 → 19.79.1-alpha.11
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 +39 -25
- 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");
|
|
@@ -691,8 +691,10 @@ var urlToFileName = (url) => {
|
|
|
691
691
|
return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
|
|
692
692
|
};
|
|
693
693
|
var deleteDownloadedFileByUrl = async (url, options) => {
|
|
694
|
+
const isPackage = isPathAPackageFile(options.directory);
|
|
695
|
+
const writeDirectory = isPackage ? dirname2(options.directory) : options.directory;
|
|
694
696
|
const fileName = urlToFileName(url);
|
|
695
|
-
const fileToDelete = join2(
|
|
697
|
+
const fileToDelete = join2(writeDirectory, FILES_DIRECTORY_NAME, fileName);
|
|
696
698
|
try {
|
|
697
699
|
await fsj.removeAsync(fileToDelete);
|
|
698
700
|
} catch {
|
|
@@ -704,6 +706,8 @@ var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
|
704
706
|
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
705
707
|
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
706
708
|
);
|
|
709
|
+
const isPackage = isPathAPackageFile(options.directory);
|
|
710
|
+
const writeDirectory = isPackage ? dirname2(options.directory) : options.directory;
|
|
707
711
|
if (uniformFileUrlMatches) {
|
|
708
712
|
const fileDownloadQueue = new PQueue({ concurrency: 10 });
|
|
709
713
|
for (const match of uniformFileUrlMatches) {
|
|
@@ -713,7 +717,7 @@ var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
|
713
717
|
const fetchUrl = `${url.origin}${url.pathname}?format=original`;
|
|
714
718
|
const fileName = urlToFileName(url.toString());
|
|
715
719
|
const fileAlreadyExists = await fsj.existsAsync(
|
|
716
|
-
join2(
|
|
720
|
+
join2(writeDirectory, FILES_DIRECTORY_NAME, fileName)
|
|
717
721
|
);
|
|
718
722
|
if (fileAlreadyExists) {
|
|
719
723
|
return;
|
|
@@ -723,10 +727,7 @@ var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
|
723
727
|
return;
|
|
724
728
|
}
|
|
725
729
|
const fileBuffer = await response.arrayBuffer();
|
|
726
|
-
await fsj.writeAsync(
|
|
727
|
-
join2(options.directory, FILES_DIRECTORY_NAME, fileName),
|
|
728
|
-
Buffer.from(fileBuffer)
|
|
729
|
-
);
|
|
730
|
+
await fsj.writeAsync(join2(writeDirectory, FILES_DIRECTORY_NAME, fileName), Buffer.from(fileBuffer));
|
|
730
731
|
} catch {
|
|
731
732
|
console.warn(`Failed to download file ${url}`);
|
|
732
733
|
}
|
|
@@ -741,6 +742,8 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
741
742
|
const uniformFileUrlMatches = objectAsString.matchAll(
|
|
742
743
|
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
743
744
|
);
|
|
745
|
+
const isPackage = isPathAPackageFile(options.directory);
|
|
746
|
+
const writeDirectory = isPackage ? dirname2(options.directory) : options.directory;
|
|
744
747
|
if (uniformFileUrlMatches) {
|
|
745
748
|
const fileUploadQueue = new PQueue({ concurrency: 3 });
|
|
746
749
|
for (const match of uniformFileUrlMatches) {
|
|
@@ -757,14 +760,14 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
757
760
|
}
|
|
758
761
|
const localFileName = urlToFileName(url);
|
|
759
762
|
const fileExistsLocally = await fsj.existsAsync(
|
|
760
|
-
join2(
|
|
763
|
+
join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName)
|
|
761
764
|
);
|
|
762
765
|
if (!fileExistsLocally) {
|
|
763
766
|
console.warn(`Skipping file ${url} as we couldn't find a local copy`);
|
|
764
767
|
return;
|
|
765
768
|
}
|
|
766
769
|
const fileBuffer = await fsj.readAsync(
|
|
767
|
-
join2(
|
|
770
|
+
join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName),
|
|
768
771
|
"buffer"
|
|
769
772
|
);
|
|
770
773
|
if (!fileBuffer) {
|
|
@@ -782,9 +785,10 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
782
785
|
};
|
|
783
786
|
}
|
|
784
787
|
})();
|
|
788
|
+
const mimeType = preferredType(url.split(".").at(-1) ?? "");
|
|
785
789
|
const { id, method, uploadUrl } = await options.fileClient.insert({
|
|
786
790
|
name: fileName,
|
|
787
|
-
mediaType:
|
|
791
|
+
mediaType: mimeType,
|
|
788
792
|
size: fileBuffer.length,
|
|
789
793
|
width,
|
|
790
794
|
height,
|
|
@@ -792,7 +796,11 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
792
796
|
});
|
|
793
797
|
const uploadResponse = await fetch(uploadUrl, {
|
|
794
798
|
method,
|
|
795
|
-
body: fileBuffer
|
|
799
|
+
body: fileBuffer,
|
|
800
|
+
headers: {
|
|
801
|
+
"Content-Type": mimeType,
|
|
802
|
+
"Content-Length": fileBuffer.length.toString()
|
|
803
|
+
}
|
|
796
804
|
});
|
|
797
805
|
if (!uploadResponse.ok) {
|
|
798
806
|
console.warn(`Failed to upload file ${url}`);
|
|
@@ -851,16 +859,16 @@ var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
|
851
859
|
return JSON.parse(objectAsString);
|
|
852
860
|
};
|
|
853
861
|
var updateAssetFileIdBasedOnUrl = async (asset, options) => {
|
|
854
|
-
var _a;
|
|
855
|
-
const fileUrl = (_a = asset.asset.
|
|
856
|
-
if (!fileUrl || !asset.asset.file) {
|
|
862
|
+
var _a, _b, _c;
|
|
863
|
+
const fileUrl = (_b = (_a = asset.asset.fields) == null ? void 0 : _a.url) == null ? void 0 : _b.value;
|
|
864
|
+
if (!fileUrl || !((_c = asset.asset.fields) == null ? void 0 : _c.file)) {
|
|
857
865
|
return asset;
|
|
858
866
|
}
|
|
859
867
|
const file = await options.fileClient.get({ url: fileUrl }).catch(() => null);
|
|
860
868
|
if (!file) {
|
|
861
869
|
return asset;
|
|
862
870
|
}
|
|
863
|
-
asset.asset.file.value = file.id;
|
|
871
|
+
asset.asset.fields.file.value = file.id;
|
|
864
872
|
return asset;
|
|
865
873
|
};
|
|
866
874
|
|
|
@@ -870,8 +878,8 @@ import { convertAssetToPutAsset } from "@uniformdev/assets";
|
|
|
870
878
|
// src/commands/canvas/commands/asset/_util.ts
|
|
871
879
|
var selectAssetIdentifier = (e) => e.asset._id;
|
|
872
880
|
var selectAssetDisplayName = (e) => {
|
|
873
|
-
var _a;
|
|
874
|
-
return `${((_a = e.asset.
|
|
881
|
+
var _a, _b;
|
|
882
|
+
return `${((_b = (_a = e.asset.fields) == null ? void 0 : _a.title) == null ? void 0 : _b.value) ?? "Untitled"} (pid: ${selectAssetIdentifier(e)})`;
|
|
875
883
|
};
|
|
876
884
|
|
|
877
885
|
// src/commands/canvas/util.ts
|
|
@@ -1005,12 +1013,12 @@ var AssetPullModule = {
|
|
|
1005
1013
|
let target;
|
|
1006
1014
|
const isPackage = isPathAPackageFile(directory);
|
|
1007
1015
|
const onBeforeDeleteObject = async (id, object) => {
|
|
1008
|
-
var _a;
|
|
1016
|
+
var _a, _b;
|
|
1009
1017
|
const asset = object.object;
|
|
1010
|
-
if (!((_a = asset.asset.
|
|
1018
|
+
if (!((_b = (_a = asset.asset.fields) == null ? void 0 : _a.url) == null ? void 0 : _b.value)) {
|
|
1011
1019
|
return;
|
|
1012
1020
|
}
|
|
1013
|
-
await deleteDownloadedFileByUrl(asset.asset.url.value, {
|
|
1021
|
+
await deleteDownloadedFileByUrl(asset.asset.fields.url.value, {
|
|
1014
1022
|
directory
|
|
1015
1023
|
});
|
|
1016
1024
|
};
|
|
@@ -3024,7 +3032,12 @@ var EntryGetModule = {
|
|
|
3024
3032
|
handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId }) => {
|
|
3025
3033
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3026
3034
|
const client = new ContentClient7({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
3027
|
-
const res = await client.getEntries({
|
|
3035
|
+
const res = await client.getEntries({
|
|
3036
|
+
offset: 0,
|
|
3037
|
+
limit: 1,
|
|
3038
|
+
entryIDs: [id],
|
|
3039
|
+
skipOverridesResolution: true
|
|
3040
|
+
});
|
|
3028
3041
|
if (res.entries.length !== 1) {
|
|
3029
3042
|
throw new Error(`Entry with ID ${id} not found`);
|
|
3030
3043
|
}
|
|
@@ -3041,7 +3054,7 @@ var EntryListModule = {
|
|
|
3041
3054
|
handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
|
|
3042
3055
|
const fetch3 = nodeFetchProxy(proxy);
|
|
3043
3056
|
const client = new ContentClient8({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
|
|
3044
|
-
const res = await client.getEntries({ offset: 0, limit: 1e3 });
|
|
3057
|
+
const res = await client.getEntries({ offset: 0, limit: 1e3, skipOverridesResolution: true });
|
|
3045
3058
|
emitWithFormat(res.entries, format, filename);
|
|
3046
3059
|
}
|
|
3047
3060
|
};
|
|
@@ -3067,6 +3080,7 @@ function createEntryEngineDataSource({
|
|
|
3067
3080
|
offset: 0,
|
|
3068
3081
|
limit: 1e3,
|
|
3069
3082
|
skipDataResolution: true,
|
|
3083
|
+
skipOverridesResolution: true,
|
|
3070
3084
|
state: stateId,
|
|
3071
3085
|
withComponentIDs: true
|
|
3072
3086
|
});
|
|
@@ -5441,7 +5455,7 @@ import { PostHog } from "posthog-node";
|
|
|
5441
5455
|
// package.json
|
|
5442
5456
|
var package_default = {
|
|
5443
5457
|
name: "@uniformdev/cli",
|
|
5444
|
-
version: "19.
|
|
5458
|
+
version: "19.79.0",
|
|
5445
5459
|
description: "Uniform command line interface tool",
|
|
5446
5460
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
5447
5461
|
main: "./cli.js",
|
|
@@ -5495,8 +5509,8 @@ var package_default = {
|
|
|
5495
5509
|
devDependencies: {
|
|
5496
5510
|
"@types/diff": "5.0.8",
|
|
5497
5511
|
"@types/inquirer": "9.0.3",
|
|
5498
|
-
"@types/js-yaml": "4.0.
|
|
5499
|
-
"@types/jsonwebtoken": "9.0.
|
|
5512
|
+
"@types/js-yaml": "4.0.9",
|
|
5513
|
+
"@types/jsonwebtoken": "9.0.5",
|
|
5500
5514
|
"@types/lodash.isequalwith": "4.4.7",
|
|
5501
5515
|
"@types/node": "18.17.18",
|
|
5502
5516
|
"@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.1-alpha.11+4547ef846",
|
|
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.1-alpha.11+4547ef846",
|
|
21
|
+
"@uniformdev/canvas": "19.79.1-alpha.11+4547ef846",
|
|
22
|
+
"@uniformdev/context": "19.79.1-alpha.11+4547ef846",
|
|
23
|
+
"@uniformdev/files": "19.79.1-alpha.11+4547ef846",
|
|
24
|
+
"@uniformdev/project-map": "19.79.1-alpha.11+4547ef846",
|
|
25
|
+
"@uniformdev/redirect": "19.79.1-alpha.11+4547ef846",
|
|
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": "4547ef8469f21f7f2341bcd87203372c4646bc08"
|
|
73
73
|
}
|