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

@hz-9/pkg-build

v0.3.7

Published

A tool for run pkg to package Node.js service or tool.

Downloads

3

Readme

@hz-9/pkg-build

A tool for run pkg to package Node.js service or tool.

NPM Version NPM License NPM Downloads Types Node Version Last Commit

Document | 文档

Introduction

Why create @hz-9/pkg-build instead of directly use pkg ?

@hz-9/pkg-build still utilizes pkg for packaging operations without optimizations. @hz-9/pkg-build provides the following functionalities:

  1. Supports buildName and buildVersion parameters. Default, it will read them from the package.json file.
  2. The output artifacts will be rename ${name}-${version}-${platform}-${arch} format.

Installation

npm install --global @hz-9/pkg-build

Usage

Get help:

pkg-build --help

Minimal execution:

pkg-build

With config file:

pkg-build --config ./.hz-9.conf.json

Please see config file description to learn how to write .hz-9.conf.json.

Parameters

-r, --root

The execution path, default is process.cwd(). This parameter will affects the reading of the package.json file and the resolution of other relative paths.

-c, --config

The path to the configuration file. If omitted, the configuration file is not read.

The command-line parameters have higher priority than configuration file parameters.

--build-name

The name part of the build output filename. If omitted, it will read name parameter from package.json. If package.json cannot be found or parsed correctly, it will default to 'unknown'.

--build-version

The version part of the build output filename. If omitted, it will read version parameter from package.json. If package.json cannot be found or parsed correctly, it will default to '0.0.0'.

--targets

The targets parameter when execution pkg. This is detail.

If export multi platforms, use , to separate them.(eg: linux-64,win-x64) If omitted, it is linux-x64.

--input-path

The entry file path when execution pkg. If ommited, it is ./src/index.js.

--output-path

The output folder path when execution pkg. If ommited, it is ./build.

The --config, --input-path, and --output-path parameters can all accept relative or absolute paths. Relative paths will be resolved using the root parameter as the base path.

Config file

The configuration file support jsonc format. All parameters are prefixed with pkg.

eg: Read buildName parameter, will read the value of pkg.buildName from the configuration file.

This is a template for a configuration file:

{
  "pkg": {
    "inputPath": "dist/main.js",
    "buildName": "service",
    "version": "0.0.0",
    "targets": [
      "linux-x64"
    ]
  }
}

pkg.buildName

Equivalent to --build-name. Has lower priority than command-line arguments.

pkg.buildVersion

Equivalent to --build-version. Has lower priority than command-line arguments.

pkg.targets

Equivalent to --targets. Has lower priority than command-line arguments.

pkg.inputPath

Equivalent to --input-path. If a relative path is provided,it will be resolved using the path where the config folder is located as the base path.

pkg.outputPath

Equivalent to --output-path. If a relative path is provided,it will be resolved using the path where the config folder is located as the base path.

pkg.scripts

Since scripts are fixed information in the project, we do not plan to support scripts parameters in command-line.

scripts detail

pkg.assets

Since assets are fixed information in the project, we do not plan to support assets parameters in command-line.

assets detail