create-brainerce-store 1.28.0 → 1.28.4
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 +35 -16
- package/package.json +1 -1
- package/templates/nextjs/base/src/app/checkout/page.tsx +975 -975
- package/templates/nextjs/base/src/app/layout.tsx.ejs +2 -0
- package/templates/nextjs/base/src/components/checkout/payment-step.tsx +2 -2
- package/templates/nextjs/base/src/components/layout/language-switcher.tsx.ejs +12 -5
- package/templates/nextjs/base/src/components/seo/product-json-ld.tsx +2 -0
- package/templates/nextjs/base/src/lib/navigation.tsx.ejs +17 -4
- package/templates/nextjs/base/src/middleware.ts.ejs +49 -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.28.
|
|
34
|
+
version: "1.28.4",
|
|
35
35
|
description: "Scaffold a production-ready e-commerce storefront connected to Brainerce",
|
|
36
36
|
bin: {
|
|
37
37
|
"create-brainerce-store": "dist/index.js"
|
|
@@ -164,17 +164,31 @@ async function installDependencies(projectDir, pkgManager) {
|
|
|
164
164
|
throw new Error(`Unsupported package manager: ${pkgManager}`);
|
|
165
165
|
}
|
|
166
166
|
return new Promise((resolve, reject) => {
|
|
167
|
-
const
|
|
168
|
-
const
|
|
169
|
-
const child = (0, import_child_process.spawn)(
|
|
167
|
+
const isWindows = process.platform === "win32";
|
|
168
|
+
const subcommand = pkgManager === "yarn" ? "" : "install";
|
|
169
|
+
const child = isWindows ? (0, import_child_process.spawn)(`${pkgManager} ${subcommand}`.trim(), {
|
|
170
170
|
cwd: projectDir,
|
|
171
|
-
stdio: "ignore"
|
|
171
|
+
stdio: ["ignore", "ignore", "pipe"],
|
|
172
|
+
shell: true
|
|
173
|
+
}) : (0, import_child_process.spawn)(pkgManager, subcommand ? [subcommand] : [], {
|
|
174
|
+
cwd: projectDir,
|
|
175
|
+
stdio: ["ignore", "ignore", "pipe"]
|
|
176
|
+
});
|
|
177
|
+
let stderrBuf = "";
|
|
178
|
+
child.stderr?.on("data", (chunk) => {
|
|
179
|
+
stderrBuf += chunk.toString();
|
|
180
|
+
if (stderrBuf.length > 8192) {
|
|
181
|
+
stderrBuf = stderrBuf.slice(-8192);
|
|
182
|
+
}
|
|
172
183
|
});
|
|
173
184
|
child.on("close", (code) => {
|
|
174
185
|
if (code === 0) {
|
|
175
186
|
resolve();
|
|
176
187
|
} else {
|
|
177
|
-
|
|
188
|
+
const tail = stderrBuf.trim();
|
|
189
|
+
const detail = tail ? `
|
|
190
|
+
${tail}` : "";
|
|
191
|
+
reject(new Error(`${pkgManager} install exited with code ${code}${detail}`));
|
|
178
192
|
}
|
|
179
193
|
});
|
|
180
194
|
child.on("error", (err) => {
|
|
@@ -785,17 +799,21 @@ program.name("create-brainerce-store").description("Scaffold a production-ready
|
|
|
785
799
|
const gitSpinner = createSpinner("Initializing git...");
|
|
786
800
|
gitSpinner.start();
|
|
787
801
|
try {
|
|
788
|
-
const {
|
|
802
|
+
const { execFileSync } = require("child_process");
|
|
789
803
|
const cwd = scaffoldInPlace ? "." : projectName;
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
804
|
+
const gitOpts = { cwd, stdio: ["ignore", "ignore", "pipe"] };
|
|
805
|
+
execFileSync("git", ["init"], gitOpts);
|
|
806
|
+
execFileSync("git", ["add", "-A"], gitOpts);
|
|
807
|
+
execFileSync(
|
|
808
|
+
"git",
|
|
809
|
+
["commit", "-m", "Initial commit from create-brainerce-store"],
|
|
810
|
+
gitOpts
|
|
811
|
+
);
|
|
796
812
|
gitSpinner.succeed("Git initialized");
|
|
797
|
-
} catch {
|
|
798
|
-
gitSpinner.fail("Git initialization failed
|
|
813
|
+
} catch (err) {
|
|
814
|
+
gitSpinner.fail("Git initialization failed");
|
|
815
|
+
const detail = err && typeof err === "object" && "stderr" in err ? String(err.stderr).trim() : err instanceof Error ? err.message : "";
|
|
816
|
+
if (detail) logger.warn(detail);
|
|
799
817
|
}
|
|
800
818
|
}
|
|
801
819
|
if (!skipInstall) {
|
|
@@ -804,8 +822,9 @@ program.name("create-brainerce-store").description("Scaffold a production-ready
|
|
|
804
822
|
try {
|
|
805
823
|
await installDependencies(scaffoldInPlace ? "." : projectName, pkgManager);
|
|
806
824
|
installSpinner.succeed("Dependencies installed");
|
|
807
|
-
} catch {
|
|
825
|
+
} catch (err) {
|
|
808
826
|
installSpinner.fail("Dependency installation failed");
|
|
827
|
+
if (err instanceof Error && err.message) logger.warn(err.message);
|
|
809
828
|
logger.warn(
|
|
810
829
|
scaffoldInPlace ? `Run \`${pkgManager} install\` manually.` : `Run \`cd ${projectName} && ${pkgManager} install\` manually.`
|
|
811
830
|
);
|