@wordpress-flow/cli 1.0.13 → 1.0.14
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/build/block-build-worker.js +13 -22
- package/dist/index.js +5 -22
- package/package.json +1 -1
|
@@ -2483,18 +2483,8 @@ function parseBlockJsonFromSource(block) {
|
|
|
2483
2483
|
};
|
|
2484
2484
|
}
|
|
2485
2485
|
async function runWebpackBuild(entryPoint, outputDir, webpackConfigPath) {
|
|
2486
|
-
const
|
|
2487
|
-
const
|
|
2488
|
-
"--config",
|
|
2489
|
-
webpackConfigPath,
|
|
2490
|
-
"--env",
|
|
2491
|
-
`entry=${entryPoint}`,
|
|
2492
|
-
"--env",
|
|
2493
|
-
`output=${outputDir}`,
|
|
2494
|
-
"--mode",
|
|
2495
|
-
"production"
|
|
2496
|
-
];
|
|
2497
|
-
const result = import_cross_spawn.default.sync(webpackBinary, args, {
|
|
2486
|
+
const args = getWebpackArgs(webpackConfigPath, entryPoint, outputDir);
|
|
2487
|
+
const result = import_cross_spawn.default.sync("npx", args, {
|
|
2498
2488
|
cwd: path.dirname(webpackConfigPath),
|
|
2499
2489
|
stdio: "pipe",
|
|
2500
2490
|
env: { ...process.env }
|
|
@@ -2508,17 +2498,18 @@ async function runWebpackBuild(entryPoint, outputDir, webpackConfigPath) {
|
|
|
2508
2498
|
throw new Error(`Webpack build failed (exit code ${result.status}): ${stderr || stdout}`);
|
|
2509
2499
|
}
|
|
2510
2500
|
}
|
|
2511
|
-
function
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2501
|
+
function getWebpackArgs(configPath, entryPoint, outputDir) {
|
|
2502
|
+
return [
|
|
2503
|
+
"webpack",
|
|
2504
|
+
"--config",
|
|
2505
|
+
configPath,
|
|
2506
|
+
"--env",
|
|
2507
|
+
`entry=${entryPoint}`,
|
|
2508
|
+
"--env",
|
|
2509
|
+
`output=${outputDir}`,
|
|
2510
|
+
"--mode",
|
|
2511
|
+
"production"
|
|
2515
2512
|
];
|
|
2516
|
-
for (const webpackPath of possiblePaths) {
|
|
2517
|
-
if (fs.existsSync(webpackPath)) {
|
|
2518
|
-
return webpackPath;
|
|
2519
|
-
}
|
|
2520
|
-
}
|
|
2521
|
-
return "npx webpack";
|
|
2522
2513
|
}
|
|
2523
2514
|
function verifyBuildOutput(outputDir) {
|
|
2524
2515
|
const requiredFiles = ["block.json", "index.js", "ssr.js"];
|
package/dist/index.js
CHANGED
|
@@ -116340,7 +116340,7 @@ add_action('enqueue_block_assets', 'wordpress_flow_enqueue_block_scripts');
|
|
|
116340
116340
|
// package.json
|
|
116341
116341
|
var package_default = {
|
|
116342
116342
|
name: "@wordpress-flow/cli",
|
|
116343
|
-
version: "1.0.
|
|
116343
|
+
version: "1.0.14",
|
|
116344
116344
|
type: "module",
|
|
116345
116345
|
description: "TypeScript-based WordPress block creation system",
|
|
116346
116346
|
main: "dist/index.js",
|
|
@@ -116887,9 +116887,8 @@ class WebpackRunner {
|
|
|
116887
116887
|
throw new Error(error);
|
|
116888
116888
|
}
|
|
116889
116889
|
fs15.mkdirSync(outputDir, { recursive: true });
|
|
116890
|
-
const webpackBinary = this.findWebpackBinary();
|
|
116891
|
-
logger.debug(`Using webpack binary: ${webpackBinary}`);
|
|
116892
116890
|
const args = [
|
|
116891
|
+
"webpack",
|
|
116893
116892
|
"--config",
|
|
116894
116893
|
webpackConfigPath,
|
|
116895
116894
|
"--env",
|
|
@@ -116899,10 +116898,10 @@ class WebpackRunner {
|
|
|
116899
116898
|
"--mode",
|
|
116900
116899
|
"production"
|
|
116901
116900
|
];
|
|
116902
|
-
logger.debug(`Full command:
|
|
116901
|
+
logger.debug(`Full command: npx ${args.join(" ")}`);
|
|
116903
116902
|
const workingDir = path17.dirname(webpackConfigPath);
|
|
116904
116903
|
logger.debug(`Running webpack from directory: ${workingDir}`);
|
|
116905
|
-
const result2 = import_cross_spawn.default.sync(
|
|
116904
|
+
const result2 = import_cross_spawn.default.sync("npx", args, {
|
|
116906
116905
|
cwd: workingDir,
|
|
116907
116906
|
stdio: "pipe",
|
|
116908
116907
|
env: { ...process.env }
|
|
@@ -116929,7 +116928,7 @@ class WebpackRunner {
|
|
|
116929
116928
|
console.error(import_chalk3.default.red("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"));
|
|
116930
116929
|
console.error("");
|
|
116931
116930
|
console.error(import_chalk3.default.yellow("Command that failed:"));
|
|
116932
|
-
console.error(import_chalk3.default.gray(
|
|
116931
|
+
console.error(import_chalk3.default.gray(`npx ${args.join(" ")}`));
|
|
116933
116932
|
console.error("");
|
|
116934
116933
|
console.error(import_chalk3.default.yellow("Working directory:"));
|
|
116935
116934
|
console.error(import_chalk3.default.gray(workingDir));
|
|
@@ -116951,22 +116950,6 @@ class WebpackRunner {
|
|
|
116951
116950
|
logger.debug("Webpack build completed successfully");
|
|
116952
116951
|
logger.debug(`Output: ${result2.stdout?.toString() || ""}`);
|
|
116953
116952
|
}
|
|
116954
|
-
findWebpackBinary() {
|
|
116955
|
-
const possiblePaths = [
|
|
116956
|
-
path17.join(process.cwd(), "packages", "block", "node_modules", ".bin", "webpack"),
|
|
116957
|
-
path17.join(process.cwd(), "node_modules", ".bin", "webpack"),
|
|
116958
|
-
path17.join(import.meta.dirname, "..", "..", "..", "node_modules", ".bin", "webpack"),
|
|
116959
|
-
path17.join(process.cwd(), "..", "node_modules", ".bin", "webpack")
|
|
116960
|
-
];
|
|
116961
|
-
for (const webpackPath of possiblePaths) {
|
|
116962
|
-
if (fs15.existsSync(webpackPath)) {
|
|
116963
|
-
logger.debug(`Found webpack at: ${webpackPath}`);
|
|
116964
|
-
return webpackPath;
|
|
116965
|
-
}
|
|
116966
|
-
}
|
|
116967
|
-
logger.debug("Using npx webpack as fallback");
|
|
116968
|
-
return "npx webpack";
|
|
116969
|
-
}
|
|
116970
116953
|
}
|
|
116971
116954
|
|
|
116972
116955
|
// src/build/script-builder.ts
|