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

node-postbuild-cli

v1.0.2

Published

Postbuild script for node package

Downloads

16

Readme

npm npm NPM GitHub Workflow Status (with event)

Description

The tool partially improves the process of automating some commands, e.g. it allows you to copy the package.json file and remove properties unnecessary for production, copy specific files from the source location to the dist directory, run the npm install command in the target location and pack the directory into zip. The specified tasks run in the order in which they are specified.

Installation

Latest version:

npm i -g node-postbuild-cli@latest

or in working directory

npx node-postbuild-cli --task ...

Usage

USAGE:
$ node-postbuild-cli --tasks ... [options]
$ npbc --tasks ... [options]

currently default defined tasks: package,zip,deps,copyfiles

- package: copies the package.json and removes properties such as:
name, version, description, private, main, author, contributors,
license, repository, dependencies, engines, config
- copyfiles: copies the files specified in the cli arguments
- deps: installs dependencies in package.json directory
- zip: zipping dist directory

Options:
      --help               Show help                                   [boolean]
      --version            Show version number                         [boolean]
  -j, --pkg-src            Package.json source dir       [string] [default: "."]
  -k, --pkg-dst            Package.json dest dir    [string] [default: "./dist"]
  -c, --zip-dir            Zip input directory      [string] [default: "./dist"]
  -d, --zip-out            Zip output directory [string] [default: "./zip"]
  -f, --files-src-to-copy  File paths to copy              [array] [default: []]
  -g, --files-dst-to-copy  File destination paths          [array] [default: []]
  -r, --tasks              Tasks in the given order
          [array] [choices: "package", "zip", "deps", "copyfiles"] [default: []]

Examples:
  $ npx node-postbuild-cli --tasks package copyfiles      It runs tasks: package, deps and zip
  deps zip --files-src-to-copy ./.env       with default values and copyfiles
  ./ecosystem.config.js                     .env, ecosystem.config.js to ./dist
  --files-dst-to-copy ./dist/.env
  ./dist/ecosystem.config.js
  ----                                      ----
  $ npx node-postbuild-cli --tasks package deps zip       It runs tasks: package and deps with
  --zip-out ./zipped                        default values and zip with custom
                                            output directory

Example

$ npx node-postbuild-cli --tasks package deps zip
// It copies package.json file from . to ./dist, run npm install in ./dist and zipping ./dist to ./dist-zip/dist.zip

$ npx node-postbuild-cli --tasks package deps zip --pkg-dst ./foo --zip-dir ./foo
// It copies package.json file from . to ./build, run npm install in ./build and zipping ./build to ./dist-zip/dist.zip

$ npx node-postbuild-cli --tasks copyfiles -f ./.env ./config.json -g ./foo/.env ./foo/new_config.json
// It copies files: .env and config.json from . to ./foo directory but changes name of config.json to new_config.json

$ npx node-postbuild-cli --tasks copyfiles zip -f ./.env ./config.json -g ./foo/.env ./foo/new_config.json --zipDir ./foo
// Same as above, but zips the directory ./foo to ./dist-zip/dist.zip

License

MIT © Damian Polak