@shipstatic/drop 2.10.4-beta.8 → 2.10.4
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 +29 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -32
- 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,
|
|
@@ -1011,16 +1013,16 @@ async function processFiles(input, { limits, onStatus }) {
|
|
|
1011
1013
|
statusMessage: validation.files[i]?.statusMessage ?? file.statusMessage
|
|
1012
1014
|
}));
|
|
1013
1015
|
if (!validation.canDeploy) {
|
|
1016
|
+
const issues = validation.errors.map((e) => e.message);
|
|
1014
1017
|
return failure({
|
|
1015
|
-
title:
|
|
1016
|
-
details: `${
|
|
1017
|
-
errors: validation.errors.map((e) => `${e.file}: ${e.message}`),
|
|
1018
|
+
title: CANT_DEPLOY,
|
|
1019
|
+
...issues.length === 1 ? { details: issues[0] } : { details: `${issues.length} files refused`, errors: issues },
|
|
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
|
});
|
|
@@ -1139,14 +1133,18 @@ function useDrop({ ship }) {
|
|
|
1139
1133
|
]);
|
|
1140
1134
|
if (run.signal.aborted) return;
|
|
1141
1135
|
if (files.length === 0) {
|
|
1142
|
-
setState(
|
|
1136
|
+
setState({
|
|
1137
|
+
...initialState,
|
|
1138
|
+
phase: "error",
|
|
1139
|
+
status: { title: CANT_DEPLOY, details: "The folder has no files." }
|
|
1140
|
+
});
|
|
1143
1141
|
return;
|
|
1144
1142
|
}
|
|
1145
1143
|
const outcome = await processFiles(files, {
|
|
1146
1144
|
limits,
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
}
|
|
1145
|
+
// The pipeline says its status before its first wait, so a
|
|
1146
|
+
// cancelled run has none left to say.
|
|
1147
|
+
onStatus: (status) => setState((prev) => ({ ...prev, status }))
|
|
1150
1148
|
});
|
|
1151
1149
|
if (run.signal.aborted) return;
|
|
1152
1150
|
setState({
|
|
@@ -1163,7 +1161,7 @@ function useDrop({ ship }) {
|
|
|
1163
1161
|
...initialState,
|
|
1164
1162
|
phase: "error",
|
|
1165
1163
|
status: {
|
|
1166
|
-
title:
|
|
1164
|
+
title: COULDNT_PREPARE,
|
|
1167
1165
|
details: error instanceof Error ? error.message : String(error)
|
|
1168
1166
|
}
|
|
1169
1167
|
});
|
|
@@ -1218,11 +1216,10 @@ function useDrop({ ship }) {
|
|
|
1218
1216
|
if (file) files.push(file);
|
|
1219
1217
|
}
|
|
1220
1218
|
}
|
|
1221
|
-
|
|
1222
|
-
if (directories.length === 0 && files.length === 0 && plain.length === 0) return;
|
|
1219
|
+
if (directories.length === 0 && files.length === 0) return;
|
|
1223
1220
|
await prepare(async () => {
|
|
1224
1221
|
await Promise.all(directories.map((d) => traverseFileTree(d.entry, files, d.path)));
|
|
1225
|
-
return files
|
|
1222
|
+
return files;
|
|
1226
1223
|
});
|
|
1227
1224
|
},
|
|
1228
1225
|
[prepare]
|