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

simple-versioner

v1.2.1

Published

Create version based on data from the build

Downloads

493

Readme

simple-versioner

Build Status

npm version

Overview

Build versioning tool for Azure DevOps. It will update your versioning file with a new generated version if the build is executed from a non stable branch.
So that you will always have a unique version that is build, even during PR builds.
As a bonus it will also update the pipeline name to reflect that new version so that you never have to look for the correct build again.

You can have a look at the builds of this plugin to see how that will be shown in Azure DevOps

Usage

npx simple-versioner

or install

npm i simple-versioner simple-versioner

Options

Other file then package.json

npx simple-versioner vss-extension.json

Disclaimer: only works on files that also have a field named version

Different stable branch

Default stable branch ismaster if you are using a different stable branch you can provided this via a parameter.

npx simple-versioner -b:main

Possible options

-b:BRANCH -> Specify a different branch as release branch.
-nu -> Do not set the buildnumber in azure, only update the version in the provided json file.
-mp -> When specified the generate version will be based on the date and time. ie: 2022.3.1647715987 -ntc -> No Tag Check, when passed it will not throw an error if the tag already exists. Handy when you need to recreate the version later on in the build process. Or don't care about tag already exists.

Using it in the Azure DevOps pipelines

Editor

You can add it via the editor:
Include an bash task:

npx simple-versioner

Yaml

- bash: 'npx simple-versioner'
  displayName: 'Get and set correct build version'

How it works

Default behavior

When it is a stable build: If the build is for the specified stable branch, the version would be left as is.
It will check if there are tags available with the specified version, if so it will throw an error stating that the version is already released. The build will then stop.
Unless the -ntc option is provided. Then this check if not done.

When it is a feature build:

  • version: 1.0.0
  • branch: develop
  • gitCommitSha = 7bea27af4e3095bf77701a4e8dc71e9a53140b55

Version send to Azure, and put into the provided file to version is 1.0.0-refs-heads-develop-7bea27af
note: / provided in the branchname are replaced by -

PR's are also handled and the correct branch and commitHash is used.

What happens in azure:
The Build.Buildnumber will be update to the version needed. The build name will then be changed to that version instead of predefined name.
Note: You can suppress this by providing the -nu option.

Alternative

When providing the -mp option a version based on the date/time will be generated for non release branches.
Used format: yy:MM:time The time is generated based on date.getTime() divide by 1000 and the rounded with Math.floor
The check if the version (provided in your json file) is still executed.
The buildnumber will also be updated, when nor suppressed.

This is usefull for when you are developing a VScode and/or Azure devops extension. As the marketplaces does not support prerelease version. (hence the -mp name :))

Contributing

Feel free to contribute! Just fork and create a PR.

Tests

Tests can be executed by running npm t