npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cspotcode/ansi-to-html

v0.0.2

Published

CLI tool to convert ANSI colored text to an HTML file, with a few extra features to support my team's use-case.

Downloads

10

Readme

ansi-to-html

CLI tool to convert ANSI colored text to an HTML file, with a few extra features to support my team's use-case.

We use it to generate pretty reports of subsets of automated CI tasks. Although CI servers are good at recording and visualizing build logs, sometimes it is helpful to upload the output of a single command separately as a build artifact for easier review.

Features

There are other tools like this one. This tool has a few features they may not have:

  • 277 color themes, so you do not need to specify an array of color values manually.
  • "Open in new tab" link in the HTML, useful when CI systems show the HTML embedded in an iframe and you want to easily pop into a new tab.
  • Link to a specific line in a log, #L123-style like Github. Click any line, JS adds that line-number to the URL, you can copy a link to it.

Usage

❯ ansi-to-html --help
Render ANSI console formatting into HTML

━━━ Usage ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

$ ansi-to-html [input] [output]

━━━ Options ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  --theme #0                Specify color theme by name.  Use --list-themes to see a list of all themes. Themes come from https://windowsterminalthemes.dev/ Default: MonokaiDimmed
  --open-in-new-tab-link    Add a link to the top of the page which will open the same file in a new browser tab.  Useful when you know the report will be rendered in an iframe and you want to offer an easy way to link to it directly.
  --no-per-line-anchors     Add clickable anchors so you can click any line in the file and get a link to that line number.  Useful for sharing a link to a specific line number in the log.
  --list-themes             Lists the names of all themes, then exits.

━━━ Examples ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Render from file to file
  $ ansi-to-html command-log.txt command-log.html

Render from stdin to stdout
  $ complex-command | ansi-to-html > output.html

Examples

Here is the output of git status while I was working on this project:

❯ git -c color.status=always status | ansi-to-html > examples/git-status.html