This guide covers how to set up the plugin for local development and build it from source.
- PHP 7.4+ and Composer — for PHP dependencies (managed with Strauss for namespace prefixing).
- Bun — for JavaScript dependencies and build scripts. This project has migrated from npm to Bun.
- A GitHub Personal Access Token — required to install the
@stellarwp-scoped package, which is hosted on GitHub Packages rather than the public npm registry.
The @stellarwp scope resolves to GitHub Packages (npm.pkg.github.com), which requires authentication. See bunfig.toml for the scope configuration.
-
Create a classic Personal Access Token at https://github.com/settings/tokens/new with the
read:packagesscope. -
Create a
.envfile in the root of the plugin and add your token:BUN_AUTH_TOKEN=your_token_here GITHUB_TOKEN=your_token_hereBun reads
BUN_AUTH_TOKENfrom this.envfile when authenticating to the@stellarwpregistry.GITHUB_TOKEN(the same token works) authenticates thegithub:stellarwp/...tarball fetches for the@kadence/*packages — without it those downloads hit GitHub's unauthenticated rate limit and fail with 504s. Do not commit.env.
composer installThis installs Composer packages and runs the Strauss post-install steps that prefix vendor namespaces into vendor/vendor-prefixed/.
Note: Never edit files in
vendor/vendor-prefixed/directly — they are regenerated on everycomposer install.
Migrating from a previous npm build? If you've built this plugin with npm before, delete the existing
node_modulesdirectory first so Bun installs cleanly:rm -rf node_modules
bun installThe postinstall step builds the @kadence/* packages (helpers, icons, components) automatically.
Why this build step exists: The
@kadence/*packages are pulled directly from GitHub (see thegithub:stellarwp/...entries inpackage.json), and those repos ship source only — not the compileddist/output that Kadence Blocks imports. So after install they must be transpiled with Babel. Thebuild:packagesscript does this, but only for packages whosedist/cjs/index.jsis missing (already-built packages are skipped).The script uses
npm install --omit=prodrather thanbun installfor this one step on purpose:@kadence/helpersdeclares@kadence/iconsas a production git dependency, and a full install would try to git-clone it (which fails / rate-limits in CI).--omit=prodinstalls only the Babel devDependencies needed to transpile and skips that git dependency entirely.
For active development (webpack watch + gulp watch, run concurrently):
bun run startFor a one-off production build:
bun run build| Command | Description |
|---|---|
bun run start |
Watch mode — rebuilds JS/CSS on change |
bun run build |
Production build (wp-scripts build + gulp build) |
bun run build-wp |
Webpack build only |
bun run build-gulp |
Gulp build only (legacy JS/CSS) |
bun run lint-js |
Lint JavaScript |
bun run lint-js-fix |
Lint and auto-fix JavaScript |
bun run format |
Format source files |
composer lint |
PHP CodeSniffer |
composer phpstan |
PHP static analysis |
401 Unauthorizedonbun install— yourBUN_AUTH_TOKENis missing, expired, or lacks theread:packagesscope. Confirm.envexists in the plugin root and the token is valid.@kadence/*imports fail during the build — re-runbun installso thepostinstallstep rebuilds the local packages, and verify thenode_modules/@kadence/*directories were fetched.