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

@textbook/build-info

v1.3.0

Published

Generate build information for tracking deployments

Downloads

376

Readme

@textbook/build-info

Node.js CI NPM release Maintainability Rating

Generate build information for tracking deployments.

Sources

buildinfo has numerous sources, each of which is automatically enabled, if appropriate, in the following order:

  • Clock - includes the build time
  • User - includes the identity of the user
  • Git - includes the commit the build was based on and a summary of any changes from it
  • Heroku - includes the fact that it was built in Heroku, for which stack and from which commit
  • GitHub Actions - includes the build number and URL
  • CircleCI - includes the build number and URL
  • Netlify - includes the build number and URL

Usage

You can install this package using e.g. NPM:

npm install --save-dev @textbook/build-info

and then use it in your scripts in package.json:

{
  // ...
  "scripts": {
    // ...
    "build": "<do your build>",
    "postbuild": "buildinfo -o path/to/build-info.txt",
    // ...
  }
}

This will generate a file like the following:

Built: 2022-07-07T20:17:55.213Z
By: jonrsharpe
From: 3f27baa Refactor sources in subdirectory

You can also run it without installation via NPX:

$ npx --package @textbook/build-info buildinfo -o path/to/file.txt
Need to install the following packages:
  @textbook/build-info
Ok to proceed? (y)

(you can suppress the confirmation with the --yes flag).

Arguments

  • -f/--format - the format to provide data in (one of html, json, text; default: text)
  • -h/--help - show a help message and exit
  • -o/--output - the file to write data to
  • -v/--version - show the version and exit

Stdout

If you don't supply the --output argument (or supply the argument with the value -), data will be written to stdout, allowing redirection:

{
  // ...
  "scripts": {
    // ...
    "build": "<do your build>",
    "postbuild": "buildinfo > path/to/build-info.txt",
    // ...
  }
}

Compatibility

The emitted code targets Node from at least 18.3 (see engines field in package.json). It is tested on the latest even-numbered versions of Node (currently 18, 20 and 22) in Ubuntu (22.04) and Windows (Server 2022).

Development

Clone the repository, then install the dependencies using npm install or npm ci.

You can create a new build information source by implementing Source, and optionally extend Cmd or Env to run terminal commands or access environment variables respectively.

Scripts

The following scripts are provided to aid development:

  • npm run lint: Applies linting using ESLint

  • npm run dev: Runs the app without building it first (using ts-node)

  • npm run test: Runs tests using Mocha (plus ts-node, Chai and Sinon)

    • npm run test:coverage: Runs the tests with coverage using c8
  • npm run e2e: Builds the library with TypeScript and runs it, generating out.txt