@wordpress-flow/cli 1.0.10 → 1.0.11

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.
@@ -2027,8 +2027,9 @@ function parseBlockJsonFromSource(block) {
2027
2027
  };
2028
2028
  }
2029
2029
  async function runWebpackBuild(entryPoint, outputDir, webpackConfigPath) {
2030
- const webpackBinary = findWebpackBinary();
2030
+ const webpackCliPath = findWebpackCliPath();
2031
2031
  const args = [
2032
+ webpackCliPath,
2032
2033
  "--config",
2033
2034
  webpackConfigPath,
2034
2035
  "--env",
@@ -2038,7 +2039,7 @@ async function runWebpackBuild(entryPoint, outputDir, webpackConfigPath) {
2038
2039
  "--mode",
2039
2040
  "production"
2040
2041
  ];
2041
- const result = spawnSync(webpackBinary, args, {
2042
+ const result = spawnSync(process.execPath, args, {
2042
2043
  cwd: path.dirname(webpackConfigPath),
2043
2044
  stdio: "pipe",
2044
2045
  env: { ...process.env }
@@ -2052,17 +2053,17 @@ async function runWebpackBuild(entryPoint, outputDir, webpackConfigPath) {
2052
2053
  throw new Error(`Webpack build failed (exit code ${result.status}): ${stderr || stdout}`);
2053
2054
  }
2054
2055
  }
2055
- function findWebpackBinary() {
2056
+ function findWebpackCliPath() {
2056
2057
  const possiblePaths = [
2057
- path.join(process.cwd(), "packages", "block", "node_modules", ".bin", "webpack"),
2058
- path.join(process.cwd(), "node_modules", ".bin", "webpack")
2058
+ path.join(process.cwd(), "packages", "block", "node_modules", "webpack-cli", "bin", "cli.js"),
2059
+ path.join(process.cwd(), "node_modules", "webpack-cli", "bin", "cli.js")
2059
2060
  ];
2060
- for (const webpackPath of possiblePaths) {
2061
- if (fs.existsSync(webpackPath)) {
2062
- return webpackPath;
2061
+ for (const cliPath of possiblePaths) {
2062
+ if (fs.existsSync(cliPath)) {
2063
+ return cliPath;
2063
2064
  }
2064
2065
  }
2065
- return "npx webpack";
2066
+ throw new Error("webpack-cli not found. Please install webpack-cli in your project.");
2066
2067
  }
2067
2068
  function verifyBuildOutput(outputDir) {
2068
2069
  const requiredFiles = ["block.json", "index.js", "ssr.js"];
package/dist/index.js CHANGED
@@ -115884,7 +115884,7 @@ add_action('enqueue_block_assets', 'wordpress_flow_enqueue_block_scripts');
115884
115884
  // package.json
115885
115885
  var package_default = {
115886
115886
  name: "@wordpress-flow/cli",
115887
- version: "1.0.10",
115887
+ version: "1.0.11",
115888
115888
  type: "module",
115889
115889
  description: "TypeScript-based WordPress block creation system",
115890
115890
  main: "dist/index.js",
@@ -116429,9 +116429,10 @@ class WebpackRunner {
116429
116429
  throw new Error(error);
116430
116430
  }
116431
116431
  fs15.mkdirSync(outputDir, { recursive: true });
116432
- const webpackBinary = this.findWebpackBinary();
116433
- logger.debug(`Using webpack binary: ${webpackBinary}`);
116432
+ const webpackCliPath = this.findWebpackCliPath();
116433
+ logger.debug(`Using webpack-cli at: ${webpackCliPath}`);
116434
116434
  const args = [
116435
+ webpackCliPath,
116435
116436
  "--config",
116436
116437
  webpackConfigPath,
116437
116438
  "--env",
@@ -116441,10 +116442,10 @@ class WebpackRunner {
116441
116442
  "--mode",
116442
116443
  "production"
116443
116444
  ];
116444
- logger.debug(`Full command: ${webpackBinary} ${args.join(" ")}`);
116445
+ logger.debug(`Full command: node ${args.join(" ")}`);
116445
116446
  const workingDir = path17.dirname(webpackConfigPath);
116446
116447
  logger.debug(`Running webpack from directory: ${workingDir}`);
116447
- const result2 = spawnSync(webpackBinary, args, {
116448
+ const result2 = spawnSync(process.execPath, args, {
116448
116449
  cwd: workingDir,
116449
116450
  stdio: "pipe",
116450
116451
  env: { ...process.env }
@@ -116471,7 +116472,7 @@ class WebpackRunner {
116471
116472
  console.error(import_chalk3.default.red("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"));
116472
116473
  console.error("");
116473
116474
  console.error(import_chalk3.default.yellow("Command that failed:"));
116474
- console.error(import_chalk3.default.gray(`${webpackBinary} ${args.join(" ")}`));
116475
+ console.error(import_chalk3.default.gray(`node ${args.join(" ")}`));
116475
116476
  console.error("");
116476
116477
  console.error(import_chalk3.default.yellow("Working directory:"));
116477
116478
  console.error(import_chalk3.default.gray(workingDir));
@@ -116493,21 +116494,20 @@ class WebpackRunner {
116493
116494
  logger.debug("Webpack build completed successfully");
116494
116495
  logger.debug(`Output: ${result2.stdout?.toString() || ""}`);
116495
116496
  }
116496
- findWebpackBinary() {
116497
+ findWebpackCliPath() {
116497
116498
  const possiblePaths = [
116498
- path17.join(process.cwd(), "packages", "block", "node_modules", ".bin", "webpack"),
116499
- path17.join(process.cwd(), "node_modules", ".bin", "webpack"),
116500
- path17.join(import.meta.dirname, "..", "..", "..", "node_modules", ".bin", "webpack"),
116501
- path17.join(process.cwd(), "..", "node_modules", ".bin", "webpack")
116499
+ path17.join(process.cwd(), "packages", "block", "node_modules", "webpack-cli", "bin", "cli.js"),
116500
+ path17.join(process.cwd(), "node_modules", "webpack-cli", "bin", "cli.js"),
116501
+ path17.join(import.meta.dirname, "..", "..", "..", "node_modules", "webpack-cli", "bin", "cli.js"),
116502
+ path17.join(process.cwd(), "..", "node_modules", "webpack-cli", "bin", "cli.js")
116502
116503
  ];
116503
- for (const webpackPath of possiblePaths) {
116504
- if (fs15.existsSync(webpackPath)) {
116505
- logger.debug(`Found webpack at: ${webpackPath}`);
116506
- return webpackPath;
116504
+ for (const cliPath of possiblePaths) {
116505
+ if (fs15.existsSync(cliPath)) {
116506
+ logger.debug(`Found webpack-cli at: ${cliPath}`);
116507
+ return cliPath;
116507
116508
  }
116508
116509
  }
116509
- logger.debug("Using npx webpack as fallback");
116510
- return "npx webpack";
116510
+ throw new Error("webpack-cli not found. Please install webpack-cli in your project.");
116511
116511
  }
116512
116512
  }
116513
116513
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress-flow/cli",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "type": "module",
5
5
  "description": "TypeScript-based WordPress block creation system",
6
6
  "main": "dist/index.js",