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