@binaryandthread/cli 0.4.8 → 0.4.10
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/bin.js +8 -6
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-CE324N5B.js → chunk-PVKB77IE.js} +45 -17
- package/dist/chunk-PVKB77IE.js.map +1 -0
- package/dist/{interactive-7GY3BVQ6.js → interactive-B5TALADG.js} +2 -2
- package/package.json +2 -1
- package/dist/chunk-CE324N5B.js.map +0 -1
- /package/dist/{interactive-7GY3BVQ6.js.map → interactive-B5TALADG.js.map} +0 -0
|
@@ -624,7 +624,8 @@ function supplierOf(p) {
|
|
|
624
624
|
return v === "gelato" || v === "printful" ? v : null;
|
|
625
625
|
}
|
|
626
626
|
var PRINTFUL_BLANK_COLOURS = {
|
|
627
|
-
"ascolour-5082": ["black", "white"]
|
|
627
|
+
"ascolour-5082": ["black", "white", "coal", "eucalyptus", "bone", "grey", "khaki", "indigo"]
|
|
628
|
+
// TB124, TB126
|
|
628
629
|
};
|
|
629
630
|
var PRINTFUL_BLANK_SIZES = {
|
|
630
631
|
"ascolour-5082": ["s", "m", "l", "xl", "2xl"]
|
|
@@ -758,7 +759,7 @@ function resolveVariant(p, opts) {
|
|
|
758
759
|
const gate = gateFit(p, fit);
|
|
759
760
|
const supplier = supplierOf(p);
|
|
760
761
|
const colours = coloursFor(p, fit, opts.countryCode);
|
|
761
|
-
const colour = (opts.colour ?? "")
|
|
762
|
+
const colour = colourKey(opts.colour ?? "") || (colours[0] ?? null);
|
|
762
763
|
if (gate && colour && opts.countryCode !== void 0 && !colourBuyable(gate, colour, opts.countryCode, supplier)) {
|
|
763
764
|
return { ok: false, reason: "fit_unavailable", fit: gate, colour };
|
|
764
765
|
}
|
|
@@ -788,10 +789,35 @@ var FIT_TOKEN = /^(regular|oversize)$/i;
|
|
|
788
789
|
function titleSegments(title) {
|
|
789
790
|
return (title ?? "").split("/").map((s) => s.trim()).filter(Boolean);
|
|
790
791
|
}
|
|
791
|
-
|
|
792
|
+
var COLOUR_LABELS = {
|
|
793
|
+
black: "Faded Black",
|
|
794
|
+
white: "Faded White",
|
|
795
|
+
coal: "Faded Coal",
|
|
796
|
+
eucalyptus: "Faded Eucalyptus",
|
|
797
|
+
bone: "Faded Bone",
|
|
798
|
+
grey: "Faded Grey",
|
|
799
|
+
khaki: "Faded Khaki",
|
|
800
|
+
indigo: "Faded Indigo"
|
|
801
|
+
};
|
|
802
|
+
function colourLabel(colour) {
|
|
792
803
|
const c = colour.trim();
|
|
793
804
|
if (!c) return c;
|
|
794
|
-
return c.charAt(0).toUpperCase() + c.slice(1).toLowerCase();
|
|
805
|
+
return COLOUR_LABELS[c.toLowerCase()] ?? c.charAt(0).toUpperCase() + c.slice(1).toLowerCase();
|
|
806
|
+
}
|
|
807
|
+
function colourKey(colour) {
|
|
808
|
+
const c = colour.trim().toLowerCase();
|
|
809
|
+
const key = Object.entries(COLOUR_LABELS).find(([, label]) => label.toLowerCase() === c)?.[0];
|
|
810
|
+
return key ?? c;
|
|
811
|
+
}
|
|
812
|
+
function labelVariantTitle(title) {
|
|
813
|
+
return (title ?? "").split("/").map((seg) => {
|
|
814
|
+
const t = seg.trim();
|
|
815
|
+
const k = t.toLowerCase();
|
|
816
|
+
return Object.prototype.hasOwnProperty.call(COLOUR_LABELS, k) ? colourLabel(t) : t;
|
|
817
|
+
}).join(" / ");
|
|
818
|
+
}
|
|
819
|
+
function displayColour(colour) {
|
|
820
|
+
return colourLabel(colour);
|
|
795
821
|
}
|
|
796
822
|
function variantColour(v) {
|
|
797
823
|
const opt = (v.options ?? []).find(
|
|
@@ -840,7 +866,7 @@ function findVariant(p, opts = {}) {
|
|
|
840
866
|
}
|
|
841
867
|
const variants = (p.variants ?? []).filter((v) => fit === null || variantFit(v) === fit);
|
|
842
868
|
const size = opts.size?.trim().toLowerCase();
|
|
843
|
-
const colour = opts.colour
|
|
869
|
+
const colour = opts.colour ? colourKey(opts.colour) : void 0;
|
|
844
870
|
const sizeMatches = (v) => {
|
|
845
871
|
if (!size) return true;
|
|
846
872
|
return (sizeOfVariant(v) ?? "").toLowerCase() === size || (v.title ?? "").toLowerCase() === size;
|
|
@@ -1249,7 +1275,7 @@ function colourSwatch(colour) {
|
|
|
1249
1275
|
function colourMarker(colours) {
|
|
1250
1276
|
if (colours.length === 0) return "";
|
|
1251
1277
|
const swatches = colours.map((c) => colourSwatch(c)).join("");
|
|
1252
|
-
const names = colours.join("/");
|
|
1278
|
+
const names = colours.map((c) => colourLabel(c)).join(" / ");
|
|
1253
1279
|
return `${swatches} ${names}`;
|
|
1254
1280
|
}
|
|
1255
1281
|
|
|
@@ -1327,7 +1353,7 @@ function formatCartLine(item, index, currency, brand) {
|
|
|
1327
1353
|
const idTag = item.id ? dimTag(style, ` (#${shortItemId(item.id)})`) : "";
|
|
1328
1354
|
const colour = lineColour(item);
|
|
1329
1355
|
const fit = lineFit(item);
|
|
1330
|
-
const tags = [colour, fit ? fitLabel(fit).toLowerCase() : null].filter(Boolean).join(", ");
|
|
1356
|
+
const tags = [colour ? colourLabel(colour).toLowerCase() : null, fit ? fitLabel(fit).toLowerCase() : null].filter(Boolean).join(", ");
|
|
1331
1357
|
const colourTag = tags ? ` \xB7 ${tags}` : "";
|
|
1332
1358
|
const price = item.total != null ? ` ${accentPrice(style, fmtPrice(item.total, currency))}` : "";
|
|
1333
1359
|
return ` ${ref} ${title}${colourTag}${idTag} \xB7 qty ${item.quantity}${price}`;
|
|
@@ -1590,13 +1616,13 @@ async function runView(client, config, args) {
|
|
|
1590
1616
|
lines.push(` ${s.key.padEnd(9)}${s.value}`);
|
|
1591
1617
|
}
|
|
1592
1618
|
if (colours.length > 0 || unavailable.length > 0) {
|
|
1593
|
-
lines.push(` colours ${colours.map((c) => `${colourSwatch(c)} ${c}`).join(" \xB7 ")}`);
|
|
1619
|
+
lines.push(` colours ${colours.map((c) => `${colourSwatch(c)} ${colourLabel(c)}`).join(" \xB7 ")}`);
|
|
1594
1620
|
for (const c of colours) {
|
|
1595
1621
|
const sizes = sortSizes(sizesFor(product, fit, c, countryCode));
|
|
1596
|
-
lines.push(` ${colourSwatch(c)} ${c.padEnd(
|
|
1622
|
+
lines.push(` ${colourSwatch(c)} ${colourLabel(c).padEnd(12)} ${sizes.join(" ")}`);
|
|
1597
1623
|
}
|
|
1598
1624
|
for (const c of unavailable) {
|
|
1599
|
-
lines.push(dim(style, ` ${colourSwatch(c)} ${c.padEnd(
|
|
1625
|
+
lines.push(dim(style, ` ${colourSwatch(c)} ${colourLabel(c).padEnd(12)} not available where you ship (${countryCode ?? "your region"})`));
|
|
1600
1626
|
}
|
|
1601
1627
|
} else {
|
|
1602
1628
|
const sizes = sortSizes((product.variants ?? []).map((v) => v.title ?? "?"));
|
|
@@ -1611,13 +1637,13 @@ async function runView(client, config, args) {
|
|
|
1611
1637
|
}
|
|
1612
1638
|
let imageUrl = product.thumbnail ?? null;
|
|
1613
1639
|
let blackNote = null;
|
|
1614
|
-
const wanted = args.colour
|
|
1640
|
+
const wanted = (args.colour ? colourKey(args.colour) : "") || (fit ? colours[0] : void 0);
|
|
1615
1641
|
if (wanted) {
|
|
1616
1642
|
const resolved = imageFor(product, { fit, colour: wanted }) ?? (fit === null ? imageForColour(product, wanted) : null);
|
|
1617
1643
|
if (resolved) {
|
|
1618
1644
|
imageUrl = resolved;
|
|
1619
1645
|
} else if (args.colour) {
|
|
1620
|
-
blackNote = unavailable.includes(wanted) ? ` ${displayColour(wanted)} isn't available where you ship \u2014 showing the default mockup.` : ` ${displayColour(wanted)} available \u2014 showing the default mockup (no ${wanted} render on file).`;
|
|
1646
|
+
blackNote = unavailable.includes(wanted) ? ` ${displayColour(wanted)} isn't available where you ship \u2014 showing the default mockup.` : ` ${displayColour(wanted)} available \u2014 showing the default mockup (no ${displayColour(wanted)} render on file).`;
|
|
1621
1647
|
}
|
|
1622
1648
|
}
|
|
1623
1649
|
if (imageUrl) {
|
|
@@ -1773,7 +1799,7 @@ async function runStage(client, config, args) {
|
|
|
1773
1799
|
if (r.reason === "fit_unavailable") {
|
|
1774
1800
|
return failResult({
|
|
1775
1801
|
code: EXIT.DATAERR,
|
|
1776
|
-
what: `${r.colour} is not available in ${r.fit} where you ship (${countryCode ?? "your region"}).`,
|
|
1802
|
+
what: `${colourLabel(r.colour ?? "")} is not available in ${r.fit} where you ship (${countryCode ?? "your region"}).`,
|
|
1777
1803
|
money: "nothing staged, nothing charged.",
|
|
1778
1804
|
fix: `bt view ${handleShown} --fit ${r.fit} (to see the colours you can buy)`
|
|
1779
1805
|
});
|
|
@@ -1786,18 +1812,18 @@ async function runStage(client, config, args) {
|
|
|
1786
1812
|
fix: r.sizes.length ? `bt stage ${handleShown} --fit ${r.fit} --size ${r.sizes[0]} (sizes here: ${r.sizes.join(" ")})` : `bt view ${handleShown} --fit ${r.fit} (to see the sizes you can buy)`
|
|
1787
1813
|
});
|
|
1788
1814
|
}
|
|
1789
|
-
const have = r.colours.length ? ` available colours: ${r.colours.join(", ")}.` : "";
|
|
1815
|
+
const have = r.colours.length ? ` available colours: ${r.colours.map((c) => colourLabel(c)).join(", ")}.` : "";
|
|
1790
1816
|
const haveSizes = r.sizes.length ? ` sizes: ${r.sizes.join(" ")}.` : "";
|
|
1791
1817
|
return failResult({
|
|
1792
1818
|
code: EXIT.DATAERR,
|
|
1793
|
-
what: `no variant for ${args.handle}${r.fit ? ` --fit ${r.fit}` : ""}${size ? `#size=${size}` : ""}${r.colour ? ` (${r.colour})` : ""}.`,
|
|
1819
|
+
what: `no variant for ${args.handle}${r.fit ? ` --fit ${r.fit}` : ""}${size ? `#size=${size}` : ""}${r.colour ? ` (${colourLabel(r.colour)})` : ""}.`,
|
|
1794
1820
|
fix: `bt view ${args.handle}${r.fit ? ` --fit ${r.fit}` : ""} (to see available sizes + colours)${have}${haveSizes}`
|
|
1795
1821
|
});
|
|
1796
1822
|
}
|
|
1797
1823
|
const variant = r.variant;
|
|
1798
1824
|
const colour = r.colour ?? void 0;
|
|
1799
1825
|
const fit = r.fit;
|
|
1800
|
-
const refTags = [colour, fit].filter(Boolean).join(", ");
|
|
1826
|
+
const refTags = [colour ? colourLabel(colour).toLowerCase() : null, fit].filter(Boolean).join(", ");
|
|
1801
1827
|
const colourSuffix = refTags ? ` (${refTags})` : "";
|
|
1802
1828
|
if (args.dryRun) {
|
|
1803
1829
|
return {
|
|
@@ -1899,6 +1925,8 @@ export {
|
|
|
1899
1925
|
coloursFor,
|
|
1900
1926
|
sizesFor,
|
|
1901
1927
|
priceFor,
|
|
1928
|
+
colourLabel,
|
|
1929
|
+
labelVariantTitle,
|
|
1902
1930
|
productColours,
|
|
1903
1931
|
findVariant,
|
|
1904
1932
|
orderStage,
|
|
@@ -1943,4 +1971,4 @@ export {
|
|
|
1943
1971
|
runStage,
|
|
1944
1972
|
registerStage
|
|
1945
1973
|
};
|
|
1946
|
-
//# sourceMappingURL=chunk-
|
|
1974
|
+
//# sourceMappingURL=chunk-PVKB77IE.js.map
|