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

npm-pkgbuild

v19.1.0

Published

create ArchLinux, RPM and Debian packages from npm packages

Readme

npm License Typed with TypeScript bundlejs downloads GitHub Issues Build Status Styled with prettier Commitizen friendly Known Vulnerabilities

npm-pkgbuild

Create ArchLinux, RPM, Debian and Docker packages from npm packages.

usage

In a package directory execute

npm-pkgbuild --rpm --debian --arch --content /destination:build --publish /some/directory

This will create a arch, rpm and a debian package of the build dir.

upload package

npm-pkgbuild --arch --content build --publish 'https://my.package-service.com/binaries/linux/{{type}}/{{access}}/{{arch}}'

You can specify the package content in package.json.

{
  "pkgbuild": {
    "content": {
      "/some/location/" : { "base": "build" },
      "/etc/myconfig.json" : "sample-config.json",
      "/erc/secret" : { "name":  "secret", "mode": "600" },
      "/opt/myapp": [
        {
          "type": "npm-pack"
        },
        {
          "type": "node-modules",
          "withoutDevelpmentDependencies": true
        }
      ]
    },
    "hooks" : "pkg/hooks",
    "output": {
      "debian" : {},
      "rpm" : {},
      "arch" : {}
    },
  "dependencies": { "nginx" : ">=1.12" }
  }
}

content providers

Defining where the package content should come from.

files (default)

content from the file system

npm-pack

content as provided by npm pack

node-modules

content of all (production) dependencies

options: - withoutDevelpmentDependencies when to stip away dev dependencies (defaults to true)

shared configuration

You can import common configuration from other packages. See mf-hosting or mf-hosting-frontend modules.

API

Table of Contents

allInputs

All content providers (input)

allOutputs

All output formats

npmArchMapping

Node architecture name to os native arch name mapping {@see https://nodejs.org/dist/latest-v18.x/docs/api/process.html#processargv}

content2Sources

Delivers ContentProviders from pkgbuild.content definition.

Parameters

  • content Object from pkgbuild.content
  • dir

Returns Iterable<ContentProvider>

PackageDefinition

Type: Object

Properties

  • properties Object values describing the package attributes

    • properties.dependencies Object
  • sources Array<ContentProvider> content providers

  • output Object package type

  • variant Object identifier of the variant

    • variant.name string name of the variant
    • variant.arch string name of the architecture

extractFromPackage

Extract package definition from package.json.

  • for each architecture deliver a new result
  • if no architecture is given one result set is provided nethertheless
  • architectures are taken from cpu (node arch ids) and from pkgbuild.arch (raw arch ids)
  • architecture given in a variant definition are used to restrict the set of avaliable architectures

Parameters

  • options Object (optional, default {})

    • options.dir string? where to look for package.json
    • options.verbose boolean? log
  • env Object as delared in process.env (optional, default {})

Returns AsyncIterable<PackageDefinition>

NPMPackContentProvider

Extends ContentProvider

Content from npm pack.

Parameters

  • definitions Object
  • entryProperties Object to be set for each entry
  • directoryProperties

Properties

name

Returns string name of the content provider

NodeModulesContentProvider

Extends ContentProvider

Content from node_modules. Requires .npmrc or NPM_TOKEN environment

Parameters

  • definitions
  • entryProperties
  • directoryProperties

Properties

  • withoutDevelpmentDependencies boolean

asyncIterator

List all entries.

Returns AsyncIterable<(ContentEntry | CollectionEntry)> all entries

name

Returns string name of the content provider

FileContentProvider

Extends ContentProvider

Content provided form the file system.

Parameters

asyncIterator

Returns AsyncIterable<(ContentEntry | CollectionEntry)> all entries

name

Returns string name of the content provider

NFTContentProvider

Extends ContentProvider

Content provided form the file system.

Parameters

asyncIterator

Returns AsyncIterable<ContentEntry> all entries

name

Returns string name of the content provider

ContentProvider

Source of package content.

Parameters

  • definitions
  • entryProperties
  • directoryProperties

Properties

asyncIterator

List all entries.

Returns AsyncIterable<(ContentEntry | CollectionEntry)> all entries

DEBIAN

Extends Packager

Create .deb packages

hookMapping

Map install hook named from default (arch) to deb.

attributes

prepare

Parameters

Returns Promise<boolean>

pkgKeyValuePairOptions

Type: Object

attributes

well known package properties https://www.archlinux.org/pacman/PKGBUILD.5.html

quoteFile

Parameters

  • name

RPM

Extends Packager

Produce rpm packages.

hookMapping

Map install hook named from default (arch) to rpm.

attributes

prepare

Check for rpmbuild presence.

Parameters

Returns Promise<boolean> true when rpmbuild executable is present

OCI

Extends Packager

Low level OCI compatible packager

DOCKER

Extends Packager

docker image build

attributes

prepare

Check for docker presence.

Parameters

Returns Promise<boolean> true when docker executable is present

BUILDAH

Extends DOCKER

Use buildah @see https://buildah.io

Packager

Parameters

  • properties

packageName

What is the package name in the package eco-system.

Parameters

Returns string package name in the target eco-system

tmpdir

Create tmp directory.

Returns Promise<string> directory path

prepare

Prepares artifact generation.

Parameters

Returns Promise<{properties: Object, destination: string, tmpdir: string, staging: string}>

create

Execute package generation.

Parameters

Returns Promise<string> identifier of the resulting package

workspaceLayout

Returns {named: object, others: Array<string>}

prepare

Parameters

Returns Promise<boolean>

Packager

Base Packager

Parameters

packageName

What is the package name in the package eco-system.

Parameters

Returns string package name in the target eco-system

tmpdir

Create tmp directory.

Returns Promise<string> directory path

prepare

Prepares artifact generation.

Parameters

Returns Promise<{properties: Object, destination: string, tmpdir: string, staging: string}>

create

Execute package generation.

Parameters

Returns Promise<string> identifier of the resulting package

workspaceLayout

Returns {named: object, others: Array<string>}

prepare

Parameters

Returns Promise<boolean>

Field

Type: Object

Properties

deleteKey

Parameters

copyNodeModules

Parameters

PublishingDetail

Type: Object

Properties

createPublishingDetails

Parameters

Returns Array<PublishingDetail>

publish

Parameters

utf8StreamOptions

Type: BufferEncoding

decodePassword

Decode a password

Parameters

Returns string plaintext password

FunctionDecl

Type: Object

Properties

extractFunctions

Extract shell functions from a given text.

Parameters

Returns AsyncIterable<FunctionDecl>

fieldProvider

Parameters

Returns Function

Expander

Type: Function

Parameters

Returns string

copyEntries

Copy content from source into destinationDirectory. Destination paths a generated without leading '/' (as for entry names too).

Parameters

  • source AsyncIterable<ContentEntry>
  • destinationDirectory string
  • expander Expander (optional, default v=>v)

install

With npm do:

npm install npm-pkgbuild

license

BSD-2-Clause