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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gpits/fontsource-variable-discover

v1.0.0

Published

A typescript module (and cli command) that discovers fontsource-variable fonts from package.json and can export them to 1) a css file containing import statements, and 2) a json file containing their main metadata

Readme

@gpits/fontsource-variable-discover

Discover installed @fontsource-variable font packages from an application's package.json.

The package can be used as a TypeScript/JavaScript module or as a command-line tool. It can optionally generate:

  • A CSS file containing @import statements for all discovered fonts.
  • A JSON file containing the main metadata for each discovered font.

There following are also available, for more specialised needs:

This package was developed to support a project of GUNET.

Installation

npm install @gpits/fontsource-variable-discover

Also install your preferred fontsource-variable fonts, e.g.

npm install @fontsource-variable/inter
npm install @fontsource-variable/roboto-mono

How discovery works

The package:

  1. Reads the application's package.json.
  2. Collects dependencies whose names start with @fontsource-variable/. Optionally includes matching devDependencies.
  3. Resolves each installed font package and reads its metadata.json.
  4. Optionally generates CSS and/or JSON output files.
  5. When using as a library, returns basic font metadata.

For example, given an application with:

    "dependencies": {
        "@fontsource/poppins": "5.2.6",
        "@fontsource-variable/inter": "5.2.6",
        "@fontsource-variable/roboto-mono": "5.2.6"
    }

the package discovers those installed font packages and can generate this CSS:

@import "@fontsource-variable/inter";
@import "@fontsource-variable/roboto-mono";

and this JSON:

[
  {
    "key": "inter",
    "name": "Inter",
    "family": "Inter Variable",
    "package": "@fontsource-variable/inter",
    "category": "sans-serif"
  },
  {
    "key": "roboto-mono",
    "name": "Roboto Mono",
    "family": "Roboto Mono Variable",
    "package": "@fontsource-variable/roboto-mono",
    "category": "monospace"
  }
]

Usage: CLI

After installation, the fontsource-variable-discover command is available.

Basic usage

Run the command from the root of your application:

npx fontsource-variable-discover --css-path resources/css/fonts.css --json-path resources/json/fonts.json

Specify --css-path to generate the CSS file (otherwise, no CSS file will be generated).

Specify --json-path to generate the JSON file (otherwise, no JSON file will be generated).

Include development dependencies

By default, devDependencies from the application's package.json are not inspected. To also discover fonts listed in devDependencies, add the --include-dev-dependencies option.

Custom root folder

By default, the application root is the current working directory. You may specify a different application root with --root-path.

npx fontsource-variable-discover --root-path ./my-app --css-path resources/css/fonts.css

Usage: Library

The package can also be used directly from TypeScript or JavaScript.

import fontsourceVariableDiscover from "@gpits/fontsource-variable-discover";
const result = await fontsourceVariableDiscover();

The discovered fonts are returned as FontResource objects; for example, result may be:

[
  {
    "key": "inter",
    "name": "Inter",
    "family": "Inter Variable",
    "package": "@fontsource-variable/inter",
    "category": "sans-serif"
  },
  {
    "key": "roboto-mono",
    "name": "Roboto Mono",
    "family": "Roboto Mono Variable",
    "package": "@fontsource-variable/roboto-mono",
    "category": "monospace"
  }
]

Options

  • includeDevDependencies: Also scan devDependencies
  • cssPath: Where to output the CSS file; if missing, no file will be emitted
  • jsonPath: Where to output the JSON file; if missing, no file will be emitted
  • rootPath: The root of the application whose package.json and installed dependencies should be inspected

Pass them as an object to fontsourceVariableDiscover, e.g.

const result = await fontsourceVariableDiscover({
    includeDevDependencies: true
});

Issue tracker

At https://todo.sr.ht/~giorgio93p/fontsource-variable-discover.

Please specify that your issue is related to @gpits/fontsource-variable-discover.

License

European Union Public Licence 1.2