@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.cjs
CHANGED
|
@@ -934,6 +934,8 @@ function isZipFile(file) {
|
|
|
934
934
|
}
|
|
935
935
|
|
|
936
936
|
// src/process.ts
|
|
937
|
+
var CANT_DEPLOY = "Can't deploy this";
|
|
938
|
+
var COULDNT_PREPARE = "Couldn't prepare the files";
|
|
937
939
|
function toValidatable(file) {
|
|
938
940
|
return { name: file.path, size: file.size };
|
|
939
941
|
}
|
|
@@ -985,7 +987,7 @@ async function processFiles(input, { limits, onStatus }) {
|
|
|
985
987
|
if (!hasIndex) {
|
|
986
988
|
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";
|
|
987
989
|
return failure({
|
|
988
|
-
title:
|
|
990
|
+
title: CANT_DEPLOY,
|
|
989
991
|
details,
|
|
990
992
|
sourceName,
|
|
991
993
|
needsBuild,
|
|
@@ -1013,16 +1015,16 @@ async function processFiles(input, { limits, onStatus }) {
|
|
|
1013
1015
|
statusMessage: validation.files[i]?.statusMessage ?? file.statusMessage
|
|
1014
1016
|
}));
|
|
1015
1017
|
if (!validation.canDeploy) {
|
|
1018
|
+
const issues = validation.errors.map((e) => e.message);
|
|
1016
1019
|
return failure({
|
|
1017
|
-
title:
|
|
1018
|
-
details: `${
|
|
1019
|
-
errors: validation.errors.map((e) => `${e.file}: ${e.message}`),
|
|
1020
|
+
title: CANT_DEPLOY,
|
|
1021
|
+
...issues.length === 1 ? { details: issues[0] } : { details: `${issues.length} files refused`, errors: issues },
|
|
1020
1022
|
files: validated,
|
|
1021
1023
|
sourceName
|
|
1022
1024
|
});
|
|
1023
1025
|
}
|
|
1024
1026
|
const readyCount = validated.filter((f) => f.status === FileValidationStatus.READY).length;
|
|
1025
|
-
const warnings = validation.warnings.map((w) =>
|
|
1027
|
+
const warnings = validation.warnings.map((w) => w.message);
|
|
1026
1028
|
if (readyCount > 0) {
|
|
1027
1029
|
let details = `${ship.pluralize(readyCount, "file", "files", true)} ready`;
|
|
1028
1030
|
if (validation.warnings.length > 0) {
|
|
@@ -1036,30 +1038,22 @@ async function processFiles(input, { limits, onStatus }) {
|
|
|
1036
1038
|
status: { title: "Ready", details, ...warnings.length ? { warnings } : {} }
|
|
1037
1039
|
};
|
|
1038
1040
|
}
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
phase: "ready",
|
|
1042
|
-
files: validated,
|
|
1043
|
-
sourceName,
|
|
1044
|
-
needsBuild: false,
|
|
1045
|
-
status: {
|
|
1046
|
-
title: "All files excluded",
|
|
1047
|
-
details: `${ship.pluralize(validation.warnings.length, "file", "files", true)} excluded (empty files cannot be deployed)`,
|
|
1048
|
-
warnings
|
|
1049
|
-
}
|
|
1050
|
-
};
|
|
1051
|
-
}
|
|
1052
|
-
return failure({
|
|
1053
|
-
title: "No Valid Files",
|
|
1054
|
-
details: "None of the provided files could be processed.",
|
|
1041
|
+
return {
|
|
1042
|
+
phase: "ready",
|
|
1055
1043
|
files: validated,
|
|
1056
|
-
sourceName
|
|
1057
|
-
|
|
1044
|
+
sourceName,
|
|
1045
|
+
needsBuild: false,
|
|
1046
|
+
status: {
|
|
1047
|
+
title: "All files excluded",
|
|
1048
|
+
details: `${ship.pluralize(validation.warnings.length, "file", "files", true)} excluded (empty files cannot be deployed)`,
|
|
1049
|
+
warnings
|
|
1050
|
+
}
|
|
1051
|
+
};
|
|
1058
1052
|
} catch (error) {
|
|
1059
1053
|
const message = error instanceof Error ? error.message : String(error);
|
|
1060
1054
|
const isValidation = isShipError(error);
|
|
1061
1055
|
return failure({
|
|
1062
|
-
title: isValidation ?
|
|
1056
|
+
title: isValidation ? CANT_DEPLOY : COULDNT_PREPARE,
|
|
1063
1057
|
details: isValidation ? message : `Failed to process files: ${message}`,
|
|
1064
1058
|
sourceName
|
|
1065
1059
|
});
|
|
@@ -1141,14 +1135,18 @@ function useDrop({ ship }) {
|
|
|
1141
1135
|
]);
|
|
1142
1136
|
if (run.signal.aborted) return;
|
|
1143
1137
|
if (files.length === 0) {
|
|
1144
|
-
setState(
|
|
1138
|
+
setState({
|
|
1139
|
+
...initialState,
|
|
1140
|
+
phase: "error",
|
|
1141
|
+
status: { title: CANT_DEPLOY, details: "The folder has no files." }
|
|
1142
|
+
});
|
|
1145
1143
|
return;
|
|
1146
1144
|
}
|
|
1147
1145
|
const outcome = await processFiles(files, {
|
|
1148
1146
|
limits,
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
}
|
|
1147
|
+
// The pipeline says its status before its first wait, so a
|
|
1148
|
+
// cancelled run has none left to say.
|
|
1149
|
+
onStatus: (status) => setState((prev) => ({ ...prev, status }))
|
|
1152
1150
|
});
|
|
1153
1151
|
if (run.signal.aborted) return;
|
|
1154
1152
|
setState({
|
|
@@ -1165,7 +1163,7 @@ function useDrop({ ship }) {
|
|
|
1165
1163
|
...initialState,
|
|
1166
1164
|
phase: "error",
|
|
1167
1165
|
status: {
|
|
1168
|
-
title:
|
|
1166
|
+
title: COULDNT_PREPARE,
|
|
1169
1167
|
details: error instanceof Error ? error.message : String(error)
|
|
1170
1168
|
}
|
|
1171
1169
|
});
|
|
@@ -1220,11 +1218,10 @@ function useDrop({ ship }) {
|
|
|
1220
1218
|
if (file) files.push(file);
|
|
1221
1219
|
}
|
|
1222
1220
|
}
|
|
1223
|
-
|
|
1224
|
-
if (directories.length === 0 && files.length === 0 && plain.length === 0) return;
|
|
1221
|
+
if (directories.length === 0 && files.length === 0) return;
|
|
1225
1222
|
await prepare(async () => {
|
|
1226
1223
|
await Promise.all(directories.map((d) => traverseFileTree(d.entry, files, d.path)));
|
|
1227
|
-
return files
|
|
1224
|
+
return files;
|
|
1228
1225
|
});
|
|
1229
1226
|
},
|
|
1230
1227
|
[prepare]
|