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

pridepack

v2.6.1

Published

CLI for building TypeScript packages

Downloads

1,767

Readme

pridepack

Zero-config CLI for building Typescript packages.

Install

npm install -g pridepack
yarn global add pridepack

Features

  • Extremely-fast package building: Using ESBuild, you can build your packages in just seconds.
  • Linter setup: Creating a project with proper linting tools is already made for you.
  • Zero-config: No need to customize your building process, pridepack already handles that for you.

Templates

See templates

Usage

pridepack init [template]

Initializes current working directory with the selected template. Package name is derived from the working directory's name.

pridepack create <name> [template]

Creates a new project directory from the given template. <name> is any valid NPM package name. Project directory's name is derived from the supplied package name.

pridepack clean

Cleans output directory. Use this everytime there are added/removed files from the source directory.

pridepack build

Builds the source directory using ESBuild and emits type declaration files.

pridepack watch

Builds the source directory in watch mode.

pridepack check

Runs no-emit type-checking.

pridepack start

Runs the index file (based on package.json's type) in production mode, respectively.

pridepack dev

Runs the index file in development mode and runs the build in watch mode. Auto-reloads when detecting changes.

Environment Variables

Pridepack automically loads variables from .env, .env.production and .env.development whenever it is available, and uses the variables during compile-time. Variables are going to be registered under process.env or import.meta.env.

process.env.NODE_ENV provides a way to check whether or not the code is being built during production or development mode. The same goes to import.meta.env.MODE, import.meta.env.DEV and import.meta.env.PROD

if (process.env.NODE_ENV === 'development') {
  // do stuff
}
// the same as
if (import.meta.env.MODE === 'development') {
  // do stuff
}
if (import.meta.env.DEV) {
  // ...
}
if (!import.meta.env.PROD) {
  // ...
}

Config

Even though Pridepack encourages zero-config setup, Pridepack also includes config files. Pridepack config files can be either of the following:

  • .pridepackrc
  • .pridepack.json
  • .pridepack.config.json
  • pridepack.json
  • pridepack.config.json

JS Config files are also supported, useful for loading environment variables and more.

  • .pridepack.js
  • .pridepack.config.js
  • pridepack.js
  • pridepack.config.js

Fields

// pridepack config fields and their default values.
{
  // Directory where the bundled output is going to be generated
  "outputDir": "dist",
  // Path to the tsconfig.json
  "tsconfig": "tsconfig.json",
  // Optional, maps the subpackage entrypoint to the source file
  // This is used for generating the `exports` field and constructing
  // the subpackages. The default value is below.
  "entrypoints": {
    ".": "src/index.ts", // Maps to `my-package`
    // Example other entrypoint (not a default value)
    "./example": "src/example.ts" // Maps to `my-package/example`
  },
  // Refers to the target entrypoint to be used for `start` and `dev` commands
  // Value is mapped from `entrypoints`
  "startEntrypoint": ".",
  // Target ES version or Browser versions, see https://esbuild.github.io/api/#target
  "target": "es2018",
  // What to do with JSX expressions, see https://esbuild.github.io/api/#jsx
  "jsx": "transform",
  // See https://esbuild.github.io/api/#jsx-factory
  "jsxFactory": "React.createElement",
  // See https://esbuild.github.io/api/#jsx-fragment
  "jsxFragment": "React.Fragment",
  // Can only be used on JS config files, allows usage of ESBuild plugins
  // This field can also accept a callback that receives the current compilation mode
  // 
  "plugins": ({ isDev, isESM, isCJS }) => [
    somePlugin({ isDev }),
  ],
}

Soon

  • Code-splitting (requires ESBuild)

License

MIT © lxsmnsyc