@wordpress-flow/cli 1.2.0 → 1.2.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/build/block-build-worker.js +3 -4
- package/dist/index.js +11 -3
- package/package.json +1 -1
|
@@ -1837,7 +1837,7 @@ import * as fs from "fs";
|
|
|
1837
1837
|
import * as esbuild from "esbuild";
|
|
1838
1838
|
import { execSync } from "child_process";
|
|
1839
1839
|
async function buildBlock() {
|
|
1840
|
-
const { block, outputDir, webpackConfigPath, scriptsPath, tempDir } = workerData;
|
|
1840
|
+
const { block, outputDir, scriptsOutputDir, webpackConfigPath, scriptsPath, tempDir } = workerData;
|
|
1841
1841
|
try {
|
|
1842
1842
|
fs.mkdirSync(tempDir, { recursive: true });
|
|
1843
1843
|
const entryPoint = await generateEntryPoint(block, tempDir);
|
|
@@ -1845,7 +1845,7 @@ async function buildBlock() {
|
|
|
1845
1845
|
fs.mkdirSync(blockOutputDir, { recursive: true });
|
|
1846
1846
|
let scriptPaths = [];
|
|
1847
1847
|
if (block.scripts && block.scripts.length > 0 && scriptsPath) {
|
|
1848
|
-
scriptPaths = await buildBlockScripts(block.scripts, scriptsPath,
|
|
1848
|
+
scriptPaths = await buildBlockScripts(block.scripts, scriptsPath, scriptsOutputDir);
|
|
1849
1849
|
}
|
|
1850
1850
|
await generateBlockJson(block, blockOutputDir, tempDir);
|
|
1851
1851
|
await generateSSRVersion(block, blockOutputDir);
|
|
@@ -1889,8 +1889,7 @@ if (document.readyState === 'loading') {
|
|
|
1889
1889
|
fs.writeFileSync(entryPath, entryContent, "utf8");
|
|
1890
1890
|
return entryPath;
|
|
1891
1891
|
}
|
|
1892
|
-
async function buildBlockScripts(scripts, scriptsPath,
|
|
1893
|
-
const scriptsOutputDir = path.join(outputDir, "scripts");
|
|
1892
|
+
async function buildBlockScripts(scripts, scriptsPath, scriptsOutputDir) {
|
|
1894
1893
|
fs.mkdirSync(scriptsOutputDir, { recursive: true });
|
|
1895
1894
|
const outputPaths = [];
|
|
1896
1895
|
for (const script of scripts) {
|
package/dist/index.js
CHANGED
|
@@ -81015,13 +81015,16 @@ class ConfigManager {
|
|
|
81015
81015
|
const theme = raw.paths?.theme || DEFAULTS.paths.theme;
|
|
81016
81016
|
const content2 = raw.paths?.content || DEFAULTS.paths.content;
|
|
81017
81017
|
const plugins = raw.paths?.plugins || DEFAULTS.paths.plugins;
|
|
81018
|
+
const dist = `${theme}/dist`;
|
|
81018
81019
|
return {
|
|
81019
81020
|
paths: {
|
|
81020
81021
|
theme,
|
|
81021
81022
|
content: content2,
|
|
81022
81023
|
plugins,
|
|
81023
81024
|
blocks: `${theme}/blocks`,
|
|
81024
|
-
dist
|
|
81025
|
+
dist,
|
|
81026
|
+
blocksDist: `${dist}/blocks`,
|
|
81027
|
+
scriptsDist: `${dist}/scripts`,
|
|
81025
81028
|
scripts: `${theme}/scripts`,
|
|
81026
81029
|
templates: `${content2}/templates`,
|
|
81027
81030
|
templateParts: `${content2}/parts`,
|
|
@@ -116261,7 +116264,7 @@ class DockerEnvManager {
|
|
|
116261
116264
|
// package.json
|
|
116262
116265
|
var package_default = {
|
|
116263
116266
|
name: "@wordpress-flow/cli",
|
|
116264
|
-
version: "1.2.
|
|
116267
|
+
version: "1.2.1",
|
|
116265
116268
|
type: "module",
|
|
116266
116269
|
description: "TypeScript-based WordPress block creation system",
|
|
116267
116270
|
main: "dist/index.js",
|
|
@@ -117610,12 +117613,14 @@ import * as os2 from "os";
|
|
|
117610
117613
|
class WorkerPool {
|
|
117611
117614
|
concurrency;
|
|
117612
117615
|
outputDir;
|
|
117616
|
+
scriptsOutputDir;
|
|
117613
117617
|
webpackConfigPath;
|
|
117614
117618
|
scriptsPath;
|
|
117615
117619
|
workerPath;
|
|
117616
117620
|
constructor(options) {
|
|
117617
117621
|
this.concurrency = options.concurrency ?? Math.max(1, os2.cpus().length - 1);
|
|
117618
117622
|
this.outputDir = options.outputDir;
|
|
117623
|
+
this.scriptsOutputDir = options.scriptsOutputDir;
|
|
117619
117624
|
this.webpackConfigPath = options.webpackConfigPath;
|
|
117620
117625
|
this.scriptsPath = options.scriptsPath;
|
|
117621
117626
|
this.workerPath = path21.join(import.meta.dirname, "build", "block-build-worker.js");
|
|
@@ -117673,6 +117678,7 @@ class WorkerPool {
|
|
|
117673
117678
|
scripts: block.scripts
|
|
117674
117679
|
},
|
|
117675
117680
|
outputDir: this.outputDir,
|
|
117681
|
+
scriptsOutputDir: this.scriptsOutputDir,
|
|
117676
117682
|
webpackConfigPath: this.webpackConfigPath,
|
|
117677
117683
|
scriptsPath: this.scriptsPath,
|
|
117678
117684
|
tempDir
|
|
@@ -117726,7 +117732,7 @@ class BuildCommand {
|
|
|
117726
117732
|
try {
|
|
117727
117733
|
const config = this.configManager.getConfig();
|
|
117728
117734
|
const blocksDir = this.configManager.resolvePath(options.blocksDir || config.paths.blocks);
|
|
117729
|
-
const outputDir = this.configManager.resolvePath(options.outputDir || config.paths.
|
|
117735
|
+
const outputDir = this.configManager.resolvePath(options.outputDir || config.paths.blocksDist);
|
|
117730
117736
|
let webpackConfig;
|
|
117731
117737
|
if (options.webpackConfig) {
|
|
117732
117738
|
webpackConfig = this.configManager.resolvePath(options.webpackConfig);
|
|
@@ -117763,9 +117769,11 @@ class BuildCommand {
|
|
|
117763
117769
|
} else {
|
|
117764
117770
|
logger.info(`Found ${blocks.length} block(s): ${blocks.map((b) => b.name).join(", ")}`);
|
|
117765
117771
|
}
|
|
117772
|
+
const scriptsOutputDir = this.configManager.resolvePath(config.paths.scriptsDist);
|
|
117766
117773
|
const workerPool = new WorkerPool({
|
|
117767
117774
|
concurrency: options.concurrency,
|
|
117768
117775
|
outputDir,
|
|
117776
|
+
scriptsOutputDir,
|
|
117769
117777
|
webpackConfigPath: webpackConfig,
|
|
117770
117778
|
scriptsPath
|
|
117771
117779
|
});
|