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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@code-fixer-23/nx-jsr

v1.1.0

Published

An Nx plugin for scaffolding and publishing TypeScript libraries to [JSR (JavaScript Registry)](https://jsr.io).

Downloads

23

Readme

@code-fixer-23/nx-jsr

An Nx plugin for scaffolding and publishing TypeScript libraries to JSR (JavaScript Registry).

Features

  • Library Generator: JSR-ready TypeScript libraries (standalone by default)
  • Publish Executor: Publish to JSR with dry-run, token, and allow-dirty options
  • Validate Executor: Structural checks + jsr publish --dry-run
  • Version Executor: Manual version update for jsr.json (Nx Release recommended for semver/versioning workflow)

Installation

pnpm add -D @code-fixer-23/nx-jsr

Generator: library

Generate a new JSR TypeScript library.

  • Default: Standalone (files-only) in the current directory (no Nx project registered)
  • Monorepo mode: Provide --directory=<dir> to generate into <dir>/<name> and register an Nx project with build/typecheck/publish/version/validate targets

Usage

# Standalone (default - files in current directory)
npx nx g @code-fixer-23/nx-jsr:library my-lib --importPath=@scope/my-lib

# Monorepo mode (creates packages/my-lib/ and registers Nx project)
npx nx g @code-fixer-23/nx-jsr:library my-lib --importPath=@scope/my-lib --directory=packages

# Custom directory
npx nx g @code-fixer-23/nx-jsr:library my-lib --importPath=@scope/my-lib --directory=libs

Options

| Option | Type | Required | Description | | ------------- | -------- | -------- | --------------------------------------------------------------------------- | --- | -------------------- | | name | string | Yes | Library name (kebab-case) | | importPath | string | Yes | JSR import path (e.g., @scope/package-name) | | directory | string | No | If provided, files are created in <directory>/<name> and Nx project added | | description | string | No | Package description | | skipFormat | boolean | No | Skip formatting files (default: false) | | testRunner | vitest | jest | none | No | Choose a test runner |

What Gets Generated

Standalone (no --directory):

.
├── src/
│   └── index.ts
├── jsr.json
├── package.json
├── tsconfig.json
├── tsconfig.lib.json
└── README.md

Monorepo mode (--directory=packages):

packages/
└── my-lib/
    ├── src/
    │   └── index.ts
    ├── jsr.json
    ├── package.json
    ├── tsconfig.json
    ├── tsconfig.lib.json
    └── README.md

jsr.json example:

{
  "name": "@scope/my-lib",
  "version": "0.1.0",
  "exports": "./src/index.ts"
}

Nx Targets (monorepo mode)

  • build: Compile TypeScript to JavaScript
  • typecheck: Run type checking without emitting files
  • validate: Validate setup and run jsr publish --dry-run
  • publish: Publish to JSR
  • version: Manually set jsr.json version (use Nx Release for full versioning pipelines)

Executors

validate

Validate a package and run JSR dry-run publish.

npx nx validate my-lib

Options:

  • packageRoot (optional): Root of the package. Inferred from project; falls back to current directory.
  • dryRun (boolean): Always runs as dry-run (default true).

Checks:

  • jsr.json exists with name, version, and exports
  • tsconfig.lib.json has declaration: true
  • Executes npx jsr publish --dry-run

publish

Publish a TypeScript library to JSR.

# Publish to JSR (token required)
npx nx publish my-lib

# Dry run (validate without publishing)
npx nx publish my-lib --dryRun

# Publish with token passed explicitly
npx nx publish my-lib --token=your-jsr-token

Token resolution order:

  1. --token
  2. JSR_TOKEN env var
  3. .env in the package root
  4. .env in the workspace root

If no token is found and --dryRun is not set, the executor fails with a helpful message.

Options:

  • packageRoot (optional): Inferred from project; falls back to current directory.
  • dryRun (boolean): Dry-run mode.
  • token (string): Explicit JSR token.
  • allowDirty (boolean): Allow publishing with uncommitted changes.

version (manual only)

Explicitly set the version field in jsr.json.

npx nx version my-lib --version=1.2.3

Options:

  • packageRoot (required): Root directory of the package.
  • version (required): Semver to set.
  • push (optional): Attempts to create and push a tag if the working tree is clean. No auto-commit is performed.
  • tagPrefix (optional): Defaults to v.

Notes:

  • Prefer using Nx Release to orchestrate versioning across projects. This executor is a manual setter only.

Nx Release (recommended)

Use Nx Release to set versions and create tags, then run publish for each package as part of your pipeline. Example minimal nx.json (docs only):

{
  "release": {
    "projects": ["packages/*"],
    "changelog": false,
    "git": { "tag": true, "tagPrefix": "v" }
  }
}

Requirements

  • Node.js 20+
  • Nx 21.6.3+
  • TypeScript 5.9+
  • JSR CLI (via npx)

Resources

  • JSR Documentation: https://jsr.io/docs
  • Nx Documentation: https://nx.dev
  • TypeScript Documentation: https://www.typescriptlang.org/docs