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

@cfware/nyc

v1.0.1

Published

NYC configurations

Downloads

88

Readme

@cfware/nyc NPM Version

NYC configurations used by my projects.

Usage

Create nyc.config.cjs in your project:

'use strict';

module.exports = require('@cfware/nyc')
  .all()
  .checkCoverage()
  .exclude('build/**');

All instance methods are also exposed static methods which construct a new object and run the method. For example:

const assert = require('assert');
const NYCConfig = require('@cfware/nyc');
const config1 = NYCConfig.all();
const config2 = new NYCConfig().all();

(async () {
  // This will pass
  assert.deepStrictEqual(await config1, await config2);
})();

All methods return this to allow chaining.

new NYCConfig(customSettings = {})

Construct a new instance overwriting some nyc configuration options. No validation is performed. It is not needed to explicitly call the constructor unless:

  • You need to eliminate some default exclude globs.
  • You need to provide options not directly supported by this module.

NYCConfig.defaultExclude

This property is static only, returns a copy of the default exclude list.

This is the nyc default excludes with some additional paths:

  • fixtures/**
  • helpers/**
  • tap-snapshots/**

NYCConfig#all(enable = true)

Enable or disable all. Enabling can cause difficulties in current versions of node.js when the repository contains ES modules which are not ignored.

NYCConfig#checkCoverage(enable = true)

Enable or disable checkCoverage.

NYCConfig#perFile(enable = true)

Enable or disable perFile (only effective if checkCoverage is enabled)

NYCConfig#require(...modules)

Append the require configuration array.

NYCConfig#include(...globs)

Append the include configuration array.

NYCConfig#exclude(...globs)

Append the exclude configuration array.

NYCConfig#excludeNodeModules(enable = true)

Enable or disable excludeNodeModules.

NYCConfig#reporter(...reporters)

Add one or more coverage reporters to run. Note the first call to this function will replace the nyc default.

Defaults

The defaults provided by this module are:

{
  tempDir: 'coverage/.nyc_output',
  require: [],
  include: [],
  exclude: NYCConfig.defaultExclude,
  lines: 100,
  statements: 100,
  functions: 100,
  branches: 100
}

nyc will apply additional defaults for keys not listed here.