Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm output / logging follow up tasks #829

Open
2 of 8 tasks
wraithgar opened this issue Apr 24, 2024 · 2 comments
Open
2 of 8 tasks

npm output / logging follow up tasks #829

wraithgar opened this issue Apr 24, 2024 · 2 comments

Comments

@wraithgar
Copy link
Member

wraithgar commented Apr 24, 2024

Epic

This is a follow up to #810

Tasks

  1. Bug Priority 2
@wraithgar
Copy link
Member Author

From #810 (comment)

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.

@wraithgar
Copy link
Member Author

From #810 (comment)

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))
  }
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant