Add scaffold:vip command for VIP repo overlay#322
Conversation
Adds --fueled, --ignite, and --skip-ignite flags with interactive prompts so new projects can install Ignite WP plugins after scaffolding. Fueled/10up projects default to Ignite installation. The Ignite CLI runs with stdio: inherit so its own interactive plugin selection works. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New CLI command that takes a --target path to an existing WordPress VIP repo and overlays the 10up scaffold onto it, intelligently merging configs while preserving VIP-specific files (vip-config, .deployignore, .devcontainer, .wpvip, etc.). Also extracts buildReplacementMap() into scaffold-helpers.mjs so the replacement logic is shared between scaffold.mjs and scaffold-vip.mjs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a new scaffold:vip command to overlay the 10up wp-scaffold onto an existing WordPress VIP repository, and refactors replacement logic into a shared helper so both scaffold flows use the same mapping behavior.
Changes:
- Add
npm run scaffold:vip -- --target <path>entrypoint and implement VIP overlay scaffolding script. - Extract replacement-map construction into
bin/scaffold-helpers.mjsand updatebin/scaffold.mjsto use it. - Add Fueled/Ignite flags and optional Ignite installation flow to the scaffold commands.
Reviewed changes
Copilot reviewed 1 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| package.json | Adds the new scaffold:vip npm script. |
| bin/scaffold.mjs | Adds Fueled/Ignite flags + optional Ignite install and switches to shared buildReplacementMap(). |
| bin/scaffold-vip.mjs | New VIP overlay implementation: copy/merge steps, replacements, renames, optional self-destruct. |
| bin/scaffold-helpers.mjs | Updates walkFiles() signature and adds shared buildReplacementMap(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * @param {string} options.slug - The project slug (kebab-case) | ||
| * @returns {Array<[string, string]>} Sorted replacement pairs (longest first) | ||
| */ | ||
| export function buildReplacementMap({ isBlock, isVip, values, slug }) { |
There was a problem hiding this comment.
@fabiankaegy Is this starting to be too many parameters? maybe we switch to an array so it can grow over time.
| // --------------------------------------------------------------------------- | ||
|
|
||
| /** | ||
| * Build the replacement map for project scaffold. |
There was a problem hiding this comment.
@fabiankaegy I already created an issue for it but looking through this list emphasis that we need to go through every string and condense and simplify. Some of these replacements are a simple captalization difference. Super annoying to have to find an account for all of those.
| Ignite: | ||
| --fueled Mark as a Fueled/10up project (defaults to block theme + Ignite) | ||
| --ignite Install Ignite WP plugins after scaffolding | ||
| --skip-ignite Skip Ignite installation (useful with --fueled) |
There was a problem hiding this comment.
@fabiankaegy This feels confusing. Not sure of the solution. I understand we want to push ignite hard but maybe --fueled and --ignite need to be there own commands so you dont have to do something like --fueled --skip-ignite . Maybe I also blowing this out of propoertion and 99% of the time we use ignite and it doesnt matter.
There was a problem hiding this comment.
Pretty sure this is for the CLI options so that we can skip if we want example:
> node bin/scaffold-vip.mjs --target /Users/preston10up/Local Sites/dhcs2/app/public/wp-content/
WordPress VIP Overlay Scaffold
Warning: Target repo has uncommitted changes.
Consider committing first so the overlay can be reviewed as a single diff.
✔ Which theme type would you like to use? Classic Theme
✔ Is this a Fueled / 10up project? Yes
Note: Block themes are recommended for Fueled/10up projects.
✔ Install Ignite WP plugins? (Recommended for Fueled/10up projects) No
✔ Project name (human-readable, e.g. "Acme Corp"): DHCS
| "scaffold": "node bin/scaffold.mjs", | ||
| "scaffold:plugin": "node bin/scaffold-plugin.mjs" | ||
| "scaffold:plugin": "node bin/scaffold-plugin.mjs", | ||
| "scaffold:vip": "node bin/scaffold-vip.mjs" |
There was a problem hiding this comment.
@fabiankaegy Would be interesting to see if other hosting providers need this sort of special treatment with repo structure and also match up to the ci-library on how they get deployed. I know we have a few specific hosts called out in that project.
There was a problem hiding this comment.
The other two which I see a lot are WP Engine and Pantheon not sure if those give starter builds and then pass them off without running scaffold first. I think we could do these if we needed in a separate PR to keep this one focused on VIP
|
@fabiankaegy just tried this on an init commit of a recent VIP repo and worked perfect: https://github.com/wpcomvip/dhcs-ca-gov/commit/8bccf5f935420854f79fff6d04ba370e87df6aaa |
Summary
npm run scaffold:vip -- --target <path>command that overlays the 10up scaffold onto an existing WordPress VIP repobuildReplacementMap()intoscaffold-helpers.mjsso replacement logic is shared betweenscaffold.mjsand the newscaffold-vip.mjsWhat the command does
Test plan
npm run scaffold:vip -- --target /tmp/test -n "Test Project" -t block -y10up-plugin/TenUpPluginstrings outside scaffold scripts--theme classicfor classic theme variantnpm run scaffoldstill works (refactored to use sharedbuildReplacementMap)