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

package-auto-version

v1.3.0

Published

Automatically update version and update changelog

Readme

Package Auto Version

by Clark Inada

This module is a reverse proxy server implemented in node. There are 2 ways to use: global install/standalone or as a module. When used as a standalone, a config file is create in /var/craydent/config/craydent-proxy/pconfig.json and will auto update the routes if the file is changed. This happens as well when used as a module and a file is provided as a config. This eliminates the need to restart the server for a configuration and/or route update.

Simple usage

Node.js module

$ npm i --save package-auto-version
// example config file when using the config option or if you set the property pav in the package.json
{
    "changelog": "<rootDir>/CHANGELOG.md", // this can also be a package
    "changelogTemplate": "<rootDir>//changelogTemplate.md", // this can also be a package
    "dateFormat": "m/d/y",
    "noPrompt": false,
    "promptTemplate": "<rootDir>/promptTemplate.md", // this can also be a package
    "transform": "",
    "transformAuthor": "",
    "transformGitMessage": "",
    "versions": "minor,major",
    "match": "\\|.*?\\|.*?\\|\n",
    "tags": [] // when using tags in a config, you can use regex patterns instead of strings: [/cust:/] vs ["cust:"]
}

There are 2 built in templates available to use (some more details below).

  • git-documentation.md
  • simple.md
// example config using built in templates
{
    "changelogTemplate": "package-auto-version/git-documentation",
    // or
    "changelogTemplate": "package-auto-version/simple.md",
}

Standalone

$ npm install -g package-auto-version
$ pav

CLI

Version

$ pav version;
$ pav --version;
$ pav -v;

pav version takes no arguments. This will output the current verion of the module.

Completion

$ pav completion;

pav completion takes no arguments. This will output the completion script which is used for tab completion.

Man

$ pav man;

pav man takes no arguments. This will output the manual.

Help

$ pav help;
$ pav --help;

pav --help/help will output the current help docs for the module.

Usage

$ pav {{./path/to/CHANGELOG.md}} {{./path/to/changelogTemplate.md}} {{./path/to/promptTemplate.md}} {{module/or/path/to/transform/file}} {{module/or/path/to/transformAuthor/file}} {{module/or/path/to/transformGitMessage/file}} '{{patch,minor,major,etc}}' {{/var/path/to/config.json}} {{true/false}} {{date.format}} {{regex.as.string}} {{array.as.string}}

$ pav -c {{./path/to/CHANGELOG.md}} -t {{./path/to/changelogTemplate.md}} -p {{./path/to/promptTemplate.md}} -r {{module/or/path/to/transform/file}} -a {{module/or/path/to/transformAuthor/file}} -i {{module/or/path/to/transformGitMessage/file}} -e '{{patch,minor,major,etc}}' -o {{/var/path/to/config.json}} -n {{true/false}} -d {{date.format}} -m {{regex.as.string}} -g {{array.as.string}}

$ pav --changelog {{./path/to/CHANGELOG.md}} --changelogTemplate {{./path/to/changelogTemplate.md}} --promptTemplate {{./path/to/promptTemplate.md}} --transform {{module/or/path/to/transform/file}} --transformAuthor {{module/or/path/to/transformAuthor/file}} --transformGitMessage {{module/or/path/to/transformGitMessage/file}} --versions '{{patch,minor,major,etc}}' --config {{/var/path/to/config.json}} --noPrompt {{true/false}} --date {{date.format}} --match {{regex.as.string}} --tags {{array.as.string}}

"-c,--changelog" default: "./CHANGELOG.md" "-t,--changelogTemplate" default: "./changelogTemplate.md" "-p,--promptTemplate" default: "./promptTemplate.md" "-r,--transform" "-a,--transformAuthor" "-i,--transformGitMessage" "-e,--versions" default: "patch" description: "specify comma separated list of versions to update the changelog (major | minor | (default) patch | premajor | preminor | prepatch | prerelease | from-git)." "-o,--config" "-n,--noPrompt" default: false "-d,--date" default: 'm/d/y' "-m,--match" default: "template" "-g,--tags" default: [] pav can take up to 12 arguments: changelog changelogTemplate promptTemplate transform (module or file path) transformAuthor (module or file path) transformGitMessage (module or file path) versions (comma separated list of major | minor | (default) patch | premajor | preminor | prepatch | prerelease | from-git) config (file path) noPrompt date match tags (comma separted list of custom tags) When arguments are missing, the CLI will use default values.

  1. changelog - changelog file (relative file path).(default is ./CHANGELOG.md) (-c,--changelog)
  2. changelogTemplate - changelog template file (relative file path).(default is ./changelogTemplate.md) (-t,--changelogTemplate)
  3. promptTemplate - prompt message template file (relative file path).(default is ./promptTemplate.md) (-p,--promptTemplate)
  4. transform - module or file to run a transformation when creating the changelog entry. (-r,--tranform)
  5. transformAuthor - module or file to run a transformation when parsing the author field. (-a,--tranformAuthor)
  6. transformGitMessage - module or file to run a transformation when parsing the git message. (-i,--tranformGitMessage)
  7. versions - Comma delimited list of semver version types. (default is "major,minor,patch,premajor,preminor,prepatch,prerelease,from-git") (-e,--versions)
  8. config - config file (file path). (-o,--config)
  9. noPrompt - flag specifying if you do [n]ot want to show the prompt.
  10. match - regex [m]atch to use as a marker of where to replace text for more complex templates.

Data provided to templates

    prompt -> message
    changelog ->
        author
        date // default m/d/y
        docs // array of strings
        features // array of strings
        fixes // array of strings
        gitLines // array of strings
        merges // array of strings
        others // array of strings
        tags -> { // object having properties listed in tags where ":" is stripped
            "cust": // array of strings or regex
        }
        version

Example Templates

Prompt template:

***\n\${message}\n***\nThis will be your git message. Please enter your text to change\n

Changelog template:

| ${version} | (${author}:\${date}) '${others.0}' ${FOREACH ${other} in ${others}}${other}${END FOREACH} |\n

There are templates you can consume in the templates folder:

git-documentation.md

  • The match config value should be "## \[.?\] - .?\n"
  • The template and match can be imported via package-auto-version/git-documentation and package-auto-version/git-documentation-match respectively.

simple.md

  • this does not require a match config

Complex templates with match

Changelog file

# Changelog

## [0.0.1] - 12/05/18

#### Docs
- message1
- message2

Template

## [${version}] - ${date}
${IF (${docs.length})}
#### Docs
- ${FOREACH ${doc} in ${docs}}doc${END FOREACH}
${END IF}

Match

{
    "match": "## \\[.*?\\] - .*?\n"
}

Result -> the regex will match the ## [0.0.1] - 12/05/18 and replace that with itself and the rendered template.

# Changelog

## [0.0.2] - 12/06/18

#### Docs
- message5
- message6

## [0.0.1] - 12/05/18

#### Docs
- message1
- message2

Download

Package-Auto-Version is released under the [Dual licensed under the MIT or GPL Version 2 licenses].