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 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.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 cmd = process.platform === "win32" ? `${pkgManager}.cmd` : pkgManager;
168
- const args = pkgManager === "yarn" ? [] : ["install"];
169
- const child = (0, import_child_process.spawn)(cmd, args, {
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
- reject(new Error(`${pkgManager} install exited with code ${code}`));
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 { execSync: execSync2 } = require("child_process");
802
+ const { execFileSync } = require("child_process");
789
803
  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
- });
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 (git may not be installed)");
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
  );
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.4",
4
4
  "description": "Scaffold a production-ready e-commerce storefront connected to Brainerce",
5
5
  "bin": {
6
6
  "create-brainerce-store": "dist/index.js"