Closed gunnx closed 7 years ago
Sounds good to me! Open to a pull request to iterate on 👍
@kentcdodds Looking at the code I see that you can pass a color property to your script, but it doesn't look like it works when using concurrent.nps I have the following setup:
default: {
default: {
description: 'Run client and server in watch mode',
script: npsUtils.concurrent.nps('default.server', 'default.client')
},
client: {
description: 'Run client in watch mode',
script: 'npm --prefix client start'
},
server: {
description: 'Run server in watch mode',
script: 'npm --prefix server start'
}
}
I thought it I added color property to the client and server script objects that it would be picked up but thats not the case.
What does work is using just concurrent
e.g.
script: npsUtils.concurrent({
server: {
script: 'npm start default.server',
color: 'bgBlue.white.bold'
} ,
client: 'npm start default.client'
})
Though this feels a bit more verbose as I already have those scripts defined and some of them I would want to call individually anyway.
Looking at the source code line 156. function mapNPSScripts(scriptName, index) {}
That seems to be where the color is being pulled from this default array of colors.
So any suggestions? The issue is nps-utils is not aware of your entire package-scripts only whats passed in (by design of course)
I see two obvious options:
Just allow a setter for the colours
npsUtils.setDefaultColours([
'white.bgBlue.bold',
'white.bgMagenta.bold',
'black.bgGreen.bold',
'white.bgBlack.bold'
]);
Allow color to be passed into concurrent.nps() per script, most likely an object similar to what is passed into concurrent though I feel you could just use that instead.
Depending on if you use a custom shell, the default colours set in nps-utils are not always suitable, so it would be good if you can set your own default colours in nps-utils