Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8af3121
Add hidden `mode` option for Blueprints v2
brandonpayton Aug 15, 2025
7f84ddb
Set Blueprints v2 execution mode for expanded auto-mount
brandonpayton Aug 15, 2025
b2552a9
Support providing a path to auto-mount option
brandonpayton Aug 15, 2025
2745d51
Default auto-mount path within runCLI so we can test the default
brandonpayton Aug 16, 2025
dc0ec11
Move unrelated test out of the autoMount tests
brandonpayton Aug 16, 2025
1bec019
Add broken WIP run-cli tests for Blueprints v2
brandonpayton Aug 16, 2025
bb7dd05
Fix auto-mounting themes while using the Blueprints v2 runner
brandonpayton Aug 16, 2025
06781f2
Fix experimental-multi-worker option description
brandonpayton Aug 16, 2025
9af22e4
Fix run-cli tests that depend on default WordPress Site title
brandonpayton Aug 16, 2025
d173786
Revert "Default auto-mount path within runCLI so we can test the defa…
brandonpayton Aug 18, 2025
83e072d
Revert "Support providing a path to auto-mount option"
brandonpayton Aug 18, 2025
305d91d
Restore boolean autoMount arg in tests
brandonpayton Aug 18, 2025
40e05b7
Import proper types for CLI tests
brandonpayton Aug 19, 2025
8eef03f
Skip broken run-cli tests for Blueprints v2
brandonpayton Aug 19, 2025
fcceb0b
Prevent --mode from being used with --auto-mount
brandonpayton Aug 19, 2025
c677778
Add another validation warning about the --mode option
brandonpayton Aug 19, 2025
ff374b2
Add --mode tests
brandonpayton Aug 19, 2025
080f5f9
Recognize --skip-wordpress-setup and --skip-sqlite-setup options
adamziel Aug 26, 2025
2169d8e
Resolve merge conflicts in packages/playground/cli/tests/run-cli.spec.ts
adamziel Aug 26, 2025
1a90cc6
Resolve conflicts in the unit tests
adamziel Aug 26, 2025
096b25f
Merge branch 'trunk' into playground-cli-auto-select-blueprint-v2-model
adamziel Aug 26, 2025
27e5cb6
Adjust unit tests setup to pass verbosity test with Blueprints v2
adamziel Aug 26, 2025
63ef1e3
Skip the failing verbosity test
adamziel Aug 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions packages/playground/cli/src/mounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,17 @@ export function expandAutoMounts(args: RunCLIArgs): RunCLIArgs {
hostPath: path,
vfsPath: `/wordpress/wp-content/themes/${themeName}`,
});
newArgs['additional-blueprint-steps'].push({
step: 'activateTheme',
themeFolderName: themeName,
});
newArgs['additional-blueprint-steps'].push(
args['experimental-blueprints-v2-runner']
? {
step: 'activateTheme',
themeDirectoryName: themeName,
}
: {
step: 'activateTheme',
themeFolderName: themeName,
}
);
} else if (containsWpContentDirectories(path)) {
/**
* Mount each wp-content file and directory individually.
Expand All @@ -167,17 +174,17 @@ export function expandAutoMounts(args: RunCLIArgs): RunCLIArgs {
newArgs['additional-blueprint-steps'].push(ACTIVATE_FIRST_THEME_STEP);
} else if (containsFullWordPressInstallation(path)) {
mountBeforeInstall.push({ hostPath: path, vfsPath: '/wordpress' });
// @TODO: Uncomment when merging Blueprints v2 support
// newArgs.mode = 'apply-to-existing-site';
// @TODO: If overriding another mode, throw an error or print a warning.
newArgs.mode = 'apply-to-existing-site';
newArgs['additional-blueprint-steps'].push(ACTIVATE_FIRST_THEME_STEP);
} else {
/**
* By default, mount the current working directory as the Playground root.
* This allows users to run and PHP or HTML files using the Playground CLI.
*/
mount.push({ hostPath: path, vfsPath: '/wordpress' });
// @TODO: Uncomment when merging Blueprints v2 support
// newArgs.mode = 'mount-only';
// @TODO: If overriding another mode, throw an error or print a warning.
newArgs.mode = 'mount-only';
}

return newArgs as RunCLIArgs;
Expand Down
64 changes: 60 additions & 4 deletions packages/playground/cli/src/run-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,10 @@ export async function parseOptionsAndRunCLI() {
type: 'boolean',
default: false,
})
// TODO: Should we make this a hidden flag?
.option('experimental-multi-worker', {
describe:
'Enable experimental multi-worker support which requires JSPI ' +
'and a /wordpress directory backed by a real filesystem. ' +
'Enable experimental multi-worker support which requires ' +
'a /wordpress directory backed by a real filesystem. ' +
'Pass a positive number to specify the number of workers to use. ' +
'Otherwise, default to the number of CPUs minus 1.',
type: 'number',
Expand All @@ -224,6 +223,14 @@ export async function parseOptionsAndRunCLI() {
// Remove the "hidden" flag once Blueprint V2 is fully supported
hidden: true,
})
.option('mode', {
describe:
'Blueprints v2 runner mode to use. This option is required when using the --experimental-blueprints-v2-runner flag with a blueprint.',
type: 'string',
choices: ['create-new-site', 'apply-to-existing-site'],
// Remove the "hidden" flag once Blueprint V2 is fully supported
hidden: true,
})
.showHelpOnFail(false)
.strictOptions()
.check(async (args) => {
Expand Down Expand Up @@ -275,6 +282,53 @@ export async function parseOptionsAndRunCLI() {
);
}
}

if (args['experimental-blueprints-v2-runner'] === true) {
if (args['mode'] !== undefined) {
if ('skip-wordpress-setup' in args) {
throw new Error(
'The --skipWordPressSetup option cannot be used with the --mode option. Use one or the other.'
);
}
if ('skip-sqlite-setup' in args) {
throw new Error(
'The --skipSqliteSetup option is not supported in Blueprint V2 mode.'
);
}
if (args['auto-mount'] !== undefined) {
throw new Error(
'The --mode option cannot be used with --auto-mount because --auto-mount automatically sets the mode.'
);
}
} else {
// Support the legacy v1 runner options
if (args['skip-wordpress-setup'] === true) {
args['mode'] = 'apply-to-existing-site';
} else {
args['mode'] = 'create-new-site';
}
}

// Support the legacy v1 runner options
const allow = (args['allow'] as string[]) || [];

if (args['followSymlinks'] === true) {
allow.push('follow-symlinks');
}

if (args['blueprint-may-read-adjacent-files'] === true) {
allow.push('read-local-fs');
}

args['allow'] = allow;
} else {
if (args['mode'] !== undefined) {
throw new Error(
'The --mode option requires the --experimentalBlueprintsV2Runner flag.'
);
}
}

return true;
});

Expand Down Expand Up @@ -350,8 +404,10 @@ export interface RunCLIArgs {
followSymlinks?: boolean;
'blueprint-may-read-adjacent-files'?: boolean;

// --------- Blueprint V2 args (not available via CLI yet) -----------
// --------- Blueprint V2 args -----------
mode?: 'mount-only' | 'create-new-site' | 'apply-to-existing-site';

// --------- Blueprint V2 args (not available via CLI yet) -----------
'db-engine'?: 'sqlite' | 'mysql';
'db-host'?: string;
'db-user'?: string;
Expand Down
Loading