@shipstatic/drop 2.10.4-beta.10 → 2.10.4-beta.12
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.cjs +19 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -25
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +1 -1
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.js +1 -1
- package/dist/testing.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -932,6 +932,8 @@ function isZipFile(file) {
|
|
|
932
932
|
}
|
|
933
933
|
|
|
934
934
|
// src/process.ts
|
|
935
|
+
var CANT_DEPLOY = "Can't deploy this";
|
|
936
|
+
var COULDNT_PREPARE = "Couldn't prepare the files";
|
|
935
937
|
function toValidatable(file) {
|
|
936
938
|
return { name: file.path, size: file.size };
|
|
937
939
|
}
|
|
@@ -983,7 +985,7 @@ async function processFiles(input, { limits, onStatus }) {
|
|
|
983
985
|
if (!hasIndex) {
|
|
984
986
|
const details = needsBuild ? "No index.html found \u2014 every web project needs an index.html entry point" : "No index.html at root \u2014 the entry point must be in the top-level directory";
|
|
985
987
|
return failure({
|
|
986
|
-
title:
|
|
988
|
+
title: CANT_DEPLOY,
|
|
987
989
|
details,
|
|
988
990
|
sourceName,
|
|
989
991
|
needsBuild,
|
|
@@ -1012,15 +1014,15 @@ async function processFiles(input, { limits, onStatus }) {
|
|
|
1012
1014
|
}));
|
|
1013
1015
|
if (!validation.canDeploy) {
|
|
1014
1016
|
return failure({
|
|
1015
|
-
title:
|
|
1016
|
-
details: `${pluralize(validation.errors.length, "file", "files", true)}
|
|
1017
|
-
errors: validation.errors.map((e) =>
|
|
1017
|
+
title: CANT_DEPLOY,
|
|
1018
|
+
details: `${pluralize(validation.errors.length, "file", "files", true)} refused`,
|
|
1019
|
+
errors: validation.errors.map((e) => e.message),
|
|
1018
1020
|
files: validated,
|
|
1019
1021
|
sourceName
|
|
1020
1022
|
});
|
|
1021
1023
|
}
|
|
1022
1024
|
const readyCount = validated.filter((f) => f.status === FileValidationStatus.READY).length;
|
|
1023
|
-
const warnings = validation.warnings.map((w) =>
|
|
1025
|
+
const warnings = validation.warnings.map((w) => w.message);
|
|
1024
1026
|
if (readyCount > 0) {
|
|
1025
1027
|
let details = `${pluralize(readyCount, "file", "files", true)} ready`;
|
|
1026
1028
|
if (validation.warnings.length > 0) {
|
|
@@ -1034,30 +1036,22 @@ async function processFiles(input, { limits, onStatus }) {
|
|
|
1034
1036
|
status: { title: "Ready", details, ...warnings.length ? { warnings } : {} }
|
|
1035
1037
|
};
|
|
1036
1038
|
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
phase: "ready",
|
|
1040
|
-
files: validated,
|
|
1041
|
-
sourceName,
|
|
1042
|
-
needsBuild: false,
|
|
1043
|
-
status: {
|
|
1044
|
-
title: "All files excluded",
|
|
1045
|
-
details: `${pluralize(validation.warnings.length, "file", "files", true)} excluded (empty files cannot be deployed)`,
|
|
1046
|
-
warnings
|
|
1047
|
-
}
|
|
1048
|
-
};
|
|
1049
|
-
}
|
|
1050
|
-
return failure({
|
|
1051
|
-
title: "No Valid Files",
|
|
1052
|
-
details: "None of the provided files could be processed.",
|
|
1039
|
+
return {
|
|
1040
|
+
phase: "ready",
|
|
1053
1041
|
files: validated,
|
|
1054
|
-
sourceName
|
|
1055
|
-
|
|
1042
|
+
sourceName,
|
|
1043
|
+
needsBuild: false,
|
|
1044
|
+
status: {
|
|
1045
|
+
title: "All files excluded",
|
|
1046
|
+
details: `${pluralize(validation.warnings.length, "file", "files", true)} excluded (empty files cannot be deployed)`,
|
|
1047
|
+
warnings
|
|
1048
|
+
}
|
|
1049
|
+
};
|
|
1056
1050
|
} catch (error) {
|
|
1057
1051
|
const message = error instanceof Error ? error.message : String(error);
|
|
1058
1052
|
const isValidation = isShipError(error);
|
|
1059
1053
|
return failure({
|
|
1060
|
-
title: isValidation ?
|
|
1054
|
+
title: isValidation ? CANT_DEPLOY : COULDNT_PREPARE,
|
|
1061
1055
|
details: isValidation ? message : `Failed to process files: ${message}`,
|
|
1062
1056
|
sourceName
|
|
1063
1057
|
});
|
|
@@ -1167,7 +1161,7 @@ function useDrop({ ship }) {
|
|
|
1167
1161
|
...initialState,
|
|
1168
1162
|
phase: "error",
|
|
1169
1163
|
status: {
|
|
1170
|
-
title:
|
|
1164
|
+
title: COULDNT_PREPARE,
|
|
1171
1165
|
details: error instanceof Error ? error.message : String(error)
|
|
1172
1166
|
}
|
|
1173
1167
|
});
|