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

@ollelauribostrom/hindex

v2.0.3

Published

Wrap your reports in an index.html file with a single command

Downloads

11

Readme

hindex 🗂

Build Status Coverage Status Known Vulnerabilities npm version

Wrap your reports in an index.html file with a single command using hindex. Subfolders containing different reports (with an index.html file) can quickly be linked together. Have a look at an example of how hindex was used to wrap and present reports during a Google Summer of Code project at Mozilla.

Installation

yarn add hindex or
yarn global add hindex or
npm install hindex or
npm install hindex -g

Configuration

Before you can use hindex, you need to create a configuration file called hindex.config.json. The following options are available.

| Option | Description | Type | Default | | ------------------|-------------------------------------------------------| ---------|--------------------| | baseDir | The folder containing the subfolders you want to wrap | String | process.cwd() | | exclude | Array of subfolder you want to exclude when wrapping | Array | ['.git'] | | categories | Array of categories to create | Array | [] | | title | The title used in the generated index.html | String | 'hindex' | | categoryPrefix | Category name prefix to remove | String | '' | | categoryPostfix | Category name postfix to remove | String | '' | | hideCategoryNames | Remove category names in the generated index.html | Boolean | false |

Example hindex.config.json

{
  "baseDir": "./reports",
  "exclude": ["some-folder", ".git"],
  "categories": ["coverage"],
  "title": "Coverage reports",
  "categoryPostfix": "-",
  "hideCategoryNames": true
}

Usage

NOTE: Make sure you have created a configuration file called hindex.config.json.

From the command line

A global installation of hindex can be used directly from the command line.

# Generate index.html wrapper
hindex

# Specify a custom path to your hindex config
hindex -c=./config/hindex.config.json
hindex --config=./config/hindex.config.json

# Run in debug mode
hindex -d
hindex --debug

# Print version
hindex -v
hindex --version

From your package.json

A local installation of hindex can be used from your project's package.json.

"scripts": {
  "hindex": "hindex"
},
yarn hindex

From your code

It's also possible to import hindex in your code. The hindex function takes an optional object with the properties described in the Configuration section

import hindex from '@ollelauribostrom/hindex';

const config = {
  baseDir: '/reports'
  title: 'Reports',
  categories: ['coverage', 'webpack']
};

const result = hindex(config);
// result.dir => reports
// result.index => file:///some/path/reports/index.html

Example

This package was originally created to quickly be able to wrap and present different reports that where generated during my Google Summer of Code project at Mozilla.

Report folder structure

├── .git
├── coverage-2018-05-12
    ├── index.html
├── mutation-2018-05-14
    ├── index.html
├── webpack-stats-2018-05-31
    ├── index.html
├── hindex.config.json
├── package.json

Setup

package.json

"scripts": {
  "hindex": "hindex"
},
...

hindex.config.json

{
  "exclude": [".git"],
  "categories": ["coverage", "mutation", "webpack-stats"],
  "title": "Reports"
}

Wrapping

Each time a new report folder was added, a new wrapping index.html could quickly be generated.

yarn hindex

Result

Live example Example

Running your own local development copy

# Install dependencies
yarn

# Create a symbolic link
yarn link

# Start babel in watch mode
yarn start

# Run your development copy
hindex

Running the tests

yarn test
yarn coverage
yarn lint

Contributing

All contributions are very much welcome. Please get familiar with the contributing guide.

Support

Please open an issue for support.

License

MIT