Skip to content

Commit 5a3551d

Browse files
Support Node.js args to built-script executor (#92)
## Motivation for the change, related issues When running Playground CLI and php-wasm CLI with the built-script executor, I've wanted to add extra Node.js flags like `--experimental-wasm-jspi`. Prior to this PR, the only way was to hack the executor.ts file, but these changes show up in `git status` and are easy to misplace and lose when switching between branches and pushing and popping from the stash. ## Implementation details This PR adds a `nodeArg` option to our custom `built-script` executor. It is an array and can be specified multiple times to add multiple args. ## Testing Instructions (or ideally a Blueprint) The built-script executor is only used by Playground CLI and php-wasm CLI. Let's test both. Run the following command: ``` npx nx start php-wasm-cli --nodeArg='--cpu-prof' --nodeArg='--trace-promises' -r 'phpinfo();' ``` - Confirm you see promise tracing in the output - Confirm the command created a file ending in `.cpuprofile` Run `npx nx start playground-cli server` to confirm it is still working.
1 parent 9ff293b commit 5a3551d

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

packages/nx-extensions/src/executors/built-script/executor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const dirname = __dirname;
77

88
export default async function runExecutor(options: BuiltScriptExecutorSchema) {
99
const args = [
10+
...(options.nodeArg || []),
1011
'--loader',
1112
join(dirname, 'loader.mjs'),
1213
options.scriptPath,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export interface BuiltScriptExecutorSchema {
22
scriptPath: string;
3+
nodeArg?: string[];
34
__unparsed__: string;
45
} // eslint-disable-line

packages/nx-extensions/src/executors/built-script/schema.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@
88
"scriptPath": {
99
"type": "string",
1010
"description": "Path of the script to run.",
11-
"x-prompt": "What script would you like to run?"
11+
"x-prompt": "What script would you like to run?",
12+
"required": true
13+
},
14+
"nodeArg": {
15+
"type": "array",
16+
"items": {
17+
"type": "string",
18+
"description": "Arguments to pass to the node command."
19+
}
1220
},
1321
"__unparsed__": {
1422
"hidden": true,

0 commit comments

Comments
 (0)