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

@jzetlen/zenit

v0.1.0

Published

spy on global javascript

Downloads

4

Readme

Node.JS TypeScript Library Template

This is a template repository meant to be used as a starting point for new Node.JS projects written in TypeScript.

As this is a highly opinionated template, many tools are included and pre-configured with sane and strict defaults to enforce a standard level of code quality and a consistent style across projects.

With this in mind, feel free to edit the various config files to your liking.

Prerequisites

To view static documentation and coverage reports, http-server is recommended; it is included as a development dependency for the serve:* commands, but for manual CLI usage, install it with npm i -g http-server.

Setup

pnpm is used as the package manager; install it with npm i -g pnpm if you do not already have it.

Then, to get started, simply install dependencies with pnpm i.

Building Sources and Documentation

Three npm scripts are provided to build TypeScript sources and generate documentation with TypeDoc:

Viewing Documentation Site

After building the static HTML documentation with build:docs, run pnpm serve:docs or http-server docs and navigate to localhost:8080.

Deploy Documentation On GitHub Pages

To enable GitHub Pages, access the repository settings and configure the Pages settings to use the main (or master) branch and the ./docs folder.

Testing

Testing is done with mocha and chai. nyc is used to generate coverage reports. The following npm scripts are provided:

  • test -- runs mocha on all TypeScript sources
  • test:coverage -- like test but runs nyc to generate an HTML coverage report in /coverage.
  • test:watch -- runs nyc and mocha continuously, re-running tests when any sources change.

Viewing Test Coverage Report

After generating an HTML coverage report with test:coverage, view it by running either serve:coverage or http-server ./coverage and navigating to localhost:8080.

Linting

Linting is provided by ESLint and markdownlint. The following npm scripts are provided:

  • lint:eslint -- runs ESLint on ./package.json and ./src/**/* and prints any errors.

  • lint:markdownlint -- runs markdownlint on README.md and prints any errors.

  • lint:eslint:fix -- like lint:eslint but automatically fixes linter errors where possible.

  • lint:markdownlint:fix -- like lint:markdownlint but automatically fixes linter errors where possible.

  • lint -- runs both lint:eslint and lint:markdownlint.

  • lint:fix -- runs both lint:eslint:fix and lint:markdownlint:fix

ESLint Config & Plugins

A strict ESLint config is provided with many plugins, the full list is below:

Formatting

Prettier is included to automatically format sources to enforce a consistent and standardized code style. It automatically verifies that sources conform to the standard style as part of the Husky pre-commit hook.

Two scripts are provided:

  • format -- runs Prettier and formats files in-place.
  • format:check -- runs Prettier in check mode, reporting any files that do not match the standard style. To fix any reported issues, use the format script.

Husky

Husky hooks are automatically installed when pnpm i is run.

Husky is included and configured with two commit hooks:

Creating A New Project

To start a new project with this repository as a template, clone it and delete the .git folder, then run git init . to start a new git project and commit history.

Then, configure package.json with your project name, description, keywords, repository URL, version number, and any other details you wish to change.

Add code to ./src, and it will be built to ./dist. ./src/index.ts will be built as the project entry point at ./dist/index.js as defined in the manifest.

CI

After each push to the main branch, the CI GitHub Action runs to ensure all checks pass.

Releasing

To release a new version of your package, the release npm script is provided. It does the following:

  • runs pnpm format:check
  • runs pnpm lint
  • runs pnpm test
  • runs pnpm build,
  • runs git add docs
  • Updates the package.json version appropriately based on the commits made since the last release.
  • Updates the CHANGELOG.md.
  • Commits all changes and tags the commit with the new version number.
  • Pushes main with the new tag to origin.
  • Triggers the NPM Publish workflow to automatically publish the new version on the NPM Registry.

Available scripts are:

  • pnpm docs: generate HTML documentation in ./docs
  • test: run mocha on all tests in ./src/tests
  • test:coverage: run mocha and generate a coverage report in ./coverage
  • build: build to JS in ./dist
  • lint: run eslint on all files in ./src
  • update-deps: update all dependencies
  • update-version: updates the CHANGELOG.md, bumps the version, commits & tags
  • release: lints, tests, builds, generates docs, runs update-version and pushes.

Publishing

Publishing to the NPM Registry is done automatically with a NPM Publish GitHub Action that runs when a new tag is pushed. For this to work, you must add a secret named NPM_TOKEN to the repository settings.

Release History

See CHANGELOG.md for more information.

License

Distributed under the MIT license. See LICENSE.md for more information.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request