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

nbump

v2.0.7

Published

A small command line tool to simplify releasing software by updating all version strings in your source code by the correct increment. Out of box, UI friendly and configure easily. And with other features:

Downloads

2,773

Readme

[New] Bump version

A small command line tool to simplify releasing software by updating all version strings in your source code by the correct increment. Out of box, UI friendly and configure easily. And with other features:

Install

npm i -g nbump

Setup

Define in package.json add field bump or create bump.config.js in root dir:

[!NOTE] The configuration loader by c12

There is a example configuration.

// bump.config.ts
import { defineConfig } from 'nbump'

export default defineConfig({
  leading: ['git pull --rebase', 'pnpm i', 'npm run build'],
  trailing: [],
  publish: true,
  changelog: true,
  mode: 'monorepo',
  allowedBranches: ['dev/*', 'master', 'main'],
  packages: ['test/packages/**'],
})

Usage

vv # or bump
vv alpha # bump to next prerelease version, other args please see below.

Feature

Hooks

There are two kind of hooks supported.

  1. leading hook, this hook will run before package json version updated.
  2. trailing hook, run after updated of course.

E.g.

{
  "leading": ["git pull --rebase", "pnpm i"],
  "trailing": ["npm run build"]
}

Attach Changelog

Auto detect changelog file location, and regenerate after update package version.

To enable it.

{
  "changelog": true
}

Whitelist or Blacklist branch

The bump version allows you ban special branch run it, such as you don't want to be contaminated other branches which is not main branch. In main branch, you just allow publish stable version, but ban unstable version. Oppositely, dev branch not allow to publish stable version just unstable. It's ok. Just write configuration as below.

{
  "allowed_branches": [
    "main",
    {
      "name": "dev/*",
      "allow_types": ["premajor", "preminor", "prepatch", "prerelease"]
    }
  ]
}

Git Tag Mode

If the project maintains by a team and other developers can publish their own unstable version, the publish action will create a git tag based on new version. So, if another developer bump version at same time, he will got a conflict error because of git tag is exist on remote repository.

For example, if Developer A and Developer B checkout two private branches from the master branch and fix a bug that requires release new version. At this point, the projects are both at version 1.0.0, and A has created a Git Tag 1.0.0-alpha.0 on the private branch and pushed it to the remote repository, while B has also created a Git Tag 1.0.0-alpha.0 on the private branch, and there is a conflict.

So, the tool provide git tag mode, it can fetch remote git tags, and gerenate the correct version according to the git tags (or remote) sequence, and no conflicting tags are generated.

To enable it.

{
  "with_tags": true,
  "remote_tags": true
}

Now if your local or remote tags has tag 1.0.1, but project current version is 1.0.0, so the next patch version will be generate as 1.0.2.

Another example, if remote tags has tag 1.2.0 1.3.0, project current version is 1.1.0, the next minor version is 1.2.0 theoretically, but if you enable this feature, it will generate a non-conflicting version as 1.4.0.

Other information, please see the test suit.

Args

This is args passed in cli command. e.g. vv --dry-run.

| Args | Description | Example | | ------------------------ | -------------------------------------------------------------- | ------------------ | | --dry-run | Dry run mode | | | -f --filter | Run in special monorepo workspace | -f packages/core | | --alpha --prerelease | Create prerelease version | | | --tag-prefix | Custom git tag prefix, the priority is higher than config file | | | --no-verify | Force bump version, no verify allowed branches or disallow. | | | minor | Create minor version | | | major | Create major version | | | patch | Create patch version | | | prepatch | Create prepatch version | | | preminor | Create preminor version | | | premajor | Create premajor version | | | branch | Create version based on git branch (1.2.2-dev-perid.0) | |

Configuration

| Name | Description | Type | Default | | ---------------- | --------------------------------------------------------------------------------- | ---------------------------------------------- | -------------------------- | | leading | Run script before change version | string[] | [] | | trailing | Run script after change version | string[] | [] | | publish | Publish package after bump | boolean | false | | tag | Create git tag after bump | boolean | true | | push | Push git commit after bump | boolean | true | | commit_message | Commit message for new version tag | string | release: v${NEW_VERSION} | | changelog | Generate changelog | boolean | ChangelogOptions | false | | allowed_branches | Allow run bump version on special branch | (RegExp | string | AllowedBranchesOptions)[] | ["main", "master"] | | tag-prefix | Git prefix tag | string | v | | mode | Workspace mode | independent monorepo | independent | | packages | Monorepo mode packages path | string[] | [] | | with_tags | Generate next version based on git tags, maybe slowly. | boolean | false | | remote_tags | Fetch git remote tags before version generate, only work when with_tags enable. | boolean | true |

Interface

type ReleaseType =
  | 'patch'
  | 'minor'
  | 'major'
  | 'premajor'
  | 'preminor'
  | 'prepatch'
  | 'prerelease'

export interface AllowedBranchesOptions {
  name: string
  disallowTypes: ReleaseType[]
  allowTypes: ReleaseType[]
}

/**
 * @see https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-core
 */
export type ChangelogOptions = Parameters<typeof conventionalChangelog>[0] & {
  enable: boolean
}

License

2024 © Innei, Released under the MIT License.

Personal Website · GitHub @Innei