@koda-sl/baker-cli 0.380.0-dev.d26778d3f → 0.381.0-dev.ad454cb20

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/cli.js CHANGED
@@ -66811,9 +66811,24 @@ var WARNINGS = "Read the warnings above before telling the user this is ready.";
66811
66811
  var DISCOUNT = "The code works only after the chat is published; don't announce it as live or share it as working yet.";
66812
66812
  var EMPTY_COLLECTION = "The new collection has no products yet: add them with `baker shopify change collection add <collection> <product\u2026>`.";
66813
66813
  var COLLECTION_DELETE = "Its address stops working when it is deleted: keep old links alive with `baker shopify change redirect create --from /collections/<handle> --to <page>` (ask the user where they should land).";
66814
+ function repointedRedirects(ops) {
66815
+ const removed = ops.flatMap(
66816
+ (op) => op.kind === "shopify.urlRedirect.delete" && op.ref.startsWith("urlRedirect:") ? [op.ref.slice("urlRedirect:".length)] : []
66817
+ );
66818
+ return removed.flatMap((path49) => {
66819
+ const made = ops.find(
66820
+ (op) => op.kind === "shopify.urlRedirect.create" && op.summary.startsWith(`Redirect ${path49} to `)
66821
+ );
66822
+ if (!made) return [];
66823
+ const to = made.summary.slice(`Redirect ${path49} to `.length);
66824
+ return [
66825
+ `${path49} still redirects after publish, now to ${to}: tell the user the old link goes there, not that its redirect is removed.`
66826
+ ];
66827
+ });
66828
+ }
66814
66829
  function stageHints(data) {
66815
66830
  if (!data.staged) return [];
66816
- const hints2 = [STAGED];
66831
+ const hints2 = [STAGED, ...repointedRedirects(data.ops)];
66817
66832
  if (data.ops.some((op) => op.warnings.length > 0)) hints2.push(WARNINGS);
66818
66833
  if (data.ops.some((op) => op.kind === "shopify.discountCode.create")) hints2.push(DISCOUNT);
66819
66834
  if (data.ops.some((op) => op.kind === "shopify.collection.delete")) hints2.push(COLLECTION_DELETE);