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

npm-jetpack

v1.2.3

Published

NPX tool for handling npm packages versions for publishing

Downloads

6

Readme

npm-jetpack

Description

This package is dedicated to help in handling npm packages versions for publishing.

Usage overview

What does npm-jetpack do

  1. Takes current package.json ();
  2. Updates version according to flag / params;
  3. Saves updated package.json to dist folder (project root if dist not provided);
  4. Overwrites original ('single source of truth') package.json for future updates;
  5. Commits new changes in project and package.json updated to git (on demand via flag);
  6. Publishes package to npm (on demand via flag);
  7. ?????????
  8. PROFIT!1!!!

Options, flags and parameters

Options and their defaults:

{
    distDirPath: '',
    // relative path to final directory to be published
    // usually it is "build" or "dist" or any other dir
    // where author puts final package distributive for npm
    // the tool will place updated package.json there
    
    packageJsonPath: 'package.json', // relative path to package.json
    // the initial package.json file with current version of
    // package being published (it can be root repository
    // package.json or package.json in "build" or "dist" dir
    // - the most important for it is to handle current version
    // of the package published)
    
    versionUpdateType: 2, // 'patch'
    // it is target version part to increment, with 0 | 1 | 2 values
    // reflecting index of the part, 2 - 'patch', 1 - 'minor', 0 - 'major'.
    
    releaseSuffix: '', // no release suffix
    // will be added to new version if provided
    
    gitCommit: false, // only on demand
    // tool will run sequently 'git add .', 'git commit -m "Version update to ${nextVersion}"',
    // 'git push' commands when package.json is updated
    
    doPublish: false, // only on demand
    // tool will run "npm publish" command in the end of its work 
}

Flags:

Choose one or none (default "--patch" will be applied)
    "--patch" - will increase 'patch' version (versionUpdateType 2)
    "--minor" - will increase 'minor' version (versionUpdateType 1)
    "--major" - will increase 'major' version (versionUpdateType 0)
    "--commit" - will apply true to 'gitCommit' param
    "--publish" - will apply true to 'doPublish' param

Parameters:

    --distDirPath path/to/my/dist/dir
    --packageJsonPath path/to/my/main/source/package.json
    --releaseSuffix -alfa

You can use this package in both "npx" and "npm i -D" approaches.

Usage as NPX

Can be used in package.json npm scripts or via CLI:

    npx npm-jetpack <FLAGS_AND_PARAMETERS>

Sample:

    npx npm-jetpack
                    --major
                    --packageJsonPath package.json
                    --distDirPath build
                    --releaseSuffix -pr20
                    --commit
                    --publish

Usage as NPM

    npm install -D npm-jetpack

and then use it in package.json npm scripts like this:

scripts: {
    "update": "npm run test & npm-jetpack --releaseSuffix -alpha --commit --publish",
    "update-minor": "npm run test & npm-jetpack --minor --commit --publish",
    "update-major": "npm run test & npm-jetpack --major --commit --publish"
}

Also it can be used in projects postbild scripts with passed options object:

    const npmJetpack = require('npm-jetpack');
    // OR import npmJetpack from 'npm-jetpack';
    
    npmJetpack({
        distDirPath: 'dist', // relative path to final directory to be published
        packageJsonPath: 'package.json', // relative path to package.json
        versionUpdateType: 2, // 'patch'
        releaseSuffix: '-beta', // release suffix
        gitCommit: true, // do not mention if won't use
        doPublish: true, // do not mention if won't use
    });