@uniformdev/cli 19.214.1-alpha.10 → 19.214.1-alpha.17
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 +4 -26
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -618,7 +618,6 @@ var AssetListModule = {
|
|
|
618
618
|
// src/files/index.ts
|
|
619
619
|
import { preferredType } from "@thi.ng/mime";
|
|
620
620
|
import { FILE_READY_STATE, getFileNameFromUrl } from "@uniformdev/files";
|
|
621
|
-
import { createHash } from "crypto";
|
|
622
621
|
import { fileTypeFromBuffer } from "file-type";
|
|
623
622
|
import fsj from "fs-jetpack";
|
|
624
623
|
import sizeOf from "image-size";
|
|
@@ -742,20 +741,16 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
742
741
|
let objectAsString = JSON.stringify(object);
|
|
743
742
|
const uniformFileUrlMatches = getUniformFileUrlMatches(objectAsString);
|
|
744
743
|
const writeDirectory = getFilesDirectory(options.directory);
|
|
745
|
-
const isPackage = isPathAPackageFile(options.directory);
|
|
746
|
-
const legacyWriteDirectory = isPackage ? dirname(options.directory) : options.directory;
|
|
747
744
|
if (uniformFileUrlMatches) {
|
|
748
745
|
const fileUploadQueue = new PQueue({ concurrency: 3 });
|
|
749
746
|
for (const match of uniformFileUrlMatches) {
|
|
750
747
|
const url = match[1];
|
|
751
748
|
const hash = urlToHash(url);
|
|
752
|
-
const legacyHash = legacyUrlToHash(url);
|
|
753
749
|
fileUploadQueue.add(async () => {
|
|
754
750
|
try {
|
|
755
751
|
const fileAlreadyExistsChecks = await Promise.all([
|
|
756
752
|
options.fileClient.get({ url }).catch(() => null),
|
|
757
|
-
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
758
|
-
options.fileClient.get({ sourceId: legacyHash }).catch(() => null)
|
|
753
|
+
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
759
754
|
]);
|
|
760
755
|
const file = fileAlreadyExistsChecks.find((check) => check !== null);
|
|
761
756
|
if (file) {
|
|
@@ -763,13 +758,8 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
|
|
|
763
758
|
return;
|
|
764
759
|
}
|
|
765
760
|
const localFileName = urlToFileName(url);
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
if (!fileExistsLocally) {
|
|
769
|
-
const localFileName2 = legacyUrlToFileName(url);
|
|
770
|
-
expectedFilePath = join2(legacyWriteDirectory, FILES_DIRECTORY_NAME, localFileName2);
|
|
771
|
-
fileExistsLocally = await fsj.existsAsync(expectedFilePath);
|
|
772
|
-
}
|
|
761
|
+
const expectedFilePath = join2(writeDirectory, FILES_DIRECTORY_NAME, localFileName);
|
|
762
|
+
const fileExistsLocally = await fsj.existsAsync(expectedFilePath);
|
|
773
763
|
if (!fileExistsLocally) {
|
|
774
764
|
console.warn(
|
|
775
765
|
`Skipping file ${url} as we couldn't find a local copy (looked at ${expectedFilePath})`
|
|
@@ -860,13 +850,11 @@ var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
|
|
|
860
850
|
for (const match of uniformFileUrlMatches) {
|
|
861
851
|
const url = match[1];
|
|
862
852
|
const hash = urlToHash(url);
|
|
863
|
-
const legacyHash = legacyUrlToHash(url);
|
|
864
853
|
fileUrlReplacementQueue.add(async () => {
|
|
865
854
|
try {
|
|
866
855
|
const fileAlreadyExistsChecks = await Promise.all([
|
|
867
856
|
options.fileClient.get({ url }).catch(() => null),
|
|
868
|
-
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
869
|
-
options.fileClient.get({ sourceId: legacyHash }).catch(() => null)
|
|
857
|
+
options.fileClient.get({ sourceId: hash }).catch(() => null)
|
|
870
858
|
]);
|
|
871
859
|
const file = fileAlreadyExistsChecks.find((check) => check !== null);
|
|
872
860
|
if (!file) {
|
|
@@ -938,16 +926,6 @@ var updateAssetFileIdBasedOnUrl = async (asset, options) => {
|
|
|
938
926
|
};
|
|
939
927
|
return asset;
|
|
940
928
|
};
|
|
941
|
-
var legacyUrlToHash = (url) => {
|
|
942
|
-
const hash = createHash("sha256");
|
|
943
|
-
hash.update(url);
|
|
944
|
-
return hash.digest("hex");
|
|
945
|
-
};
|
|
946
|
-
var legacyUrlToFileName = (url) => {
|
|
947
|
-
const fileName = legacyUrlToHash(url);
|
|
948
|
-
const fileExtension = urlToFileExtension(url);
|
|
949
|
-
return `${fileName}${fileExtension ? `.${fileExtension}` : ""}`;
|
|
950
|
-
};
|
|
951
929
|
|
|
952
930
|
// src/commands/canvas/assetEngineDataSource.ts
|
|
953
931
|
import { convertAssetToPutAsset } from "@uniformdev/assets";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/cli",
|
|
3
|
-
"version": "19.214.1-alpha.
|
|
3
|
+
"version": "19.214.1-alpha.17+15e689c12c",
|
|
4
4
|
"description": "Uniform command line interface tool",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./cli.js",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@thi.ng/mime": "^2.2.23",
|
|
30
|
-
"@uniformdev/assets": "19.214.1-alpha.
|
|
31
|
-
"@uniformdev/canvas": "19.214.1-alpha.
|
|
32
|
-
"@uniformdev/context": "19.214.1-alpha.
|
|
33
|
-
"@uniformdev/files": "19.214.1-alpha.
|
|
34
|
-
"@uniformdev/project-map": "19.214.1-alpha.
|
|
35
|
-
"@uniformdev/redirect": "19.214.1-alpha.
|
|
30
|
+
"@uniformdev/assets": "19.214.1-alpha.17+15e689c12c",
|
|
31
|
+
"@uniformdev/canvas": "19.214.1-alpha.17+15e689c12c",
|
|
32
|
+
"@uniformdev/context": "19.214.1-alpha.17+15e689c12c",
|
|
33
|
+
"@uniformdev/files": "19.214.1-alpha.17+15e689c12c",
|
|
34
|
+
"@uniformdev/project-map": "19.214.1-alpha.17+15e689c12c",
|
|
35
|
+
"@uniformdev/redirect": "19.214.1-alpha.17+15e689c12c",
|
|
36
36
|
"call-bind": "^1.0.2",
|
|
37
37
|
"colorette": "2.0.20",
|
|
38
38
|
"cosmiconfig": "9.0.0",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "15e689c12ce848ce17d170f9be8c6f3d2c29ffe1"
|
|
82
82
|
}
|