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

typedpkg

v0.7.4

Published

[![npm version](https://badge.fury.io/js/typedpkg.svg)](https://badge.fury.io/js/typedpkg) [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC) [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-Type

Readme

typedpkg 📦

npm version License: ISC TypeScript

Use a TypeScript file for your package.json with full type safety and enhanced developer experience! 🚀

✨ Features

  • 🔒 Type Safety: Define your package configuration with full TypeScript type checking
  • 🎯 IntelliSense: Get autocomplete and validation for all package.json fields
  • 🔄 Version Sync: Keep your TypeScript config and package.json versions in sync
  • 🧩 Plugin System: Extend functionality with reusable plugins
  • 📦 Multiple Packages: Build and manage multiple packages from a single configuration
  • CLI Tools: Powerful command-line interface for package management

🚀 Installation

# Using yarn (recommended)
yarn add -D typedpkg

# Using npm
npm install --save-dev typedpkg

📖 Quick Start

  1. Create a package.ts file in your project root:
import { PackageConfig } from 'typedpkg'

const config: PackageConfig = {
  name: 'my-awesome-package',
  version: '1.0.0',
  scripts: {
    dev: 'vite dev',
    build: 'vite build',
    pre: {
      build: 'echo "Starting build..."',
    },
    post: {
      build: 'echo "Build complete!"',
    },
  },
  dependencies: {
    react: [18, 0, 0],
    lodash: ['github', 'lodash/lodash'],
  },
  devDependencies: {
    typescript: [5, 0, 0],
    vite: [4, 0, 0],
  },
}

export default config
  1. Generate your package.json:
npx typedpkg build

🛠️ CLI Commands

typedpkg build

Generate package.json from your TypeScript configuration:

# Build single package
typedpkg build

# Build specific package file
typedpkg build --config my-package.ts

# Build all packages in directory
typedpkg build --all

typedpkg sync

Sync version between package.json and your TypeScript config:

# Sync version from package.json to package.ts
typedpkg sync

# Sync specific config file
typedpkg sync --config my-package.ts

typedpkg add-plugin

Add a plugin to your package configuration:

typedpkg add-plugin my-plugin

typedpkg update

Update package configurations:

typedpkg update

📋 Configuration

PackageConfig Interface

The PackageConfig interface provides full type safety for your package configuration:

export type PackageConfig<T = any> = {
  name: string
  version: string
  license?: string
  type?: 'plugin'
  plugins?: string[]
  private?: boolean
  scripts: {
    dev?: string
    build?: string
    start?: string
    pre?: PreScripts
    post?: PostScripts
    [key: string]: string | undefined | PreScripts | PostScripts
  }
  dependencies?: Record<string, Dependency>
  devDependencies?: Record<string, Dependency>
  config?: T
}

Dependency Types

Define dependencies using semantic versioning arrays or GitHub sources:

// Semantic version [major, minor, patch]
dependencies: {
  'react': [18, 2, 0],
  'lodash': [4, 17, 21]
}

// GitHub source
dependencies: {
  'my-package': ['github', 'username/repo']
}

// Latest version
dependencies: {
  'some-package': 1
}

Pre/Post Scripts

Define scripts that run before or after main scripts:

scripts: {
  build: 'webpack build',
  pre: {
    build: 'rm -rf dist',
    version: 'npm run test'
  },
  post: {
    build: 'npm run deploy',
    version: 'git push --tags'
  }
}

🧩 Plugin System

Create reusable plugins to extend functionality:

// my-plugin.ts
import { PluginFunction } from 'typedpkg'

interface MyPluginConfig {
  feature: boolean
}

const myPlugin: PluginFunction<MyPluginConfig> = (config) => {
  return {
    scripts: {
      'my-command': 'echo "Plugin command"',
    },
    dependencies: {
      'plugin-dep': [1, 0, 0],
    },
  }
}

export default myPlugin

Use plugins in your package configuration:

import myPlugin from './my-plugin'

const config: PackageConfig = {
  name: 'my-package',
  version: '1.0.0',
  plugins: ['my-plugin'],
  // ... rest of config
}

🔌 Available Plugins

Extend typedpkg functionality with these official plugins:

🚀 Next.js Plugin

Pre-configured setup for Next.js applications with optimized scripts and dependencies.

💅 Prettier Plugin

Automatic code formatting configuration with Prettier integration.

🗄️ Prisma Plugin

Database toolkit integration with Prisma ORM setup and scripts.

🗄️ Mantine Plugin

Mantine UI library integration with Mantine UI setup and scripts.

⚙️ Scripts Plugin

Scripts integration with scripts setup and scripts.

Using Plugins

Install and use plugins in your package configuration:

npx typedpkg add-plugin prisma
npx typedpkg add-plugin prettier
import { PackageConfig } from 'typedpkg'
import nextjsPlugin from 'typedpkg-plugin-nextjs'

const config: PackageConfig = {
  name: 'my-nextjs-app',
  version: '1.0.0',
  plugins: ['typedpkg-plugin-nextjs'],
  // Plugin configuration will be automatically applied
}

export default config

🎯 Use Cases

  • Monorepos: Manage multiple packages with shared configuration
  • Type Safety: Catch configuration errors at compile time
  • Plugin Development: Create reusable package configurations
  • CI/CD: Automate package.json generation in build pipelines
  • Team Collaboration: Share typed package configurations

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m '✨ add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the ISC License - see the LICENSE file for details.

🔗 Links


Made with ❤️ and TypeScript