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

@weichwarenprojekt/wersion

v1.3.5

Published

A cli tool and lib to automatically version your projects.

Downloads

285

Readme

Quickstart

Wersion offers you an automatic workflow for improving your deployment process. It increases your projects version ( including adding a git tag) and generates a release log from your git history. To determine how the version must be increased wersion uses the commit type from conventional commits. E.g. a fix commit results in increasing the patch version. The default behaviour can be adjusted with a custom config (Configuration).

Installation

npm i @weichwarenprojekt/wersion --save-dev

Initialization

The initialization command creates the .wersionrc.ts configration file. The created config depends on the selected preset (npm or flutter). Further the command will create a git tag on the last commit with the current version of your project to enable versioning.

npx wersion --init

Execution

Basic usage to create a new version:

npx wersion

Creating a new version includes creating the tag, increasing the version in the configured version file and creating the changelog.

npx wersion --releaseAs=[patch|minor|major]

See (Options) for further information

Automatic Versioning

Wersion will increase the version once the script is called depending on your git history since the last version tag. It uses the conventional commit style to determine which part of the version has to be increased. A fix commit ("fix( scope): Message) will increase the patch version of your project. Similarly, a feat commit will increase your minor version. Your major version will only be automatically increased if a commit contains a breaking change. This is signalized by the string "breaking change" in a commits body. The whole behaviour can be adjusted with different commit types for different version increases and a custom breaking change text. Alternatively your always free to increase the version customized by running wersion --releaseAs=[patch|minor|major].

Changelog generation

The generated text will be added to your changelog file (path and name customizable). Wersion uses your git history and groups commits in feature and bugfix blocks. Those blocks than are added to the changelog file with the new version as the header. For an example checkout the CHANGELOG.md of wersion itself.

Options

wersion --releaseAs=[patch|minor|major]

The "releaseAs" option allows you to manually increase the version of your project.

wersion --dry-run

"dry-run" prevents wersion from generation any commits or file-changes. Useful for testing the command and see which versions will be increased.

wersion --incrementBuildNumber

This mode allows you to increment the build number for local commits. E.g. you can use it in combination with husky hooks to automatically increment your build number each time you create a new commit.

Configuration

Configure your project with a .wersionrc.ts file on top level.
Default configuration:

import { WersionConfigModel } from "@weichwarenprojekt/wersion";

export const configuration: Partial<WersionConfigModel> = {
  versionFile: {
    path: "./package.json",
    matcher: '"version": ?"([0-9.]+)"',
  },
  commitTypes: {
    major: [],
    minor: ["feat"],
    patch: ["fix", "docs"],
  },
  breakingChangeTrigger: "breaking change",
  changelogFilePath: "./CHANGELOG.md",
};

| Config | | Description | |-----------------------|---------|------------------------------------------------------------------------------------------------------------| | versionFile | | | | | path | Path to the file in which the projects version is tracked (e.g. ./package.json ) | | | matcher | Regex matcher to select the version inside the version file | | commitTypes | | | | | major | Array of commit types which trigger a increase of the major version e.g. ["feat"] | | | minor | same for minor version | | | patch | same for patch version | | breakingChangeTrigger | | String that triggers an breaking change ergo an increase of the major version if written in a commits body | | changelogFilePath | | Configuration of the automatically generated changelog file (e.g. ./CHANGELOG.md) | | projectName | | Optional project name which is prepended to each git tag |

Troubleshooting

The current file is a CommonJS module whose imports will produce require calls

This happens because you probably have configured version for a CommonJS package/project (no "type": "module" in the package.json). Rename the configuration to .wersionrc.mts. Like that it will be treated as an ESM module.

ATTENTION The configuration will still be imported as a CommonJS module, so you will not be able to actually import ESM modules! This is just for the error to disappear.

Contribution

Feel free creating an issue or PR :)

e2e

We are using an extra repository to create the project structure in which we are running our e2e tests: http://github.com/Weichwarenprojekt/wersion-e2e