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

ptsup

v0.3.5

Published

Build a packager with bundle or run tsc directories, suitable for node|browser library package processing, It is implemented using esbuild

Downloads

58

Readme

ptsup

npm version

tsup is similar but focuses more on packet processing, powered by esbuild.

what's the difference?

  • A more casual package directory
  • carry meta options
  • carry assets options(.png, .html,...more)
  • more universal

⚙️ Install

Install it locally in your project folder:

pnpm add ptsup --dev
# Or Yarn
yarn add ptsup --dev

You can also install it globally but it's not recommended.

📖 Usage

Bundle files

ptsup [...file]

Files are written into ./dist.

You can bundle multiple files in one go:

ptsup src/index.ts src/bin/bin.ts

This will output dist/index.cjs.js; dist/index.esm.js and dist/bin.cjs.js; dist/bin.esm.js.

Unlike tsup, ptsup is more suitable for a single independent entry file, ptsup does not preserve the directory structure

build directory

ptsup [...directory]

Files are written into ./dist.

You can build dir in one go:

src
 - bin
   index.ts
 index.ts
ptsup src

This will output:

dist
 - bin
   index.js
 index.js

You can build multiple directories at once, but it is recommended to use only one directory as filename duplicates will be overwritten

carry meta

use command --meta It works well on some monorepo (pnpm,yarn,npm) applications

  • carry package info (LICENSE, README.md, CHANGELOG.md)
  • handle package.publishConfig and carry package.json
  • create node_modules lnk file to output(default dist)

Using custom configuration

Like tsup, you can use the config file to configure

Supported file formats

  • ptsup.config.ts
  • ptsup.config.js
  • ptsup.config.cjs
  • ptsup.config.json

TypeScript / JavaScript

import { defineConfig } from 'ptsup'

export default defineConfig({
  entry: ['src/index.ts'],
  splitting: false,
  sourcemap: true,
  clean: true,
})

carry assets

You can carry static resources that your project depends on

use command --assets aaa.png,xxx.vue,assetsDir

defines it like this in defineConfig

import { defineConfig } from 'ptsup'

export default defineConfig({
  assets: [
    'aaa.png',
    'xxx.vue',
    'assetsDir'
  ]
})

command line options

Usage:
  $ ptsup [...files/directorys]

Commands:
  [...files/directorys]  Bundle files

For more info, run any command with the `--help` flag:
  $ ptsup --help

Options:
  --entry <directory|file>   Use a key-value pair as entry directory|files (default: ./)
  -r, --root <dir>           Root directory (default: .)
  -o, --outdir <outdir>      Output directory (default: dist)
  -f, --format <format>      Bundle format, "cjs", "iife", "esm" (default: cjs)
  --sourcemap [inline]       Generate external sourcemap, or inline source: --sourcemap inline
  --minify                   Minify bundles only for iife
  --target <target>          Bundle target, "es20XX" or "esnext" (default: esnext)
  --dts [entry]              Generate declaration file
                             If entry is not passed in, it will be created based on the compiled file by default
  --dts-only                 Emit declaration files only
  --global-name <name>       Global variable name for iife format (default: package.name in pascal-case)
  --clean                    Clean output directory
  --meta                     Helper and carry package.json/*.md
  --meta-only                Emit meta files only
  --metafile                 Emit esbuild metafile to use with Bundle Size Analyzer (default: false)
  --splitting                Enables esbuild "code splitting", enable cast to esm module
  --assets [files]           Carry some static resources
  --jsxFactory <jsxFactory>  Name of JSX factory function (default: React.createElement)
  --platform <node|browser>  Platform determines the format of the output (default: node)
                             platform->node:    cjs,esm
                             platform->browser: cjs,esm,iife
  -h, --help                 Display this message