@wordpress-flow/cli 1.0.10 → 1.0.12
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 +4 -21
- package/dist/index.js +25 -42
- package/package.json +1 -1
|
@@ -1835,7 +1835,7 @@ import { parentPort, workerData } from "worker_threads";
|
|
|
1835
1835
|
import * as path from "path";
|
|
1836
1836
|
import * as fs from "fs";
|
|
1837
1837
|
import * as esbuild from "esbuild";
|
|
1838
|
-
import {
|
|
1838
|
+
import { execSync } from "child_process";
|
|
1839
1839
|
async function buildBlock() {
|
|
1840
1840
|
const { block, outputDir, webpackConfigPath, scriptsPath, tempDir } = workerData;
|
|
1841
1841
|
try {
|
|
@@ -2028,29 +2028,12 @@ function parseBlockJsonFromSource(block) {
|
|
|
2028
2028
|
}
|
|
2029
2029
|
async function runWebpackBuild(entryPoint, outputDir, webpackConfigPath) {
|
|
2030
2030
|
const webpackBinary = findWebpackBinary();
|
|
2031
|
-
const
|
|
2032
|
-
|
|
2033
|
-
webpackConfigPath,
|
|
2034
|
-
"--env",
|
|
2035
|
-
`entry=${entryPoint}`,
|
|
2036
|
-
"--env",
|
|
2037
|
-
`output=${outputDir}`,
|
|
2038
|
-
"--mode",
|
|
2039
|
-
"production"
|
|
2040
|
-
];
|
|
2041
|
-
const result = spawnSync(webpackBinary, args, {
|
|
2031
|
+
const command = `"${webpackBinary}" --config "${webpackConfigPath}" --env entry="${entryPoint}" --env output="${outputDir}" --mode production`;
|
|
2032
|
+
execSync(command, {
|
|
2042
2033
|
cwd: path.dirname(webpackConfigPath),
|
|
2043
2034
|
stdio: "pipe",
|
|
2044
|
-
env: { ...process.env }
|
|
2035
|
+
env: { ...process.env, PATH: process.env.PATH }
|
|
2045
2036
|
});
|
|
2046
|
-
if (result.error) {
|
|
2047
|
-
throw result.error;
|
|
2048
|
-
}
|
|
2049
|
-
if (result.status !== 0) {
|
|
2050
|
-
const stderr = result.stderr?.toString() || "";
|
|
2051
|
-
const stdout = result.stdout?.toString() || "";
|
|
2052
|
-
throw new Error(`Webpack build failed (exit code ${result.status}): ${stderr || stdout}`);
|
|
2053
|
-
}
|
|
2054
2037
|
}
|
|
2055
2038
|
function findWebpackBinary() {
|
|
2056
2039
|
const possiblePaths = [
|
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.
|
|
115887
|
+
version: "1.0.12",
|
|
115888
115888
|
type: "module",
|
|
115889
115889
|
description: "TypeScript-based WordPress block creation system",
|
|
115890
115890
|
main: "dist/index.js",
|
|
@@ -116408,7 +116408,7 @@ import * as path19 from "path";
|
|
|
116408
116408
|
// src/build/webpack-runner.ts
|
|
116409
116409
|
import * as path17 from "path";
|
|
116410
116410
|
import * as fs15 from "fs";
|
|
116411
|
-
import {
|
|
116411
|
+
import { execSync } from "child_process";
|
|
116412
116412
|
var import_chalk3 = __toESM(require_source(), 1);
|
|
116413
116413
|
|
|
116414
116414
|
class WebpackRunner {
|
|
@@ -116431,67 +116431,50 @@ class WebpackRunner {
|
|
|
116431
116431
|
fs15.mkdirSync(outputDir, { recursive: true });
|
|
116432
116432
|
const webpackBinary = this.findWebpackBinary();
|
|
116433
116433
|
logger.debug(`Using webpack binary: ${webpackBinary}`);
|
|
116434
|
-
const
|
|
116435
|
-
|
|
116436
|
-
webpackConfigPath,
|
|
116437
|
-
"--env",
|
|
116438
|
-
`entry=${entryPoint}`,
|
|
116439
|
-
"--env",
|
|
116440
|
-
`output=${outputDir}`,
|
|
116441
|
-
"--mode",
|
|
116442
|
-
"production"
|
|
116443
|
-
];
|
|
116444
|
-
logger.debug(`Full command: ${webpackBinary} ${args.join(" ")}`);
|
|
116434
|
+
const command = `"${webpackBinary}" --config "${webpackConfigPath}" --env entry="${entryPoint}" --env output="${outputDir}" --mode production`;
|
|
116435
|
+
logger.debug(`Full command: ${command}`);
|
|
116445
116436
|
const workingDir = path17.dirname(webpackConfigPath);
|
|
116446
116437
|
logger.debug(`Running webpack from directory: ${workingDir}`);
|
|
116447
|
-
|
|
116448
|
-
|
|
116449
|
-
|
|
116450
|
-
|
|
116451
|
-
|
|
116452
|
-
|
|
116453
|
-
|
|
116454
|
-
|
|
116455
|
-
|
|
116456
|
-
|
|
116457
|
-
console.error("");
|
|
116458
|
-
console.error(import_chalk3.default.yellow("Error:"));
|
|
116459
|
-
console.error(import_chalk3.default.gray(result2.error.message));
|
|
116460
|
-
console.error("");
|
|
116461
|
-
console.error(import_chalk3.default.red("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"));
|
|
116462
|
-
console.error("");
|
|
116463
|
-
throw result2.error;
|
|
116464
|
-
}
|
|
116465
|
-
if (result2.status !== 0) {
|
|
116466
|
-
const stderr = result2.stderr?.toString() || "";
|
|
116467
|
-
const stdout = result2.stdout?.toString() || "";
|
|
116438
|
+
try {
|
|
116439
|
+
const output2 = execSync(command, {
|
|
116440
|
+
cwd: workingDir,
|
|
116441
|
+
encoding: "utf8",
|
|
116442
|
+
stdio: "pipe",
|
|
116443
|
+
env: { ...process.env, PATH: process.env.PATH }
|
|
116444
|
+
});
|
|
116445
|
+
logger.debug("Webpack build completed successfully");
|
|
116446
|
+
logger.debug(`Output: ${output2}`);
|
|
116447
|
+
} catch (error) {
|
|
116468
116448
|
console.error("");
|
|
116469
116449
|
console.error(import_chalk3.default.red("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"));
|
|
116470
116450
|
console.error(import_chalk3.default.red.bold(" WEBPACK BUILD FAILED"));
|
|
116471
116451
|
console.error(import_chalk3.default.red("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"));
|
|
116472
116452
|
console.error("");
|
|
116473
116453
|
console.error(import_chalk3.default.yellow("Command that failed:"));
|
|
116474
|
-
console.error(import_chalk3.default.gray(
|
|
116454
|
+
console.error(import_chalk3.default.gray(command));
|
|
116475
116455
|
console.error("");
|
|
116476
116456
|
console.error(import_chalk3.default.yellow("Working directory:"));
|
|
116477
116457
|
console.error(import_chalk3.default.gray(workingDir));
|
|
116478
116458
|
console.error("");
|
|
116479
|
-
if (stdout
|
|
116459
|
+
if (error.stdout?.trim()) {
|
|
116480
116460
|
console.error(import_chalk3.default.yellow("Standard output:"));
|
|
116481
|
-
console.error(stdout);
|
|
116461
|
+
console.error(error.stdout);
|
|
116482
116462
|
console.error("");
|
|
116483
116463
|
}
|
|
116484
|
-
if (stderr
|
|
116464
|
+
if (error.stderr?.trim()) {
|
|
116485
116465
|
console.error(import_chalk3.default.yellow("Error output:"));
|
|
116486
|
-
console.error(stderr);
|
|
116466
|
+
console.error(error.stderr);
|
|
116467
|
+
console.error("");
|
|
116468
|
+
}
|
|
116469
|
+
if (!error.stdout && !error.stderr) {
|
|
116470
|
+
console.error(import_chalk3.default.yellow("Error message:"));
|
|
116471
|
+
console.error(error.message);
|
|
116487
116472
|
console.error("");
|
|
116488
116473
|
}
|
|
116489
116474
|
console.error(import_chalk3.default.red("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"));
|
|
116490
116475
|
console.error("");
|
|
116491
|
-
throw new Error(`Webpack build failed
|
|
116476
|
+
throw new Error(`Webpack build failed`);
|
|
116492
116477
|
}
|
|
116493
|
-
logger.debug("Webpack build completed successfully");
|
|
116494
|
-
logger.debug(`Output: ${result2.stdout?.toString() || ""}`);
|
|
116495
116478
|
}
|
|
116496
116479
|
findWebpackBinary() {
|
|
116497
116480
|
const possiblePaths = [
|