@binaryandthread/cli 0.4.12 → 0.4.14

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.
@@ -632,12 +632,16 @@ function supplierOf(p) {
632
632
  var PRINTFUL_BLANK_COLOURS = {
633
633
  "ascolour-5082": ["black", "white", "coal", "eucalyptus", "bone", "grey", "khaki", "indigo"],
634
634
  // TB124, TB126
635
- "bellacanvas-4711": ["asphalt", "dust", "navy", "maroon", "forest"]
636
- // TB128: the sweatshirt
635
+ "bellacanvas-4711": ["asphalt", "dust", "navy", "maroon", "forest", "jet"],
636
+ // TB128: the sweatshirt; TB129: + jet (its Black)
637
+ "yupoong-6606": ["blackmesh"]
638
+ // TB268: the cap
637
639
  };
638
640
  var PRINTFUL_BLANK_SIZES = {
639
641
  "ascolour-5082": ["s", "m", "l", "xl", "2xl"],
640
- "bellacanvas-4711": ["s", "m", "l", "xl", "2xl"]
642
+ "bellacanvas-4711": ["s", "m", "l", "xl", "2xl"],
643
+ "yupoong-6606": ["os"]
644
+ // TB268: the cap is one size
641
645
  };
642
646
  function printfulBlankOf(p) {
643
647
  const v = (p.metadata ?? {})["bt_blank"];
@@ -777,7 +781,7 @@ function resolveVariant(p, opts) {
777
781
  const supplier = supplierOf(p);
778
782
  const pb = printfulBlankOf(p);
779
783
  const colours = coloursFor(p, fit, opts.countryCode);
780
- const colour = colourKey(opts.colour ?? "") || (colours[0] ?? null);
784
+ const colour = colourKey(opts.colour ?? "", productColours(p)) || (colours[0] ?? null);
781
785
  if (gate && colour && opts.countryCode !== void 0 && !colourBuyable(gate, colour, opts.countryCode, supplier, pb)) {
782
786
  return { ok: false, reason: "fit_unavailable", fit: gate, colour };
783
787
  }
@@ -815,15 +819,24 @@ var COLOUR_LABELS = {
815
819
  bone: "Faded Bone",
816
820
  grey: "Faded Grey",
817
821
  khaki: "Faded Khaki",
818
- indigo: "Faded Indigo"
822
+ indigo: "Faded Indigo",
823
+ jet: "Black",
824
+ // TB268: the cap (Printful 252 "Black/ White"): black front, white mesh back.
825
+ blackmesh: "Black with white mesh"
819
826
  };
820
827
  function colourLabel(colour) {
821
828
  const c = colour.trim();
822
829
  if (!c) return c;
823
830
  return COLOUR_LABELS[c.toLowerCase()] ?? c.charAt(0).toUpperCase() + c.slice(1).toLowerCase();
824
831
  }
825
- function colourKey(colour) {
832
+ function colourKey(colour, available) {
826
833
  const c = colour.trim().toLowerCase();
834
+ if (available) {
835
+ const keys = available.map((k) => k.trim().toLowerCase());
836
+ if (keys.includes(c)) return c;
837
+ return keys.find((k) => colourLabel(k).toLowerCase() === c) ?? c;
838
+ }
839
+ if (Object.prototype.hasOwnProperty.call(COLOUR_LABELS, c)) return c;
827
840
  const key = Object.entries(COLOUR_LABELS).find(([, label]) => label.toLowerCase() === c)?.[0];
828
841
  return key ?? c;
829
842
  }
@@ -831,6 +844,7 @@ function labelVariantTitle(title) {
831
844
  return (title ?? "").split("/").map((seg) => {
832
845
  const t = seg.trim();
833
846
  const k = t.toLowerCase();
847
+ if (k === "os") return "One size";
834
848
  return Object.prototype.hasOwnProperty.call(COLOUR_LABELS, k) ? colourLabel(t) : t;
835
849
  }).join(" / ");
836
850
  }
@@ -884,7 +898,7 @@ function findVariant(p, opts = {}) {
884
898
  }
885
899
  const variants = (p.variants ?? []).filter((v) => fit === null || variantFit(v) === fit);
886
900
  const size = opts.size?.trim().toLowerCase();
887
- const colour = opts.colour ? colourKey(opts.colour) : void 0;
901
+ const colour = opts.colour ? colourKey(opts.colour, productColours(p)) : void 0;
888
902
  const sizeMatches = (v) => {
889
903
  if (!size) return true;
890
904
  return (sizeOfVariant(v) ?? "").toLowerCase() === size || (v.title ?? "").toLowerCase() === size;
@@ -1311,7 +1325,7 @@ function contributionBar(style, commits, cap = 20) {
1311
1325
  function colourSwatch(colour) {
1312
1326
  const c = colour.trim().toLowerCase();
1313
1327
  if (c === "white") return "\u2B1C";
1314
- if (c === "black") return "\u2B1B";
1328
+ if (c === "black" || c === "jet") return "\u2B1B";
1315
1329
  if (c === "khaki") return "\u{1F7EB}";
1316
1330
  return "\u25FC";
1317
1331
  }
@@ -1658,7 +1672,7 @@ async function runView(client, config, args) {
1658
1672
  }
1659
1673
  let imageUrl = product.thumbnail ?? null;
1660
1674
  let blackNote = null;
1661
- const wanted = (args.colour ? colourKey(args.colour) : "") || (fit ? colours[0] : void 0);
1675
+ const wanted = (args.colour ? colourKey(args.colour, [...colours, ...unavailable]) : "") || (fit ? colours[0] : void 0);
1662
1676
  if (wanted) {
1663
1677
  const resolved = imageFor(product, { fit, colour: wanted }) ?? (fit === null ? imageForColour(product, wanted) : null);
1664
1678
  if (resolved) {
@@ -1796,7 +1810,8 @@ async function runStage(client, config, args) {
1796
1810
  }
1797
1811
  const product = resolved.product;
1798
1812
  const matchNote = resolved.fuzzy && (product.handle ?? "") !== args.handle.trim() ? working(`matched "${product.handle}" from "${args.handle}"`) : null;
1799
- const size = args.size ?? config.defaultSize;
1813
+ const productSizes = new Set((product.variants ?? []).map((v) => sizeOfVariant(v)?.toLowerCase()).filter(Boolean));
1814
+ const size = args.size ?? (productSizes.size === 1 ? void 0 : config.defaultSize);
1800
1815
  const explicitFit = args.fit ?? resolved.impliedFit;
1801
1816
  const fitArg = explicitFit ?? (productFits(product).length > 1 ? config.defaultFit : void 0);
1802
1817
  const r = resolveVariant(product, { fit: fitArg, size, colour: args.colour ?? config.defaultColour, countryCode });
@@ -2052,4 +2067,4 @@ export {
2052
2067
  oneDesignPerCommand,
2053
2068
  registerStage
2054
2069
  };
2055
- //# sourceMappingURL=chunk-YNBNKCCN.js.map
2070
+ //# sourceMappingURL=chunk-S6IMNOCO.js.map