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

@kineticcafe/release-metadata

v2.0.0

Published

Generate a file that describes a release for use in various ways

Downloads

12

Readme

release-metadata

Generates and provides release metadata for the current application.

{
  "name": "release-metadata",
  "timestamp": "20210706195814",
  "repos": [
    {
      "ref": "b7ebeb23c2dfbd9bba637a91cccfaa2fe0860108",
      "url": "https://github.com/KineticCafe/release-metadata-ts.git",
      "name": "release-metadata-ts",
      "type": "git",
      "source_path": "/home/halostatue/projects/kineticcafe/release-metadata/release-metadata-ts"
    }
  ],
  "source_path": "/home/halostatue/projects/kineticcafe/release-metadata/release-metadata-ts",
  "packages": [
    {
      "name": "node",
      "versions": {
        "node": "16.4.0",
        "v8": "9.1.269.36-node.14",
        "uv": "1.41.0",
        "zlib": "1.2.11",
        "brotli": "1.0.9",
        "ares": "1.17.1",
        "modules": "93",
        "nghttp2": "1.43.0",
        "napi": "8",
        "llhttp": "6.0.2",
        "openssl": "1.1.1k",
        "cldr": "39.0",
        "icu": "69.1",
        "tz": "2021a",
        "unicode": "13.0"
      }
    }
  ]
}

Usage

There are two use cases for ReleaseMetadata:

  • generating a release metadata file for inclusion in a release package;
  • presenting a release metadata collection output through an API.

Generating Metadata

Release metadata can be generated for the current application repository with npm exec release-metadata --save. There are numerous options available for the release-metadata command-line:

  • --path <PATH>: The path and/or filename for the metadata (implies --save)
  • --save: Writes release-metadata.json to the current directory
  • --no-save: Prints to standard output instead of saving, used with --path for reading only
  • --merge [ORIGINAL]: Merges the generated release metadata with an existing file. If just --merge is provided, the original file does not need to exist; if --merge ORIGINAL is provided, the original file must exist. Incompatible with --merge-original.
  • --merge-original <ORIGINAL>: Merges the generated release metadata with the original file (the generated data overrides the original data)
  • --merge-overlay <OVERLAY>: Merges the overlay file with the generated release metadata (the overlay overrides the generated data)
  • --branch <BRANCH>: The default git branch to use, if not main or master
  • --remote <REMOTE>: The default git remote to use, if not origin
  • --no-git: Disables git processing
  • --secure: Resolves only to a secure version of the output
  • --secure-if-production: Resolves to a secure version if NODE_ENV is production
  • --omit-repo-url: Eliminates the repo URL
  • --release-name <NAME>: The value to use as the release name
  • --timestamp <TIMESTAMP>: The timestamp to use

Both --merge-original and --merge-overlay may be used at the same time. See {@link ConfigOptions} for more information.

This metadata file can be manipulated by other tools to include more information, if desired, such as the current version of Node.js, or it can merge an existing metadata file when --merge is provided.

The timestamp value can be overridden by setting RELEASE_TIMESTAMP in OS environment variables.

Programmatic Generation

It is possible to write your own script to generate the release metadata so that it can become part of a build or packaging script. The script will look something like this:

import { generate } from '@kineticcafe/release-metadata'

const config = {
  // Set configuration options here. See ConfigOptions documentation for
  // details.
  path: 'release.json',
  name: 'my-package',
}

generate(config).then((processed) => {
  // Do something with the processed metadata.
})

Presenting Metadata

Use the create function to read and process the release metadata for presentation from an API.

// ./release-metadata.mjs
import { create } from '@kineticcafe/release-metadata'

export const releaseMetadata = create()

The output of create() is an async function that returns a release metadata map that could be used in an express handler, for example:

import { releaseMetadata } from './release-metadata.mjs'

express.get('/release', async (_req, res, _next) => {
  res.send(await releaseMetadata())
})

Static Presentation

Use the createStatic function to read and process the release metadata and return a static release metadata map.

// ./release-metadata.mjs
import { createStatic } from '@kineticcafe/release-metadata'

export const releaseMetadata = createStatic({ secure: true })

// app.mjs
import { releaseMetadata } from './release-metadata.mjs'

express.get('/release', (_req, res, _next) => {
  res.send(releaseMetadata)
})

Installation

# Pick your poison:
$ npm install @kineticcafe/release-metadata # OR
$ yarn install @kineticcafe/release-metadata # OR
$ pnpm install @kineticcafe/release-metadata

If the only purpose is the generation of a release metadata file from the command-line, release-metadata may be installed as a development dependency:

$ npm install -D @kineticcafe/release-metadata # OR
$ yarn install -D @kineticcafe/release-metadata # OR
$ pnpm install -D @kineticcafe/release-metadata

Licence

Licensed under the MIT licence.

Community and Contributing

We welcome your contributions, as described in Contributing.md. Like all Kinetic Cafe open source projects, is under the Kinetic Cafe Open Source Code of Conduct.