create-brainerce-store 1.28.0 → 1.28.1

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 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.0",
34
+ version: "1.28.1",
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,28 @@ 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 cmd = process.platform === "win32" ? `${pkgManager}.cmd` : pkgManager;
167
+ const isWindows = process.platform === "win32";
168
168
  const args = pkgManager === "yarn" ? [] : ["install"];
169
- const child = (0, import_child_process.spawn)(cmd, args, {
169
+ const child = (0, import_child_process.spawn)(pkgManager, args, {
170
170
  cwd: projectDir,
171
- stdio: "ignore"
171
+ stdio: ["ignore", "ignore", "pipe"],
172
+ shell: isWindows
173
+ });
174
+ let stderrBuf = "";
175
+ child.stderr?.on("data", (chunk) => {
176
+ stderrBuf += chunk.toString();
177
+ if (stderrBuf.length > 8192) {
178
+ stderrBuf = stderrBuf.slice(-8192);
179
+ }
172
180
  });
173
181
  child.on("close", (code) => {
174
182
  if (code === 0) {
175
183
  resolve();
176
184
  } else {
177
- reject(new Error(`${pkgManager} install exited with code ${code}`));
185
+ const tail = stderrBuf.trim();
186
+ const detail = tail ? `
187
+ ${tail}` : "";
188
+ reject(new Error(`${pkgManager} install exited with code ${code}${detail}`));
178
189
  }
179
190
  });
180
191
  child.on("error", (err) => {
@@ -785,17 +796,21 @@ program.name("create-brainerce-store").description("Scaffold a production-ready
785
796
  const gitSpinner = createSpinner("Initializing git...");
786
797
  gitSpinner.start();
787
798
  try {
788
- const { execSync: execSync2 } = require("child_process");
799
+ const { execFileSync } = require("child_process");
789
800
  const cwd = scaffoldInPlace ? "." : projectName;
790
- execSync2("git init", { cwd, stdio: "ignore" });
791
- execSync2("git add -A", { cwd, stdio: "ignore" });
792
- execSync2('git commit -m "Initial commit from create-brainerce-store"', {
793
- cwd,
794
- stdio: "ignore"
795
- });
801
+ const gitOpts = { cwd, stdio: ["ignore", "ignore", "pipe"] };
802
+ execFileSync("git", ["init"], gitOpts);
803
+ execFileSync("git", ["add", "-A"], gitOpts);
804
+ execFileSync(
805
+ "git",
806
+ ["commit", "-m", "Initial commit from create-brainerce-store"],
807
+ gitOpts
808
+ );
796
809
  gitSpinner.succeed("Git initialized");
797
- } catch {
798
- gitSpinner.fail("Git initialization failed (git may not be installed)");
810
+ } catch (err) {
811
+ gitSpinner.fail("Git initialization failed");
812
+ const detail = err && typeof err === "object" && "stderr" in err ? String(err.stderr).trim() : err instanceof Error ? err.message : "";
813
+ if (detail) logger.warn(detail);
799
814
  }
800
815
  }
801
816
  if (!skipInstall) {
@@ -804,8 +819,9 @@ program.name("create-brainerce-store").description("Scaffold a production-ready
804
819
  try {
805
820
  await installDependencies(scaffoldInPlace ? "." : projectName, pkgManager);
806
821
  installSpinner.succeed("Dependencies installed");
807
- } catch {
822
+ } catch (err) {
808
823
  installSpinner.fail("Dependency installation failed");
824
+ if (err instanceof Error && err.message) logger.warn(err.message);
809
825
  logger.warn(
810
826
  scaffoldInPlace ? `Run \`${pkgManager} install\` manually.` : `Run \`cd ${projectName} && ${pkgManager} install\` manually.`
811
827
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-brainerce-store",
3
- "version": "1.28.0",
3
+ "version": "1.28.1",
4
4
  "description": "Scaffold a production-ready e-commerce storefront connected to Brainerce",
5
5
  "bin": {
6
6
  "create-brainerce-store": "dist/index.js"
@@ -60,6 +60,7 @@ export default async function RootLayout({
60
60
  <script
61
61
  type="application/ld+json"
62
62
  nonce={nonce}
63
+ suppressHydrationWarning
63
64
  dangerouslySetInnerHTML={{
64
65
  __html: JSON.stringify(organizationJsonLd)
65
66
  .replace(/</g, '\\u003c')
@@ -133,6 +134,7 @@ export default async function RootLayout({
133
134
  <script
134
135
  type="application/ld+json"
135
136
  nonce={nonce}
137
+ suppressHydrationWarning
136
138
  dangerouslySetInnerHTML={{
137
139
  __html: JSON.stringify(organizationJsonLd)
138
140
  .replace(/</g, '\\u003c')
@@ -64,11 +64,13 @@ export async function ProductJsonLd({ product, url, currency = 'USD' }: ProductJ
64
64
  <script
65
65
  type="application/ld+json"
66
66
  nonce={nonce}
67
+ suppressHydrationWarning
67
68
  dangerouslySetInnerHTML={{ __html: serializeJsonLd(productJsonLd) }}
68
69
  />
69
70
  <script
70
71
  type="application/ld+json"
71
72
  nonce={nonce}
73
+ suppressHydrationWarning
72
74
  dangerouslySetInnerHTML={{ __html: serializeJsonLd(breadcrumbJsonLd) }}
73
75
  />
74
76
  </>
@@ -20,9 +20,15 @@ function generateNonce(): string {
20
20
  }
21
21
 
22
22
  function buildCsp(nonce: string): string {
23
+ const isDev = process.env.NODE_ENV === 'development';
24
+ // Next dev uses webpack's eval-source-map devtool, which requires 'unsafe-eval'
25
+ // to execute module code. Prod builds never eval, so this only loosens dev.
26
+ const scriptSrc = isDev
27
+ ? `script-src 'self' 'nonce-${nonce}' 'strict-dynamic' 'unsafe-eval'`
28
+ : `script-src 'self' 'nonce-${nonce}' 'strict-dynamic'`;
23
29
  return [
24
30
  "default-src 'self'",
25
- `script-src 'self' 'nonce-${nonce}' 'strict-dynamic'`,
31
+ scriptSrc,
26
32
  "style-src 'self' 'unsafe-inline' https://cdn.meshulam.co.il",
27
33
  "img-src 'self' data: blob: https:",
28
34
  "font-src 'self' data:",
@@ -105,9 +111,15 @@ function generateNonce(): string {
105
111
  }
106
112
 
107
113
  function buildCsp(nonce: string): string {
114
+ const isDev = process.env.NODE_ENV === 'development';
115
+ // Next dev uses webpack's eval-source-map devtool, which requires 'unsafe-eval'
116
+ // to execute module code. Prod builds never eval, so this only loosens dev.
117
+ const scriptSrc = isDev
118
+ ? `script-src 'self' 'nonce-${nonce}' 'strict-dynamic' 'unsafe-eval'`
119
+ : `script-src 'self' 'nonce-${nonce}' 'strict-dynamic'`;
108
120
  return [
109
121
  "default-src 'self'",
110
- `script-src 'self' 'nonce-${nonce}' 'strict-dynamic'`,
122
+ scriptSrc,
111
123
  "style-src 'self' 'unsafe-inline' https://cdn.meshulam.co.il",
112
124
  "img-src 'self' data: blob: https:",
113
125
  "font-src 'self' data:",