create-brainerce-store 1.41.0 → 1.42.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 +41 -12
- package/messages/en.json +441 -441
- package/messages/he.json +441 -441
- package/package.json +2 -2
- package/templates/nextjs/base/TRANSLATIONS.md +200 -0
- package/templates/nextjs/base/next.config.ts +22 -0
- package/templates/nextjs/base/package.json.ejs +3 -0
- package/templates/nextjs/base/src/app/checkout/page.tsx +1 -1
- package/templates/nextjs/base/src/app/layout.tsx.ejs +14 -6
- package/templates/nextjs/base/src/app/pages/[slug]/page.tsx.ejs +9 -4
- package/templates/nextjs/base/src/app/products/[slug]/page.tsx +45 -5
- package/templates/nextjs/base/src/components/account/order-history.tsx +367 -367
- package/templates/nextjs/base/src/components/cart/cart-bundle-offer.tsx +112 -112
- package/templates/nextjs/base/src/components/cart/cart-item.tsx +153 -153
- package/templates/nextjs/base/src/components/cart/cart-summary.tsx +108 -108
- package/templates/nextjs/base/src/components/cart/cart-upgrade-banner.tsx +142 -142
- package/templates/nextjs/base/src/components/cart/free-shipping-bar.tsx +59 -59
- package/templates/nextjs/base/src/components/checkout/order-bump-card.tsx +243 -243
- package/templates/nextjs/base/src/components/checkout/pickup-step.tsx +199 -199
- package/templates/nextjs/base/src/components/checkout/shipping-step.tsx +110 -110
- package/templates/nextjs/base/src/components/checkout/tax-display.tsx +65 -65
- package/templates/nextjs/base/src/components/products/frequently-bought-together.tsx +202 -202
- package/templates/nextjs/base/src/components/products/product-card.tsx +226 -226
- package/templates/nextjs/base/src/components/products/variant-selector.tsx +292 -292
- package/templates/nextjs/base/src/components/seo/product-json-ld.tsx +5 -1
- package/templates/nextjs/base/src/components/shared/price-display.tsx +65 -62
- package/templates/nextjs/base/src/lib/brainerce.ts.ejs +42 -0
- package/templates/nextjs/base/src/lib/store-info.ts +48 -0
- package/templates/nextjs/base/src/lib/utils.ts +21 -6
- package/templates/nextjs/base/src/providers/store-provider.tsx.ejs +37 -14
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var require_package = __commonJS({
|
|
|
31
31
|
"package.json"(exports2, module2) {
|
|
32
32
|
module2.exports = {
|
|
33
33
|
name: "create-brainerce-store",
|
|
34
|
-
version: "1.
|
|
34
|
+
version: "1.42.0",
|
|
35
35
|
description: "Scaffold a production-ready e-commerce storefront connected to Brainerce",
|
|
36
36
|
bin: {
|
|
37
37
|
"create-brainerce-store": "dist/index.js"
|
|
@@ -65,7 +65,7 @@ var require_package = __commonJS({
|
|
|
65
65
|
typescript: "^5.4.0"
|
|
66
66
|
},
|
|
67
67
|
engines: {
|
|
68
|
-
node: ">=
|
|
68
|
+
node: "^20.19.0 || ^22.13.0 || >=24.0.0"
|
|
69
69
|
},
|
|
70
70
|
keywords: [
|
|
71
71
|
"brainerce",
|
|
@@ -124,6 +124,25 @@ function validateProjectName(name) {
|
|
|
124
124
|
}
|
|
125
125
|
return null;
|
|
126
126
|
}
|
|
127
|
+
var MIN_NODE_RANGE = {
|
|
128
|
+
description: "^20.19.0 || ^22.13.0 || >=24.0.0",
|
|
129
|
+
ranges: [
|
|
130
|
+
{ major: 20, minMinor: 19 },
|
|
131
|
+
{ major: 22, minMinor: 13 }
|
|
132
|
+
],
|
|
133
|
+
minMajor: 24
|
|
134
|
+
};
|
|
135
|
+
function validateNodeVersion(versionString) {
|
|
136
|
+
const match = /^v?(\d+)\.(\d+)\.(\d+)/.exec(versionString);
|
|
137
|
+
if (!match) return null;
|
|
138
|
+
const major = Number(match[1]);
|
|
139
|
+
const minor = Number(match[2]);
|
|
140
|
+
if (major >= MIN_NODE_RANGE.minMajor) return null;
|
|
141
|
+
for (const range of MIN_NODE_RANGE.ranges) {
|
|
142
|
+
if (major === range.major && minor >= range.minMinor) return null;
|
|
143
|
+
}
|
|
144
|
+
return `Node ${versionString} is not supported. Brainerce storefronts depend on jsdom@29 (via isomorphic-dompurify), which requires Node ${MIN_NODE_RANGE.description}. Please upgrade Node \u2014 older versions cannot \`require()\` the ESM \`@exodus/bytes\` module and the dev server will crash on first request.`;
|
|
145
|
+
}
|
|
127
146
|
function validateApiUrl(url) {
|
|
128
147
|
if (!url) return null;
|
|
129
148
|
let parsed;
|
|
@@ -559,11 +578,18 @@ async function fetchStoreInfo(connectionId, baseUrl = KNOWN_API_URLS.production)
|
|
|
559
578
|
}
|
|
560
579
|
const storeName = json.storeName || json.name || "My Store";
|
|
561
580
|
const displayName = json.channelName || storeName;
|
|
581
|
+
const currency = json.currency;
|
|
582
|
+
const language = json.language;
|
|
583
|
+
if (!currency || !language) {
|
|
584
|
+
throw new Error(
|
|
585
|
+
`Malformed /info response from ${baseUrl} (missing ${!currency ? "currency" : "language"}).`
|
|
586
|
+
);
|
|
587
|
+
}
|
|
562
588
|
return {
|
|
563
589
|
name: displayName,
|
|
564
590
|
storeName,
|
|
565
|
-
currency
|
|
566
|
-
language
|
|
591
|
+
currency,
|
|
592
|
+
language,
|
|
567
593
|
...json.i18n ? { i18n: json.i18n } : {}
|
|
568
594
|
};
|
|
569
595
|
}
|
|
@@ -679,6 +705,11 @@ program.name("create-brainerce-store").description("Scaffold a production-ready
|
|
|
679
705
|
).option("--language <lang>", "Store language (en, he)").option("--framework <framework>", "Framework to use", "nextjs").option("--theme <theme>", "Theme to apply", "minimal").option("--pkg-manager <manager>", "Package manager (npm, pnpm, yarn, bun)").option("--no-git", "Skip git initialization").option("--no-install", "Skip dependency installation").action(async (projectNameArg, options) => {
|
|
680
706
|
try {
|
|
681
707
|
logger.banner(pkg.version);
|
|
708
|
+
const nodeError = validateNodeVersion(process.versions.node);
|
|
709
|
+
if (nodeError) {
|
|
710
|
+
logger.error(nodeError);
|
|
711
|
+
process.exit(1);
|
|
712
|
+
}
|
|
682
713
|
const updateCheck = checkForUpdate(pkg.name, pkg.version);
|
|
683
714
|
let projectName = projectNameArg;
|
|
684
715
|
let scaffoldInPlace = false;
|
|
@@ -804,15 +835,13 @@ program.name("create-brainerce-store").description("Scaffold a production-ready
|
|
|
804
835
|
);
|
|
805
836
|
} catch (err) {
|
|
806
837
|
spinner.fail("Could not fetch store info");
|
|
807
|
-
logger.
|
|
808
|
-
err instanceof Error ? err.message : "
|
|
838
|
+
logger.error(
|
|
839
|
+
err instanceof Error ? err.message : "Could not reach the Brainerce API to read this connection."
|
|
809
840
|
);
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
language: "en"
|
|
815
|
-
};
|
|
841
|
+
logger.info(
|
|
842
|
+
"Re-run after verifying:\n \u2022 the connection ID matches a real sales channel in your dashboard\n \u2022 the machine running create-brainerce-store can reach the Brainerce API\n \u2022 if you are offline / behind a firewall, scaffold from a machine that can reach the API"
|
|
843
|
+
);
|
|
844
|
+
process.exit(1);
|
|
816
845
|
}
|
|
817
846
|
}
|
|
818
847
|
if (!pkgManager) {
|