Add ability to pass additional parameters to nx:run-script #23408
rommy1204
started this conversation in
Feature Requests
Replies: 1 comment
-
I've converted this to a discussion to make it easier to discuss. I'm not sure if this is still necessary. Would If your libs each have Do you think we still need this feature? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Let's say, within the recommended project structure:
--- main app
--- another app
--- one lib
--- another lib
--- third lib
And you use some testing tool and have a command to run it in every lib's package.json. This tool is designed in such a way, that it requires a testing suite to be passed explicitly.
It leads to overloading package.json with scripts like:
test:lib:1: ''npm run my-testing-tool --test-suite lib1"
test:lib:3: ''npm run my-testing-tool --test-suite lib2"
test:lib:2: ''npm run my-testing-tool --test-suite lib3"
Therefore, to move it to the NX level you need to have a target in every lib that points to a particular script:
"build": {
"executor": "nx:run-script",
"options": {
"script": "test:lib:1"
}
}
Everything seems to be fine, but package.json has redundant commands due to that, especially, if the number of libs is big and growing
My proposal is to pass additional parameters to nx:run-script to offload package.json and make this type of target more flexible. That would look that way:
package.json has only one script:
test:lib: "npm run my-testing-tool"
project.json of every lib still has a target, but now it can be customized:
"build": {
"executor": "nx:run-script",
"options": {
"script": "test:lib",
"additionalParameters": "--test-suite lib1"
}
}
Beta Was this translation helpful? Give feedback.
All reactions