You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.command('server','Start a local WordPress server')
92
-
.command(
93
-
'run-blueprint',
94
-
'Execute a Blueprint without starting a server'
95
-
)
96
-
.command(
97
-
'build-snapshot',
98
-
'Build a ZIP snapshot of a WordPress site based on a Blueprint'
99
-
)
100
-
.demandCommand(1,'Please specify a command')
101
-
.strictCommands()
102
-
.option('outfile',{
103
-
describe: 'When building, write to this output file.',
104
-
type: 'string',
105
-
default: 'wordpress.zip',
106
-
})
107
-
.option('port',{
108
-
describe: 'Port to listen on when serving.',
109
-
type: 'number',
110
-
default: 9400,
111
-
})
112
-
.option('site-url',{
89
+
constsharedOptions: Record<string,YargsOptions>={
90
+
'site-url': {
113
91
describe:
114
92
'Site URL to use for WordPress. Defaults to http://127.0.0.1:{port}',
115
93
type: 'string',
116
-
})
117
-
.option('php',{
94
+
},
95
+
php:{
118
96
describe: 'PHP version to use.',
119
97
type: 'string',
120
98
default: RecommendedPHPVersion,
121
99
choices: SupportedPHPVersions,
122
-
})
123
-
.option('wp',{
100
+
},
101
+
wp:{
124
102
describe: 'WordPress version to use.',
125
103
type: 'string',
126
104
default: 'latest',
127
-
})
105
+
},
128
106
// @TODO: Support read-only mounts, e.g. via WORKERFS, a custom
129
107
// ReadOnlyNODEFS, or by copying the files into MEMFS
130
-
.option('mount',{
108
+
mount:{
131
109
describe:
132
110
'Mount a directory to the PHP runtime (can be used multiple times). Format: /host/path:/vfs/path',
133
111
type: 'array',
134
112
string: true,
135
113
coerce: parseMountWithDelimiterArguments,
136
-
})
137
-
.option('mount-before-install',{
114
+
},
115
+
'mount-before-install':{
138
116
describe:
139
117
'Mount a directory to the PHP runtime before WordPress installation (can be used multiple times). Format: /host/path:/vfs/path',
140
118
type: 'array',
141
119
string: true,
142
120
coerce: parseMountWithDelimiterArguments,
143
-
})
144
-
.option('mount-dir',{
121
+
},
122
+
'mount-dir':{
145
123
describe:
146
124
'Mount a directory to the PHP runtime (can be used multiple times). Format: "/host/path" "/vfs/path"',
147
125
type: 'array',
148
126
nargs: 2,
149
127
array: true,
150
128
coerce: parseMountDirArguments,
151
-
})
152
-
.option('mount-dir-before-install',{
129
+
},
130
+
'mount-dir-before-install':{
153
131
describe:
154
132
'Mount a directory before WordPress installation (can be used multiple times). Format: "/host/path" "/vfs/path"',
155
133
type: 'string',
156
134
nargs: 2,
157
135
array: true,
158
136
coerce: parseMountDirArguments,
159
-
})
160
-
.option('login',{
137
+
},
138
+
login:{
161
139
describe: 'Should log the user in',
162
140
type: 'boolean',
163
141
default: false,
164
-
})
165
-
.option('blueprint',{
142
+
},
143
+
blueprint:{
166
144
describe: 'Blueprint to execute.',
167
145
type: 'string',
168
-
})
169
-
.option('blueprint-may-read-adjacent-files',{
146
+
},
147
+
'blueprint-may-read-adjacent-files':{
170
148
describe:
171
149
'Consent flag: Allow "bundled" resources in a local blueprint to read files in the same directory as the blueprint file.',
172
150
type: 'boolean',
173
151
default: false,
174
-
})
175
-
.option('wordpress-install-mode',{
152
+
},
153
+
'wordpress-install-mode':{
176
154
describe:
177
155
'Control how Playground prepares WordPress before booting.',
178
156
type: 'string',
@@ -183,71 +161,71 @@ export async function parseOptionsAndRunCLI(argsToParse: string[]) {
183
161
'install-from-existing-files-if-needed',
184
162
'do-not-attempt-installing',
185
163
]asconst,
186
-
})
187
-
.option('skip-wordpress-install',{
164
+
},
165
+
'skip-wordpress-install':{
188
166
describe: '[Deprecated] Use --wordpress-install-mode instead.',
189
167
type: 'boolean',
190
168
hidden: true,
191
-
})
192
-
.option('skip-sqlite-setup',{
169
+
},
170
+
'skip-sqlite-setup':{
193
171
describe:
194
172
'Skip the SQLite integration plugin setup to allow the WordPress site to use MySQL.',
195
173
type: 'boolean',
196
174
default: false,
197
-
})
175
+
},
198
176
// Hidden - Deprecated in favor of verbosity
199
-
.option('quiet',{
177
+
quiet:{
200
178
describe: 'Do not output logs and progress messages.',
201
179
type: 'boolean',
202
180
default: false,
203
181
hidden: true,
204
-
})
205
-
.option('verbosity',{
182
+
},
183
+
verbosity:{
206
184
describe: 'Output logs and progress messages.',
207
185
type: 'string',
208
186
choices: Object.values(LogVerbosity).map(
209
187
(verbosity)=>verbosity.name
210
188
),
211
189
default: 'normal',
212
-
})
213
-
.option('debug',{
190
+
},
191
+
debug:{
214
192
describe:
215
193
'Print PHP error log content if an error occurs during Playground boot.',
216
194
type: 'boolean',
217
195
default: false,
218
-
})
219
-
.option('auto-mount',{
196
+
},
197
+
'auto-mount':{
220
198
describe: `Automatically mount the specified directory. If no path is provided, mount the current working directory. You can mount a WordPress directory, a plugin directory, a theme directory, a wp-content directory, or any directory containing PHP and HTML files.`,
221
199
type: 'string',
222
-
})
223
-
.option('follow-symlinks',{
200
+
},
201
+
'follow-symlinks':{
224
202
describe:
225
203
'Allow Playground to follow symlinks by automatically mounting symlinked directories and files encountered in mounted directories. \nWarning: Following symlinks will expose files outside mounted directories to Playground and could be a security risk.',
226
204
type: 'boolean',
227
205
default: false,
228
-
})
229
-
.option('experimental-trace',{
206
+
},
207
+
'experimental-trace':{
230
208
describe:
231
209
'Print detailed messages about system behavior to the console. Useful for troubleshooting.',
232
210
type: 'boolean',
233
211
default: false,
234
212
// Hide this option because we want to replace with a more general log-level flag.
235
213
hidden: true,
236
-
})
237
-
.option('internal-cookie-store',{
214
+
},
215
+
'internal-cookie-store':{
238
216
describe:
239
217
'Enable internal cookie handling. When enabled, Playground will manage cookies internally using '+
240
218
'an HttpCookieStore that persists cookies across requests. When disabled, cookies are handled '+
241
219
'externally (e.g., by a browser in Node.js environments).',
242
220
type: 'boolean',
243
221
default: false,
244
-
})
245
-
.option('xdebug',{
222
+
},
223
+
xdebug:{
246
224
describe: 'Enable Xdebug.',
247
225
type: 'boolean',
248
226
default: false,
249
-
})
250
-
.option('experimental-unsafe-ide-integration',{
227
+
},
228
+
'experimental-unsafe-ide-integration':{
251
229
describe:
252
230
'Enable experimental IDE development tools. This option edits IDE config files '+
253
231
'to set Xdebug path mappings and web server details. CAUTION: If there are bugs, '+
@@ -260,39 +238,85 @@ export async function parseOptionsAndRunCLI(argsToParse: string[]) {
260
238
choices: ['','vscode','phpstorm'],
261
239
coerce: (value?: string)=>
262
240
value==='' ? ['vscode','phpstorm'] : [value],
263
-
})
264
-
.option('experimental-devtools',{
265
-
describe: 'Enable experimental browser development tools.',
266
-
type: 'boolean',
267
-
})
268
-
.conflicts(
269
-
'experimental-unsafe-ide-integration',
270
-
'experimental-devtools'
271
-
)
272
-
.option('experimental-multi-worker',{
273
-
describe:
274
-
'Enable experimental multi-worker support which requires '+
275
-
'a /wordpress directory backed by a real filesystem. '+
276
-
'Pass a positive number to specify the number of workers to use. '+
277
-
'Otherwise, default to the number of CPUs minus 1.',
278
-
type: 'number',
279
-
coerce: (value?: number)=>value??cpus().length-1,
280
-
})
281
-
.option('experimental-blueprints-v2-runner',{
241
+
},
242
+
'experimental-blueprints-v2-runner': {
282
243
describe: 'Use the experimental Blueprint V2 runner.',
283
244
type: 'boolean',
284
245
default: false,
285
246
// Remove the "hidden" flag once Blueprint V2 is fully supported
286
247
hidden: true,
287
-
})
288
-
.option('mode',{
248
+
},
249
+
mode:{
289
250
describe:
290
251
'Blueprints v2 runner mode to use. This option is required when using the --experimental-blueprints-v2-runner flag with a blueprint.',
0 commit comments