Skip to content

Add scaffold:vip command for VIP repo overlay#322

Open
fabiankaegy wants to merge 2 commits intotrunkfrom
feature/scaffold-vip-overlay
Open

Add scaffold:vip command for VIP repo overlay#322
fabiankaegy wants to merge 2 commits intotrunkfrom
feature/scaffold-vip-overlay

Conversation

@fabiankaegy
Copy link
Copy Markdown
Member

@fabiankaegy fabiankaegy commented Mar 25, 2026

Summary

  • Adds npm run scaffold:vip -- --target <path> command that overlays the 10up scaffold onto an existing WordPress VIP repo
  • Intelligently merges configs (composer.json, .gitignore, .editorconfig, phpcs.xml, .deployignore) while preserving VIP-specific files (vip-config, .devcontainer, .wpvip, etc.)
  • Extracts buildReplacementMap() into scaffold-helpers.mjs so replacement logic is shared between scaffold.mjs and the new scaffold-vip.mjs

What the command does

  1. Copies 10up theme, plugin, tooling configs, CI workflows, and scaffold scripts to the target VIP repo
  2. Preserves VIP-specific files (vip-config/, .deployignore, .devcontainer/, .wpvip/, images/, private/, languages/)
  3. Merges composer.json (combines both dev deps, removes VIP-provided debug plugins, uses GPL license)
  4. Merges phpcs.xml with both WordPress-VIP-Go and 10up-Default rulesets
  5. Integrates plugin loader into VIP's plugin-loader.php
  6. Runs string replacements and directory renames for the project name
  7. Supports all existing flags: --fueled, --ignite, --self-destruct, theme/plugin overrides

Test plan

  • Copy a fresh VIP skeleton to a temp dir and run npm run scaffold:vip -- --target /tmp/test -n "Test Project" -t block -y
  • Verify VIP files preserved: vip-config/, .deployignore, .devcontainer/, .wpvip/
  • Verify 10up files added: theme, plugin in client-mu-plugins/, .eslintrc, phpstan, CI workflows
  • Verify merged configs: composer.json has both dep sets, phpcs.xml has both rulesets, .gitignore tracks package.json
  • Verify string replacements: no remaining 10up-plugin/TenUpPlugin strings outside scaffold scripts
  • Test with --theme classic for classic theme variant
  • Verify existing npm run scaffold still works (refactored to use shared buildReplacementMap)

fabiankaegy and others added 2 commits March 2, 2026 22:25
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>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.mjs and update bin/scaffold.mjs to 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 }) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@pdavies88
Copy link
Copy Markdown
Contributor

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants