@shipstatic/drop 2.10.4-beta.9 → 2.11.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.cjs +22 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -26
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +3 -1
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.js +3 -1
- package/dist/testing.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -201,6 +201,8 @@ function consolePaths(account) {
|
|
|
201
201
|
deployment: (domain) => at(`/domains/${domain}/deployment`)
|
|
202
202
|
}),
|
|
203
203
|
settings: (fragment) => at(fragment ? `/settings#${fragment}` : "/settings"),
|
|
204
|
+
/** The claim of an anonymous deployment into this account; the API mails the bare form. */
|
|
205
|
+
claim: (code) => at(`/claim/${code}`),
|
|
204
206
|
/** Settings, marked as the landing of a Stripe Customer Portal return. */
|
|
205
207
|
settingsAfterBilling: () => at(`/settings?${marker("portal")}`),
|
|
206
208
|
upgrade: (plan) => at(plan ? `/upgrade/${plan}` : "/upgrade"),
|
|
@@ -934,6 +936,8 @@ function isZipFile(file) {
|
|
|
934
936
|
}
|
|
935
937
|
|
|
936
938
|
// src/process.ts
|
|
939
|
+
var CANT_DEPLOY = "Can't deploy this";
|
|
940
|
+
var COULDNT_PREPARE = "Couldn't prepare the files";
|
|
937
941
|
function toValidatable(file) {
|
|
938
942
|
return { name: file.path, size: file.size };
|
|
939
943
|
}
|
|
@@ -985,7 +989,7 @@ async function processFiles(input, { limits, onStatus }) {
|
|
|
985
989
|
if (!hasIndex) {
|
|
986
990
|
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
991
|
return failure({
|
|
988
|
-
title:
|
|
992
|
+
title: CANT_DEPLOY,
|
|
989
993
|
details,
|
|
990
994
|
sourceName,
|
|
991
995
|
needsBuild,
|
|
@@ -1013,16 +1017,16 @@ async function processFiles(input, { limits, onStatus }) {
|
|
|
1013
1017
|
statusMessage: validation.files[i]?.statusMessage ?? file.statusMessage
|
|
1014
1018
|
}));
|
|
1015
1019
|
if (!validation.canDeploy) {
|
|
1020
|
+
const issues = validation.errors.map((e) => e.message);
|
|
1016
1021
|
return failure({
|
|
1017
|
-
title:
|
|
1018
|
-
details: `${
|
|
1019
|
-
errors: validation.errors.map((e) => `${e.file}: ${e.message}`),
|
|
1022
|
+
title: CANT_DEPLOY,
|
|
1023
|
+
...issues.length === 1 ? { details: issues[0] } : { details: `${issues.length} files refused`, errors: issues },
|
|
1020
1024
|
files: validated,
|
|
1021
1025
|
sourceName
|
|
1022
1026
|
});
|
|
1023
1027
|
}
|
|
1024
1028
|
const readyCount = validated.filter((f) => f.status === FileValidationStatus.READY).length;
|
|
1025
|
-
const warnings = validation.warnings.map((w) =>
|
|
1029
|
+
const warnings = validation.warnings.map((w) => w.message);
|
|
1026
1030
|
if (readyCount > 0) {
|
|
1027
1031
|
let details = `${ship.pluralize(readyCount, "file", "files", true)} ready`;
|
|
1028
1032
|
if (validation.warnings.length > 0) {
|
|
@@ -1036,30 +1040,22 @@ async function processFiles(input, { limits, onStatus }) {
|
|
|
1036
1040
|
status: { title: "Ready", details, ...warnings.length ? { warnings } : {} }
|
|
1037
1041
|
};
|
|
1038
1042
|
}
|
|
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.",
|
|
1043
|
+
return {
|
|
1044
|
+
phase: "ready",
|
|
1055
1045
|
files: validated,
|
|
1056
|
-
sourceName
|
|
1057
|
-
|
|
1046
|
+
sourceName,
|
|
1047
|
+
needsBuild: false,
|
|
1048
|
+
status: {
|
|
1049
|
+
title: "All files excluded",
|
|
1050
|
+
details: `${ship.pluralize(validation.warnings.length, "file", "files", true)} excluded (empty files cannot be deployed)`,
|
|
1051
|
+
warnings
|
|
1052
|
+
}
|
|
1053
|
+
};
|
|
1058
1054
|
} catch (error) {
|
|
1059
1055
|
const message = error instanceof Error ? error.message : String(error);
|
|
1060
1056
|
const isValidation = isShipError(error);
|
|
1061
1057
|
return failure({
|
|
1062
|
-
title: isValidation ?
|
|
1058
|
+
title: isValidation ? CANT_DEPLOY : COULDNT_PREPARE,
|
|
1063
1059
|
details: isValidation ? message : `Failed to process files: ${message}`,
|
|
1064
1060
|
sourceName
|
|
1065
1061
|
});
|
|
@@ -1144,7 +1140,7 @@ function useDrop({ ship }) {
|
|
|
1144
1140
|
setState({
|
|
1145
1141
|
...initialState,
|
|
1146
1142
|
phase: "error",
|
|
1147
|
-
status: { title:
|
|
1143
|
+
status: { title: CANT_DEPLOY, details: "The folder has no files." }
|
|
1148
1144
|
});
|
|
1149
1145
|
return;
|
|
1150
1146
|
}
|
|
@@ -1169,7 +1165,7 @@ function useDrop({ ship }) {
|
|
|
1169
1165
|
...initialState,
|
|
1170
1166
|
phase: "error",
|
|
1171
1167
|
status: {
|
|
1172
|
-
title:
|
|
1168
|
+
title: COULDNT_PREPARE,
|
|
1173
1169
|
details: error instanceof Error ? error.message : String(error)
|
|
1174
1170
|
}
|
|
1175
1171
|
});
|