Registry / devops / sdc-build-wp

sdc-build-wp

JSON →
library5.6.13jsnpmunverified

sdc-build-wp is a custom build process specifically designed for WordPress development, currently at version 5.6.13. It streamlines common development tasks like asset compilation (CSS, JavaScript), offers intelligent caching for faster rebuilds, and provides an interactive watch mode with keyboard controls (e.g., restart, clear cache). The package receives frequent minor updates, often weekly or bi-weekly, indicating active maintenance. It enforces a Node.js runtime of version 22 or higher and integrates PHP code linting (via an upgraded PHP Code Sniffer), differentiating it from generic build tools by its WordPress-centric optimizations and developer experience features like a custom text-based user interface (TUI) for managing the build workflow.

npm install sdc-build-wp
INSTALL
IMPORT
SIG · SDC-BUILD-WP
S
sdc-build-wp
devopsjavascriptv5.6.13
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sdc-build-wp (CLI)
npx sdc-build-wp [args]
import { sdcBuildWp } from 'sdc-build-wp';
This package is primarily a Command Line Interface (CLI) tool. It's intended to be executed via `npx` or a global installation.
index.js (Main Module)
import 'sdc-build-wp/index.js';
require('sdc-build-wp'); // While technically works for CJS, ESM is preferred for modern Node.js environments.
For advanced programmatic scenarios, you can import or require the main `index.js` module directly, though specific exports are not documented for library-style use.
Programmatic Invocation
import { spawn } from 'child_process'; spawn('npx', ['sdc-build-wp', '--watch'], { stdio: 'inherit' });
When integrating `sdc-build-wp` into a larger JavaScript/TypeScript build script, it's common practice to invoke it as a child process using Node.js's `child_process` module.

This quickstart demonstrates how to programmatically install `sdc-build-wp` in a temporary WordPress theme project and then run its `--watch` command for a short period, mimicking a development workflow.

import { spawn } from 'child_process'; import { mkdtempSync, writeFileSync, rmSync, mkdirSync, existsSync } from 'fs'; import path from 'path'; import os from 'os'; import { fileURLToPath } from 'url'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); async function runQuickstart() { const tmpDir = mkdtempSync(path.join(os.tmpdir(), 'sdc-build-wp-quickstart-')); const projectRoot = path.join(tmpDir, 'my-wp-theme'); console.log(`Setting up a dummy WordPress theme in: ${projectRoot}`); mkdirSync(projectRoot, { recursive: true }); writeFileSync(path.join(projectRoot, 'style.css'), '/* Theme Name: My Test Theme */'); writeFileSync(path.join(projectRoot, 'index.php'), '<?php echo "Hello World"; ?>'); mkdirSync(path.join(projectRoot, 'src', 'js'), { recursive: true }); writeFileSync(path.join(projectRoot, 'src', 'js', 'main.js'), 'console.log("Hello from main.js");'); console.log('Installing sdc-build-wp locally...'); const installProcess = spawn('npm', ['install', 'sdc-build-wp'], { cwd: projectRoot, stdio: 'pipe', }); let installOutput = ''; installProcess.stdout.on('data', (data) => { installOutput += data.toString(); }); installProcess.stderr.on('data', (data) => { installOutput += data.toString(); }); await new Promise((resolve, reject) => { installProcess.on('close', (code) => { if (code === 0) { console.log('Installation complete.'); resolve(); } else { console.error(`npm install failed with code ${code}.\nOutput:\n${installOutput}`); reject(new Error('Installation failed')); } }); installProcess.on('error', reject); }); console.log('\nRunning sdc-build-wp --watch (will run for ~15 seconds)'); const buildProcess = spawn(path.join(projectRoot, 'node_modules', '.bin', 'sdc-build-wp'), ['--watch'], { cwd: projectRoot, stdio: 'inherit', env: { ...process.env }, }); console.log('--- CLI Output Start ---'); const timeoutId = setTimeout(() => { console.log('\n--- CLI Output End ---'); console.log('Stopping sdc-build-wp --watch after 15 seconds.'); buildProcess.kill('SIGTERM'); }, 15000); buildProcess.on('close', (code) => { clearTimeout(timeoutId); console.log(`sdc-build-wp process exited with code ${code}.`); try { rmSync(tmpDir, { recursive: true, force: true }); console.log(`Cleaned up temporary directory: ${tmpDir}`); } catch (cleanupErr) { console.error(`Error during cleanup: ${cleanupErr.message}`); } }); buildProcess.on('error', (err) => { clearTimeout(timeoutId); console.error(`Failed to start sdc-build-wp: ${err.message}`); try { if (existsSync(tmpDir)) { rmSync(tmpDir, { recursive: true, force: true }); console.log(`Cleaned up temporary directory: ${tmpDir}`); } } catch (cleanupErr) { console.error(`Error during cleanup: ${cleanupErr.message}`); } process.exit(1); }); } if (import.meta.url === path.join('file://', __filename)) { runQuickstart().catch(error => { console.error('Quickstart failed:', error); process.exit(1); }); }
sdc-build-wp --version
Debug
Known issues
breakingsdc-build-wp now requires Node.js version 22 or higher. Users on older Node.js versions will encounter an engine incompatibility error.
fix
Upgrade your Node.js environment to version 22 or later. Using a Node Version Manager (NVM) is recommended for easy switching.
affects: >=5.6.2
breakingThe package upgraded its internal PHP Code Sniffer dependency to v4. This may introduce breaking changes for existing custom PHP linting rulesets or configurations.
fix
Review your `phpcs.xml` or similar configuration files and update them to be compatible with PHP Code Sniffer v4's syntax and rule changes. Consult the PHP Code Sniffer v4 documentation for migration details.
affects: >=5.6.7
gotchaSpecific fixes related to admin redirects have been implemented. If you're using complex proxy setups or custom WordPress admin configurations, review these changes to ensure compatibility.
fix
Test your WordPress admin area and local development proxy setups after updating to ensure redirects function as expected. Adjust local proxy configurations if issues arise.
affects: >=5.6.12
Errors
Common errors & fixes
sdc-build-wp: command not found
The `sdc-build-wp` executable is not found in the system's PATH. This typically happens if the package is not installed globally or `npx` is not used for execution.
fix
Ensure `sdc-build-wp` is installed either globally (`npm install -g sdc-build-wp`) or within your project's `node_modules`. If local, run it via `npx sdc-build-wp` or specify the full path `./node_modules/.bin/sdc-build-wp`.
Error: Unsupported Node.js version. sdc-build-wp requires Node.js >=22.
The Node.js runtime environment being used is older than the minimum required version (v22).
fix
Upgrade your Node.js version to 22 or newer. Use a Node Version Manager (e.g., `nvm install 22 && nvm use 22`) to manage multiple Node.js versions.
PHP_CodeSniffer error: The "PSR2" coding standard is not installed.
After upgrading `sdc-build-wp` (which includes PHP Code Sniffer v4), your project's PHPCS configuration might reference standards or rules that are no longer available, renamed, or require a different installation path in the new version.
fix
Verify your `phpcs.xml` or similar configuration file. Ensure all referenced coding standards and sniffs are compatible with PHP Code Sniffer v4. You may need to update standard names or install additional sniffs if they are no longer bundled by default.
Upgrade
Version history
5.6.13latest on npm
Audit
Dependencies
noderequiredRuntime environment requirement for executing the build process.
Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources