@wordpress-flow/cli 1.0.3 → 1.0.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 +77 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -117432,12 +117432,30 @@ class BuildCommand {
|
|
|
117432
117432
|
if (scriptsPath) {
|
|
117433
117433
|
logger.info(`Scripts directory: ${scriptsPath}`);
|
|
117434
117434
|
}
|
|
117435
|
-
|
|
117435
|
+
let blocks = await this.blockScanner.scanBlocks(blocksDir);
|
|
117436
117436
|
if (blocks.length === 0) {
|
|
117437
117437
|
logger.warn("No blocks found in the specified directory");
|
|
117438
117438
|
return;
|
|
117439
117439
|
}
|
|
117440
|
-
|
|
117440
|
+
if (options.blocks && options.blocks.length > 0) {
|
|
117441
|
+
const requestedBlocks = options.blocks;
|
|
117442
|
+
const allBlockNames = blocks.map((b) => b.name);
|
|
117443
|
+
const filteredBlocks = blocks.filter((block) => requestedBlocks.includes(block.name));
|
|
117444
|
+
const foundBlockNames = filteredBlocks.map((b) => b.name);
|
|
117445
|
+
const notFoundBlocks = requestedBlocks.filter((name2) => !foundBlockNames.includes(name2));
|
|
117446
|
+
if (notFoundBlocks.length > 0) {
|
|
117447
|
+
logger.warn(`Requested blocks not found: ${notFoundBlocks.join(", ")}`);
|
|
117448
|
+
logger.info(`Available blocks: ${allBlockNames.join(", ")}`);
|
|
117449
|
+
}
|
|
117450
|
+
if (filteredBlocks.length === 0) {
|
|
117451
|
+
logger.warn("No matching blocks found to build");
|
|
117452
|
+
return;
|
|
117453
|
+
}
|
|
117454
|
+
blocks = filteredBlocks;
|
|
117455
|
+
logger.info(`Building ${blocks.length} specified block(s): ${blocks.map((b) => b.name).join(", ")}`);
|
|
117456
|
+
} else {
|
|
117457
|
+
logger.info(`Found ${blocks.length} block(s): ${blocks.map((b) => b.name).join(", ")}`);
|
|
117458
|
+
}
|
|
117441
117459
|
for (let i2 = 0;i2 < blocks.length; i2++) {
|
|
117442
117460
|
const block = blocks[i2];
|
|
117443
117461
|
logger.step(i2 + 1, blocks.length, `Building block: ${block.name}`);
|
|
@@ -117988,10 +118006,63 @@ class BuildTemplatesCommand {
|
|
|
117988
118006
|
return content4.replace(frontmatterRegex, "").trim();
|
|
117989
118007
|
}
|
|
117990
118008
|
}
|
|
118009
|
+
// package.json
|
|
118010
|
+
var package_default = {
|
|
118011
|
+
name: "@wordpress-flow/cli",
|
|
118012
|
+
version: "1.0.4",
|
|
118013
|
+
type: "module",
|
|
118014
|
+
description: "TypeScript-based WordPress block creation system",
|
|
118015
|
+
main: "dist/index.js",
|
|
118016
|
+
bin: {
|
|
118017
|
+
"wordpress-flow": "./dist/index.js"
|
|
118018
|
+
},
|
|
118019
|
+
scripts: {
|
|
118020
|
+
build: "bun build ./src/index.ts --outdir ./dist --target node"
|
|
118021
|
+
},
|
|
118022
|
+
dependencies: {
|
|
118023
|
+
"@babel/core": "^7.28.4",
|
|
118024
|
+
"@babel/preset-react": "^7.27.1",
|
|
118025
|
+
"@mdx-js/mdx": "^3.1.1",
|
|
118026
|
+
"@mdx-js/react": "^3.1.1",
|
|
118027
|
+
"@types/react": "^18.3.24",
|
|
118028
|
+
"@types/wordpress__block-editor": "^11.5.17",
|
|
118029
|
+
"@wordpress/block-editor": "^15.4.0",
|
|
118030
|
+
"@wordpress/block-serialization-default-parser": "^5.33.0",
|
|
118031
|
+
"@wordpress/blocks": "^15.6.0",
|
|
118032
|
+
"@wordpress/element": "^6.33.0",
|
|
118033
|
+
ajv: "^8.17.1",
|
|
118034
|
+
axios: "^1.12.2",
|
|
118035
|
+
chalk: "^4.1.2",
|
|
118036
|
+
chokidar: "^3.5.3",
|
|
118037
|
+
commander: "^11.0.0",
|
|
118038
|
+
dotenv: "^17.2.3",
|
|
118039
|
+
esbuild: "^0.19.0",
|
|
118040
|
+
glob: "^11.0.3",
|
|
118041
|
+
mysql2: "^3.15.2",
|
|
118042
|
+
react: "^18.3.1",
|
|
118043
|
+
"react-dom": "^18.3.1"
|
|
118044
|
+
},
|
|
118045
|
+
devDependencies: {
|
|
118046
|
+
"@types/glob": "^9.0.0",
|
|
118047
|
+
"@types/mysql": "^2.15.27",
|
|
118048
|
+
"@types/node": "^20.0.0",
|
|
118049
|
+
"@wordpress/scripts": "^30.24.0",
|
|
118050
|
+
typescript: "^5.0.0",
|
|
118051
|
+
"webpack-cli": "^6.0.1"
|
|
118052
|
+
},
|
|
118053
|
+
keywords: [
|
|
118054
|
+
"wordpress",
|
|
118055
|
+
"blocks",
|
|
118056
|
+
"cli",
|
|
118057
|
+
"typescript"
|
|
118058
|
+
],
|
|
118059
|
+
author: "Przemysław Krasiński",
|
|
118060
|
+
license: "MIT"
|
|
118061
|
+
};
|
|
117991
118062
|
|
|
117992
118063
|
// src/index.ts
|
|
117993
118064
|
var program2 = new Command;
|
|
117994
|
-
program2.name("wordpress-flow").description("Build WordPress sites with React, TypeScript, and MDX - A content-first development framework").version(
|
|
118065
|
+
program2.name("wordpress-flow").description("Build WordPress sites with React, TypeScript, and MDX - A content-first development framework").version(package_default.version);
|
|
117995
118066
|
program2.option("-v, --verbose", "Enable verbose logging").option("-q, --quiet", "Suppress non-error output").hook("preAction", (thisCommand) => {
|
|
117996
118067
|
const opts = thisCommand.opts();
|
|
117997
118068
|
if (opts.verbose) {
|
|
@@ -118009,7 +118080,7 @@ program2.command("setup").description("Run the configuration wizard").action(asy
|
|
|
118009
118080
|
process.exit(1);
|
|
118010
118081
|
}
|
|
118011
118082
|
});
|
|
118012
|
-
program2.command("build").description("Build WordPress blocks for Gutenberg").option("--blocks-dir <dir>", "Source directory for blocks").option("--output-dir <dir>", "Output directory for built blocks").option("--webpack-config <path>", "Path to webpack config file").option("--watch", "Watch mode for development").action(async (options) => {
|
|
118083
|
+
program2.command("build").description("Build WordPress blocks for Gutenberg").option("--blocks-dir <dir>", "Source directory for blocks").option("--output-dir <dir>", "Output directory for built blocks").option("--webpack-config <path>", "Path to webpack config file").option("--watch", "Watch mode for development").option("-b, --blocks <names...>", "Specific block names to build").action(async (options) => {
|
|
118013
118084
|
try {
|
|
118014
118085
|
await ensureConfiguration();
|
|
118015
118086
|
const command = new BuildCommand;
|
|
@@ -118017,7 +118088,8 @@ program2.command("build").description("Build WordPress blocks for Gutenberg").op
|
|
|
118017
118088
|
blocksDir: options.blocksDir,
|
|
118018
118089
|
outputDir: options.outputDir,
|
|
118019
118090
|
webpackConfig: options.webpackConfig,
|
|
118020
|
-
watch: options.watch || false
|
|
118091
|
+
watch: options.watch || false,
|
|
118092
|
+
blocks: options.blocks
|
|
118021
118093
|
});
|
|
118022
118094
|
logger.info("Build command completed successfully");
|
|
118023
118095
|
} catch (error) {
|