@uniformdev/cli 19.87.0 → 19.88.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 +226 -58
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
7
7
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
// ../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.
|
|
10
|
+
// ../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.38.3_postcss@8.4.32_typescript@5.3.2/node_modules/tsup/assets/esm_shims.js
|
|
11
11
|
import { fileURLToPath } from "url";
|
|
12
12
|
import path from "path";
|
|
13
13
|
var getFilename = () => fileURLToPath(import.meta.url);
|
|
@@ -669,6 +669,7 @@ var AssetListModule = {
|
|
|
669
669
|
|
|
670
670
|
// src/commands/canvas/commands/asset/pull.ts
|
|
671
671
|
import { UncachedAssetClient as UncachedAssetClient3 } from "@uniformdev/assets";
|
|
672
|
+
import { UncachedFileClient } from "@uniformdev/files";
|
|
672
673
|
|
|
673
674
|
// src/files/index.ts
|
|
674
675
|
import { preferredType } from "@thi.ng/mime";
|
|
@@ -679,20 +680,60 @@ import sizeOf from "image-size";
|
|
|
679
680
|
import PQueue from "p-queue";
|
|
680
681
|
import { dirname as dirname2, join as join2 } from "path";
|
|
681
682
|
var FILES_DIRECTORY_NAME = "files";
|
|
683
|
+
var escapeRegExp = (string) => {
|
|
684
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
685
|
+
};
|
|
682
686
|
var urlToHash = (url) => {
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
687
|
+
return Buffer.from(
|
|
688
|
+
// We take only the first 64 characters of the pathname as
|
|
689
|
+
// that's enough to guarantee uniqueness
|
|
690
|
+
new URL(url).pathname.substring(0, 64)
|
|
691
|
+
).toString("base64");
|
|
692
|
+
};
|
|
693
|
+
var hashToPartialPathname = (hash) => {
|
|
694
|
+
try {
|
|
695
|
+
return Buffer.from(hash, "base64").toString("utf8");
|
|
696
|
+
} catch {
|
|
697
|
+
return null;
|
|
698
|
+
}
|
|
686
699
|
};
|
|
687
|
-
var
|
|
688
|
-
const
|
|
689
|
-
const
|
|
690
|
-
const
|
|
700
|
+
var findUrlMatchingPartialPathname = (source, pathname) => {
|
|
701
|
+
const escapedPathname = escapeRegExp(pathname);
|
|
702
|
+
const regex = new RegExp(`"(https://([^"]*?)?img.uniform.(rocks|global)${escapedPathname}([^"]*?))"`);
|
|
703
|
+
const match = source.match(regex);
|
|
704
|
+
if (match && match[1]) {
|
|
705
|
+
return match[1];
|
|
706
|
+
}
|
|
707
|
+
return null;
|
|
708
|
+
};
|
|
709
|
+
var urlToFileExtension = (url) => {
|
|
710
|
+
try {
|
|
711
|
+
const urlObject = new URL(url);
|
|
712
|
+
const fileNameChunks = urlObject.pathname.split(".");
|
|
713
|
+
return fileNameChunks.length > 1 ? fileNameChunks.at(-1) ?? null : null;
|
|
714
|
+
} catch {
|
|
715
|
+
return null;
|
|
716
|
+
}
|
|
717
|
+
};
|
|
718
|
+
var urlToFileName = (url, hash) => {
|
|
719
|
+
const fileName = hash ?? urlToHash(url);
|
|
720
|
+
const fileExtension = urlToFileExtension(url);
|
|
691
721
|
return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
|
|
692
722
|
};
|
|
723
|
+
var getFilesDirectory = (directory) => {
|
|
724
|
+
const isPackage = isPathAPackageFile(directory);
|
|
725
|
+
return isPackage ? dirname2(directory) : (
|
|
726
|
+
// If we are syncing to a directory, we want to write all files into a
|
|
727
|
+
// top-lvl folder. That way any entities that contain files will sync to the
|
|
728
|
+
// same directory, so there is no duplication
|
|
729
|
+
join2(directory, "..")
|
|
730
|
+
);
|
|
731
|
+
};
|
|
732
|
+
var getUniformFileUrlMatches = (string) => {
|
|
733
|
+
return string.matchAll(/"(https:\/\/([^"]*?)?img\.uniform\.(rocks|global)\/([^"]*?))"/g);
|
|
734
|
+
};
|
|
693
735
|
var deleteDownloadedFileByUrl = async (url, options) => {
|
|
694
|
-
const
|
|
695
|
-
const writeDirectory = isPackage ? dirname2(options.directory) : options.directory;
|
|
736
|
+
const writeDirectory = getFilesDirectory(options.directory);
|
|
696
737
|
const fileName = urlToFileName(url);
|
|
697
738
|
const fileToDelete = join2(writeDirectory, FILES_DIRECTORY_NAME, fileName);
|
|
698
739
|
try {
|
|
@@ -703,18 +744,14 @@ var deleteDownloadedFileByUrl = async (url, options) => {
|
|
|
703
744
|
};
|
|
704
745
|
var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
705
746
|
const objectAsString = JSON.stringify(object);
|
|
706
|
-
const uniformFileUrlMatches = objectAsString
|
|
707
|
-
|
|
708
|
-
);
|
|
709
|
-
const isPackage = isPathAPackageFile(options.directory);
|
|
710
|
-
const writeDirectory = isPackage ? dirname2(options.directory) : options.directory;
|
|
747
|
+
const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
|
|
748
|
+
const writeDirectory = getFilesDirectory(options.directory);
|
|
711
749
|
if (uniformFileUrlMatches) {
|
|
712
750
|
const fileDownloadQueue = new PQueue({ concurrency: 10 });
|
|
713
751
|
for (const match of uniformFileUrlMatches) {
|
|
714
752
|
const url = new URL(match[1]);
|
|
715
753
|
fileDownloadQueue.add(async () => {
|
|
716
754
|
try {
|
|
717
|
-
const fetchUrl = `${url.origin}${url.pathname}?format=original`;
|
|
718
755
|
const fileName = urlToFileName(url.toString());
|
|
719
756
|
const fileAlreadyExists = await fsj.existsAsync(
|
|
720
757
|
join2(writeDirectory, FILES_DIRECTORY_NAME, fileName)
|
|
@@ -722,6 +759,23 @@ var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
|
722
759
|
if (fileAlreadyExists) {
|
|
723
760
|
return;
|
|
724
761
|
}
|
|
762
|
+
const file = await options.fileClient.get({ url: url.toString() }).catch(() => null);
|
|
763
|
+
if (!file) {
|
|
764
|
+
console.warn(`Skipping file ${url} as it does not exist in the project anymore`);
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
if (file.sourceId) {
|
|
768
|
+
try {
|
|
769
|
+
const hashAlreadyExists = await fsj.findAsync(join2(writeDirectory, FILES_DIRECTORY_NAME), {
|
|
770
|
+
matching: [file.sourceId, `${file.sourceId}.*`]
|
|
771
|
+
});
|
|
772
|
+
if (hashAlreadyExists.length > 0) {
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
} catch {
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
const fetchUrl = `${url.origin}${url.pathname}?format=original`;
|
|
725
779
|
const response = await fetch(fetchUrl);
|
|
726
780
|
if (!response.ok) {
|
|
727
781
|
return;
|
|
@@ -739,37 +793,41 @@ var extractAndDownloadUniformFilesForObject = async (object, options) => {
|
|
|
739
793
|
};
|
|
740
794
|
var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
741
795
|
let objectAsString = JSON.stringify(object);
|
|
742
|
-
const uniformFileUrlMatches = objectAsString
|
|
743
|
-
|
|
744
|
-
);
|
|
796
|
+
const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
|
|
797
|
+
const writeDirectory = getFilesDirectory(options.directory);
|
|
745
798
|
const isPackage = isPathAPackageFile(options.directory);
|
|
746
|
-
const
|
|
799
|
+
const legacyWriteDirectory = isPackage ? dirname2(options.directory) : options.directory;
|
|
747
800
|
if (uniformFileUrlMatches) {
|
|
748
801
|
const fileUploadQueue = new PQueue({ concurrency: 3 });
|
|
749
802
|
for (const match of uniformFileUrlMatches) {
|
|
750
803
|
const url = match[1];
|
|
751
804
|
const hash = urlToHash(url);
|
|
805
|
+
const legacyHash = legacyUrlToHash(url);
|
|
752
806
|
fileUploadQueue.add(async () => {
|
|
753
807
|
try {
|
|
754
808
|
const fileAlreadyExistsChecks = await Promise.all([
|
|
755
809
|
options.fileClient.get({ url }).catch(() => null),
|
|
756
|
-
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
810
|
+
options.fileClient.get({ sourceId: hash }).catch(() => null),
|
|
811
|
+
options.fileClient.get({ sourceId: legacyHash }).catch(() => null)
|
|
757
812
|
]);
|
|
758
813
|
if (fileAlreadyExistsChecks.some((check) => check !== null)) {
|
|
759
814
|
return;
|
|
760
815
|
}
|
|
761
816
|
const localFileName = urlToFileName(url);
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
)
|
|
817
|
+
let expectedFilePath = join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName);
|
|
818
|
+
let fileExistsLocally = await fsj.existsAsync(expectedFilePath);
|
|
819
|
+
if (!fileExistsLocally) {
|
|
820
|
+
const localFileName2 = legacyUrlToFileName(url);
|
|
821
|
+
expectedFilePath = join2(legacyWriteDirectory, FILES_DIRECTORY_NAME, localFileName2);
|
|
822
|
+
fileExistsLocally = await fsj.existsAsync(expectedFilePath);
|
|
823
|
+
}
|
|
765
824
|
if (!fileExistsLocally) {
|
|
766
|
-
console.warn(
|
|
825
|
+
console.warn(
|
|
826
|
+
`Skipping file ${url} as we couldn't find a local copy (looked at ${expectedFilePath})`
|
|
827
|
+
);
|
|
767
828
|
return;
|
|
768
829
|
}
|
|
769
|
-
const fileBuffer = await fsj.readAsync(
|
|
770
|
-
join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName),
|
|
771
|
-
"buffer"
|
|
772
|
-
);
|
|
830
|
+
const fileBuffer = await fsj.readAsync(expectedFilePath, "buffer");
|
|
773
831
|
if (!fileBuffer) {
|
|
774
832
|
console.warn(`Skipping file ${url} as we couldn't read it`);
|
|
775
833
|
return;
|
|
@@ -815,8 +873,8 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
815
873
|
return file.url;
|
|
816
874
|
};
|
|
817
875
|
const abortTimeout = setTimeout(() => {
|
|
818
|
-
throw new Error(`Failed to upload file ${url}`);
|
|
819
|
-
},
|
|
876
|
+
throw new Error(`Failed to upload file ${url} (upload timed out)`);
|
|
877
|
+
}, 3e4);
|
|
820
878
|
const uploadedFileUrl = await checkForFile();
|
|
821
879
|
clearTimeout(abortTimeout);
|
|
822
880
|
objectAsString = objectAsString.replaceAll(`"${url}"`, `"${uploadedFileUrl}"`);
|
|
@@ -831,19 +889,19 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
831
889
|
};
|
|
832
890
|
var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
833
891
|
let objectAsString = JSON.stringify(object);
|
|
834
|
-
const uniformFileUrlMatches = objectAsString
|
|
835
|
-
/"(https:\/\/(.*)?img\.uniform\.(rocks|global)\/(.*?))"/g
|
|
836
|
-
);
|
|
892
|
+
const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
|
|
837
893
|
if (uniformFileUrlMatches) {
|
|
838
894
|
const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
|
|
839
895
|
for (const match of uniformFileUrlMatches) {
|
|
840
896
|
const url = match[1];
|
|
841
897
|
const hash = urlToHash(url);
|
|
898
|
+
const legacyHash = legacyUrlToHash(url);
|
|
842
899
|
fileUrlReplacementQueue.add(async () => {
|
|
843
900
|
try {
|
|
844
901
|
const fileAlreadyExistsChecks = await Promise.all([
|
|
845
902
|
options.fileClient.get({ url }).catch(() => null),
|
|
846
|
-
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
903
|
+
options.fileClient.get({ sourceId: hash }).catch(() => null),
|
|
904
|
+
options.fileClient.get({ sourceId: legacyHash }).catch(() => null)
|
|
847
905
|
]);
|
|
848
906
|
const file = fileAlreadyExistsChecks.find((check) => check !== null);
|
|
849
907
|
if (!file) {
|
|
@@ -858,19 +916,74 @@ var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
|
858
916
|
}
|
|
859
917
|
return JSON.parse(objectAsString);
|
|
860
918
|
};
|
|
919
|
+
var replaceRemoteUrlsWithLocalReferences = async (sourceObject, targetObject, options) => {
|
|
920
|
+
let sourceObjectAsString = JSON.stringify(sourceObject);
|
|
921
|
+
const targetObjectAsString = JSON.stringify(targetObject);
|
|
922
|
+
const uniformFileUrlMatches = getUniformFileUrlMatches(sourceObjectAsString);
|
|
923
|
+
const writeDirectory = getFilesDirectory(options.directory);
|
|
924
|
+
if (uniformFileUrlMatches) {
|
|
925
|
+
const fileUrlReplacementQueue = new PQueue({ concurrency: 3 });
|
|
926
|
+
for (const match of uniformFileUrlMatches) {
|
|
927
|
+
const url = match[1];
|
|
928
|
+
fileUrlReplacementQueue.add(async () => {
|
|
929
|
+
try {
|
|
930
|
+
const localFileName = urlToFileName(url);
|
|
931
|
+
const fileExistsLocally = await fsj.existsAsync(
|
|
932
|
+
join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName)
|
|
933
|
+
);
|
|
934
|
+
if (fileExistsLocally) {
|
|
935
|
+
return;
|
|
936
|
+
}
|
|
937
|
+
const file = await options.fileClient.get({ url }).catch(() => null);
|
|
938
|
+
if (!file || !file.sourceId) {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
const originalPartialPath = hashToPartialPathname(file.sourceId);
|
|
942
|
+
if (!originalPartialPath) {
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
const originalUrl = findUrlMatchingPartialPathname(targetObjectAsString, originalPartialPath);
|
|
946
|
+
if (!originalUrl) {
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
sourceObjectAsString = sourceObjectAsString.replaceAll(`"${url}"`, `"${originalUrl}"`);
|
|
950
|
+
} catch {
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
await fileUrlReplacementQueue.onIdle();
|
|
955
|
+
}
|
|
956
|
+
return JSON.parse(sourceObjectAsString);
|
|
957
|
+
};
|
|
861
958
|
var updateAssetFileIdBasedOnUrl = async (asset, options) => {
|
|
862
|
-
var _a
|
|
863
|
-
|
|
864
|
-
|
|
959
|
+
var _a;
|
|
960
|
+
if (!asset.asset.fields) {
|
|
961
|
+
return asset;
|
|
962
|
+
}
|
|
963
|
+
const fileUrl = (_a = asset.asset.fields.url) == null ? void 0 : _a.value;
|
|
964
|
+
if (!fileUrl) {
|
|
865
965
|
return asset;
|
|
866
966
|
}
|
|
867
967
|
const file = await options.fileClient.get({ url: fileUrl }).catch(() => null);
|
|
868
968
|
if (!file) {
|
|
869
969
|
return asset;
|
|
870
970
|
}
|
|
871
|
-
asset.asset.fields.file
|
|
971
|
+
asset.asset.fields.file = {
|
|
972
|
+
type: "file",
|
|
973
|
+
value: file.id
|
|
974
|
+
};
|
|
872
975
|
return asset;
|
|
873
976
|
};
|
|
977
|
+
var legacyUrlToHash = (url) => {
|
|
978
|
+
const hash = createHash("sha256");
|
|
979
|
+
hash.update(url);
|
|
980
|
+
return hash.digest("hex");
|
|
981
|
+
};
|
|
982
|
+
var legacyUrlToFileName = (url) => {
|
|
983
|
+
const fileName = legacyUrlToHash(url);
|
|
984
|
+
const fileExtension = urlToFileExtension(url);
|
|
985
|
+
return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
|
|
986
|
+
};
|
|
874
987
|
|
|
875
988
|
// src/commands/canvas/assetEngineDataSource.ts
|
|
876
989
|
import { convertAssetToPutAsset } from "@uniformdev/assets";
|
|
@@ -1009,6 +1122,7 @@ var AssetPullModule = {
|
|
|
1009
1122
|
fetch: fetch3,
|
|
1010
1123
|
projectId
|
|
1011
1124
|
});
|
|
1125
|
+
const fileClient = new UncachedFileClient({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1012
1126
|
const source = createAssetEngineDataSource({ client });
|
|
1013
1127
|
let target;
|
|
1014
1128
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -1050,14 +1164,27 @@ var AssetPullModule = {
|
|
|
1050
1164
|
whatIf,
|
|
1051
1165
|
allowEmptySource: true,
|
|
1052
1166
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
1053
|
-
onBeforeCompareObjects: async (sourceObject) => {
|
|
1167
|
+
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
1168
|
+
var _a, _b;
|
|
1054
1169
|
delete sourceObject.object.asset._author;
|
|
1055
|
-
|
|
1170
|
+
const sourceObjectWithPotentiallySwappedUrl = await replaceRemoteUrlsWithLocalReferences(
|
|
1171
|
+
sourceObject,
|
|
1172
|
+
targetObject,
|
|
1173
|
+
{
|
|
1174
|
+
directory,
|
|
1175
|
+
fileClient
|
|
1176
|
+
}
|
|
1177
|
+
);
|
|
1178
|
+
if (((_a = sourceObjectWithPotentiallySwappedUrl.object.asset.fields) == null ? void 0 : _a.url) && ((_b = targetObject.object.asset.fields) == null ? void 0 : _b.url) && sourceObjectWithPotentiallySwappedUrl.object.asset.fields.url.value === targetObject.object.asset.fields.url.value) {
|
|
1179
|
+
targetObject.object.asset.fields.file = sourceObjectWithPotentiallySwappedUrl.object.asset.fields.file;
|
|
1180
|
+
}
|
|
1181
|
+
return sourceObjectWithPotentiallySwappedUrl;
|
|
1056
1182
|
},
|
|
1057
1183
|
onBeforeWriteObject: async (sourceObject) => {
|
|
1058
1184
|
delete sourceObject.object.asset._author;
|
|
1059
1185
|
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
1060
|
-
directory
|
|
1186
|
+
directory,
|
|
1187
|
+
fileClient
|
|
1061
1188
|
});
|
|
1062
1189
|
}
|
|
1063
1190
|
});
|
|
@@ -1066,7 +1193,7 @@ var AssetPullModule = {
|
|
|
1066
1193
|
|
|
1067
1194
|
// src/commands/canvas/commands/asset/push.ts
|
|
1068
1195
|
import { UncachedAssetClient as UncachedAssetClient4 } from "@uniformdev/assets";
|
|
1069
|
-
import { UncachedFileClient } from "@uniformdev/files";
|
|
1196
|
+
import { UncachedFileClient as UncachedFileClient2 } from "@uniformdev/files";
|
|
1070
1197
|
var AssetPushModule = {
|
|
1071
1198
|
command: "push <directory>",
|
|
1072
1199
|
describe: "Pushes all assets from files in a directory to Uniform",
|
|
@@ -1127,7 +1254,7 @@ var AssetPushModule = {
|
|
|
1127
1254
|
});
|
|
1128
1255
|
}
|
|
1129
1256
|
const target = createAssetEngineDataSource({ client });
|
|
1130
|
-
const fileClient = new
|
|
1257
|
+
const fileClient = new UncachedFileClient2({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
1131
1258
|
await syncEngine({
|
|
1132
1259
|
source,
|
|
1133
1260
|
target,
|
|
@@ -1150,10 +1277,15 @@ var AssetPushModule = {
|
|
|
1150
1277
|
return sourceObjectWithNewFileUrls;
|
|
1151
1278
|
},
|
|
1152
1279
|
onBeforeWriteObject: async (sourceObject) => {
|
|
1153
|
-
const sourceObjectWithNewFileUrls = await
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1280
|
+
const sourceObjectWithNewFileUrls = await swapOutUniformFileUrlsForTargetProject(
|
|
1281
|
+
await extractAndUploadUniformFilesForObject(sourceObject, {
|
|
1282
|
+
directory,
|
|
1283
|
+
fileClient
|
|
1284
|
+
}),
|
|
1285
|
+
{
|
|
1286
|
+
fileClient
|
|
1287
|
+
}
|
|
1288
|
+
);
|
|
1157
1289
|
sourceObjectWithNewFileUrls.object = await updateAssetFileIdBasedOnUrl(
|
|
1158
1290
|
sourceObjectWithNewFileUrls.object,
|
|
1159
1291
|
{
|
|
@@ -2089,6 +2221,7 @@ var CompositionPublishModule = {
|
|
|
2089
2221
|
|
|
2090
2222
|
// src/commands/canvas/commands/composition/pull.ts
|
|
2091
2223
|
import { UncachedCanvasClient as UncachedCanvasClient10 } from "@uniformdev/canvas";
|
|
2224
|
+
import { UncachedFileClient as UncachedFileClient3 } from "@uniformdev/files";
|
|
2092
2225
|
var CompositionPullModule = {
|
|
2093
2226
|
command: "pull <directory>",
|
|
2094
2227
|
describe: "Pulls all compositions to local files in a directory",
|
|
@@ -2148,6 +2281,7 @@ var CompositionPullModule = {
|
|
|
2148
2281
|
}) => {
|
|
2149
2282
|
const fetch3 = nodeFetchProxy(proxy);
|
|
2150
2283
|
const client = new UncachedCanvasClient10({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2284
|
+
const fileClient = new UncachedFileClient3({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2151
2285
|
const source = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
2152
2286
|
const isPackage = isPathAPackageFile(directory);
|
|
2153
2287
|
let target;
|
|
@@ -2177,9 +2311,16 @@ var CompositionPullModule = {
|
|
|
2177
2311
|
whatIf,
|
|
2178
2312
|
allowEmptySource: true,
|
|
2179
2313
|
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
2314
|
+
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
2315
|
+
return replaceRemoteUrlsWithLocalReferences(sourceObject, targetObject, {
|
|
2316
|
+
directory,
|
|
2317
|
+
fileClient
|
|
2318
|
+
});
|
|
2319
|
+
},
|
|
2180
2320
|
onBeforeWriteObject: async (sourceObject) => {
|
|
2181
2321
|
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
2182
|
-
directory
|
|
2322
|
+
directory,
|
|
2323
|
+
fileClient
|
|
2183
2324
|
});
|
|
2184
2325
|
}
|
|
2185
2326
|
});
|
|
@@ -2188,7 +2329,7 @@ var CompositionPullModule = {
|
|
|
2188
2329
|
|
|
2189
2330
|
// src/commands/canvas/commands/composition/push.ts
|
|
2190
2331
|
import { UncachedCanvasClient as UncachedCanvasClient11 } from "@uniformdev/canvas";
|
|
2191
|
-
import { UncachedFileClient as
|
|
2332
|
+
import { UncachedFileClient as UncachedFileClient4 } from "@uniformdev/files";
|
|
2192
2333
|
var CompositionPushModule = {
|
|
2193
2334
|
command: "push <directory>",
|
|
2194
2335
|
describe: "Pushes all compositions from files in a directory to Uniform Canvas",
|
|
@@ -2258,7 +2399,7 @@ var CompositionPushModule = {
|
|
|
2258
2399
|
});
|
|
2259
2400
|
}
|
|
2260
2401
|
const target = createComponentInstanceEngineDataSource({ client, state, onlyCompositions, onlyPatterns });
|
|
2261
|
-
const fileClient = new
|
|
2402
|
+
const fileClient = new UncachedFileClient4({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
2262
2403
|
await syncEngine({
|
|
2263
2404
|
source,
|
|
2264
2405
|
target,
|
|
@@ -3061,6 +3202,7 @@ var EntryListModule = {
|
|
|
3061
3202
|
|
|
3062
3203
|
// src/commands/canvas/commands/entry/pull.ts
|
|
3063
3204
|
import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
|
|
3205
|
+
import { UncachedFileClient as UncachedFileClient5 } from "@uniformdev/files";
|
|
3064
3206
|
|
|
3065
3207
|
// src/commands/canvas/entryEngineDataSource.ts
|
|
3066
3208
|
import { convertEntryToPutEntry } from "@uniformdev/canvas";
|
|
@@ -3160,6 +3302,7 @@ var EntryPullModule = {
|
|
|
3160
3302
|
projectId,
|
|
3161
3303
|
bypassCache: true
|
|
3162
3304
|
});
|
|
3305
|
+
const fileClient = new UncachedFileClient5({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3163
3306
|
const source = createEntryEngineDataSource({ client, state });
|
|
3164
3307
|
let target;
|
|
3165
3308
|
const isPackage = isPathAPackageFile(directory);
|
|
@@ -3188,13 +3331,26 @@ var EntryPullModule = {
|
|
|
3188
3331
|
mode,
|
|
3189
3332
|
whatIf,
|
|
3190
3333
|
allowEmptySource: true,
|
|
3191
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3334
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
3335
|
+
onBeforeCompareObjects: async (sourceObject, targetObject) => {
|
|
3336
|
+
return replaceRemoteUrlsWithLocalReferences(sourceObject, targetObject, {
|
|
3337
|
+
directory,
|
|
3338
|
+
fileClient
|
|
3339
|
+
});
|
|
3340
|
+
},
|
|
3341
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
3342
|
+
return extractAndDownloadUniformFilesForObject(sourceObject, {
|
|
3343
|
+
directory,
|
|
3344
|
+
fileClient
|
|
3345
|
+
});
|
|
3346
|
+
}
|
|
3192
3347
|
});
|
|
3193
3348
|
}
|
|
3194
3349
|
};
|
|
3195
3350
|
|
|
3196
3351
|
// src/commands/canvas/commands/entry/push.ts
|
|
3197
3352
|
import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
|
|
3353
|
+
import { UncachedFileClient as UncachedFileClient6 } from "@uniformdev/files";
|
|
3198
3354
|
var EntryPushModule = {
|
|
3199
3355
|
command: "push <directory>",
|
|
3200
3356
|
describe: "Pushes all entries from files in a directory to Uniform",
|
|
@@ -3259,12 +3415,24 @@ var EntryPushModule = {
|
|
|
3259
3415
|
});
|
|
3260
3416
|
}
|
|
3261
3417
|
const target = createEntryEngineDataSource({ client, state });
|
|
3418
|
+
const fileClient = new UncachedFileClient6({ apiKey, apiHost, fetch: fetch3, projectId });
|
|
3262
3419
|
await syncEngine({
|
|
3263
3420
|
source,
|
|
3264
3421
|
target,
|
|
3265
3422
|
mode,
|
|
3266
3423
|
whatIf,
|
|
3267
|
-
log: createSyncEngineConsoleLogger({ diffMode })
|
|
3424
|
+
log: createSyncEngineConsoleLogger({ diffMode }),
|
|
3425
|
+
onBeforeCompareObjects: async (sourceObject) => {
|
|
3426
|
+
return swapOutUniformFileUrlsForTargetProject(sourceObject, {
|
|
3427
|
+
fileClient
|
|
3428
|
+
});
|
|
3429
|
+
},
|
|
3430
|
+
onBeforeWriteObject: async (sourceObject) => {
|
|
3431
|
+
return extractAndUploadUniformFilesForObject(sourceObject, {
|
|
3432
|
+
directory,
|
|
3433
|
+
fileClient
|
|
3434
|
+
});
|
|
3435
|
+
}
|
|
3268
3436
|
});
|
|
3269
3437
|
}
|
|
3270
3438
|
};
|
|
@@ -5455,7 +5623,7 @@ import { PostHog } from "posthog-node";
|
|
|
5455
5623
|
// package.json
|
|
5456
5624
|
var package_default = {
|
|
5457
5625
|
name: "@uniformdev/cli",
|
|
5458
|
-
version: "19.
|
|
5626
|
+
version: "19.88.0",
|
|
5459
5627
|
description: "Uniform command line interface tool",
|
|
5460
5628
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
5461
5629
|
main: "./cli.js",
|
|
@@ -7582,6 +7750,7 @@ var SyncPullModule = {
|
|
|
7582
7750
|
var _a;
|
|
7583
7751
|
const config2 = serialization;
|
|
7584
7752
|
const enabledEntities = Object.entries({
|
|
7753
|
+
asset: AssetPullModule,
|
|
7585
7754
|
category: CategoryPullModule,
|
|
7586
7755
|
dataType: DataTypePullModule,
|
|
7587
7756
|
prompt: PromptPullModule,
|
|
@@ -7597,8 +7766,7 @@ var SyncPullModule = {
|
|
|
7597
7766
|
projectMapNode: ProjectMapNodePullModule,
|
|
7598
7767
|
redirect: RedirectDefinitionPullModule,
|
|
7599
7768
|
entry: EntryPullModule,
|
|
7600
|
-
contentType: ContentTypePullModule
|
|
7601
|
-
asset: AssetPullModule
|
|
7769
|
+
contentType: ContentTypePullModule
|
|
7602
7770
|
}).filter(([entityType]) => {
|
|
7603
7771
|
var _a2, _b, _c, _d, _e, _f;
|
|
7604
7772
|
return Boolean((_a2 = config2.entitiesConfig) == null ? void 0 : _a2[entityType]) && ((_c = (_b = config2.entitiesConfig) == null ? void 0 : _b[entityType]) == null ? void 0 : _c.disabled) !== true && ((_f = (_e = (_d = config2.entitiesConfig) == null ? void 0 : _d[entityType]) == null ? void 0 : _e.pull) == null ? void 0 : _f.disabled) !== true;
|
|
@@ -7678,6 +7846,7 @@ var SyncPushModule = {
|
|
|
7678
7846
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
7679
7847
|
const config2 = serialization;
|
|
7680
7848
|
const enabledEntities = Object.entries({
|
|
7849
|
+
asset: AssetPushModule,
|
|
7681
7850
|
category: CategoryPushModule,
|
|
7682
7851
|
dataType: DataTypePushModule,
|
|
7683
7852
|
prompt: PromptPushModule,
|
|
@@ -7693,8 +7862,7 @@ var SyncPushModule = {
|
|
|
7693
7862
|
projectMapNode: ProjectMapNodePushModule,
|
|
7694
7863
|
redirect: RedirectDefinitionPushModule,
|
|
7695
7864
|
contentType: ContentTypePushModule,
|
|
7696
|
-
entry: EntryPushModule
|
|
7697
|
-
asset: AssetPushModule
|
|
7865
|
+
entry: EntryPushModule
|
|
7698
7866
|
}).filter(([entityType]) => {
|
|
7699
7867
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
7700
7868
|
return Boolean((_a2 = config2.entitiesConfig) == null ? void 0 : _a2[entityType]) && ((_c2 = (_b2 = config2.entitiesConfig) == null ? void 0 : _b2[entityType]) == null ? void 0 : _c2.disabled) !== true && ((_f2 = (_e2 = (_d2 = config2.entitiesConfig) == null ? void 0 : _d2[entityType]) == null ? void 0 : _e2.push) == null ? void 0 : _f2.disabled) !== true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/cli",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.88.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.88.0",
|
|
21
|
+
"@uniformdev/canvas": "19.88.0",
|
|
22
|
+
"@uniformdev/context": "19.88.0",
|
|
23
|
+
"@uniformdev/files": "19.88.0",
|
|
24
|
+
"@uniformdev/project-map": "19.88.0",
|
|
25
|
+
"@uniformdev/redirect": "19.88.0",
|
|
26
26
|
"call-bind": "^1.0.2",
|
|
27
27
|
"colorette": "2.0.20",
|
|
28
28
|
"cosmiconfig": "8.3.6",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "0a02f919a6b0f0c41307f120adada2e5d45a947b"
|
|
73
73
|
}
|