statusboard
statusboard copied to clipboard
npm output / logging follow up tasks
Epic
This is a follow up to https://github.com/npm/statusboard/issues/810
### Tasks
- [x] push out user input (proc-log.read) to dependencies
- [x] spike on what an "npm is doing something" output should look like
- [ ] rethink how the logger displays content to the end user (i.e. when to show the label)
- [ ] exit-handler (log.error(...errline)) gets logged without log prefixes
- [ ] Color templating by internal names and not color names
- [ ] Consider no logging headers if log level is default (part of logger display rethink)
- [ ] Remove the rest of tabular output? Internal "column output" library?
- [ ] https://github.com/npm/cli/issues/7583
From https://github.com/npm/statusboard/issues/810#issuecomment-2053716694
Customizable colors
npmlog
used to be in charge of colors which we set once at runtime. The Display
class now generate a color palette on load
which takes configured options.
Our goal is to have one (1) good and accessible color palette for all output shown to the terminal. BUT if we find cases where that is impossible (eg dark vs light terminal backgrounds) it is now at least possible to have a config option to change colors.
From https://github.com/npm/statusboard/issues/810#issuecomment-2053754417
Command templates
What if a command could do this?
// producer
const data = { name, version }
output.standard(data, {
templates: {
// pick any templating DSL
human: `{{ name }}@{{ version }}`,
parseable: `{{ name }}\t{{ version }}`
}
})
// consumer
process.on('output', (level, data, { templates }) => {
if (level === 'standard') {
const templateName = templates[this.human ? 'human' : this.parseable : 'parseable' : '']
process.stdout.write(template(data, templateName || JSON.stringify))
}
})