gulp-azp-bump

2.0.0 • Public • Published

gulp-azp-bump

Gulp plugin to bump the version of Azure Pipelines tasks. Note this is also available as a standalone CLI/Lib.

npmjs version Badge npmjs downloads Badge License Badge

Circle CI Badge AppVeyor Status Test Results Badge Coverage Status Sonar Quality Gate

Feature Completion Notice

Please note that we consider this package to be feature complete. We will continue to maintain and support this package by fixing any bugs discovered, updating dependency versions, etc. We will also consider PRs/Enhancement requests, but we do not have additional development activities planned at this time.

About

Gulp plugin that supports bumping the versions of Azure Pipelines tasks. The Azure Pipelines task manifest files maintain the version as an Object which differs from the traditional semver string used to represent the version found in other files like package.json (note that the values of Major, Minor, Patch can be strings OR numbers).

Azure Pipelines task manifest example:

{
    "id": "923e6d5c-0b14-462b-922e-813cbd2ef4cc",
    "name": "2018azp",
    "friendlyName": "Sample Task",
    "description": "azp",
    "author": "me",
    "version": {
        "Major": 0,
        "Minor": 1,
        "Patch": 1
    },
}

The Azure Pipelines task version cannot be bumped using other gulp plugins without writing a lot of extra code, so we wrote this plugin to provide simple support specifically for Azure Pipelines tasks.

This plugin should only be used for bumping Azure Pipelines task manifest files. For bumping any other standard version string in any other type file (like in a package.json file) you should not use this plugin, and you should use something like gulp-bump instead.

Install

Install the package as a dev dependency:

npm i gulp-azp-bump --save-dev

Usage

Simple Usage (bumps patch version by default)

const gulp = require('gulp');
const azpBump = require('gulp-azp-bump');
 
gulp.task('tasks:bump', function () {
    return gulp.src(['./tasks/**/task.json'], { base: './' })
        .pipe(azpBump())
        .pipe(gulp.dest('./'));
});

Specific Bump Type

const gulp = require('gulp');
const azpBump = require('gulp-azp-bump');
 
gulp.task('tasks:bump', function () {
    return gulp.src(['./tasks/**/task.json'], { base: './' })
        .pipe(azpBump({ type: 'minor' }))
        .pipe(gulp.dest('./'));
});

Options

type: string

  • Default Value: 'patch'
  • Allowed Values: 'major', 'minor', 'patch'
  • Description: Specifies the release type you want to bump. Technically any valid semver type (including prerelease, etc.) will be accepted, but you shouldn't use anything other than major, minor, or patch since that is all Azure Pipelines tasks can store.

For example to bump the minor version value:

    .pipe(azpBump({ type: 'minor' }))

Or the major version value:

    .pipe(azpBump({ type: 'major' }))

quiet: boolean

  • Default Value: false
  • Allowed Values: true, false
  • Description: Set this to true if you want to suppress the log output

Example:

    .pipe(azpBump({ quiet: true }))

versionPropertyType: string

  • Default Value: 'number'
  • Allowed Values: 'number', 'string'
  • Description: Specifies whether the emitted version property values should be numbers or strings. Some Azure Pipelines tasks specify the values for the version Major, Minor, and Patch properties as a number while others store it as a string (Azure Pipelines supports both apparently). By default the plugin will emit the bumped version values as numbers in the task.json file(s), but if you would prefer those values to be strings instead then set this property to 'string' in the configuration options

Example:

    .pipe(azpBump({ versionPropertyType: 'string' }))

If the initial version object in your task.json file looks like this:

    "version"{
        "Major": 0,
        "Minor": 1,
        "Patch": 1
    },

If you run the plugin with the default options (bumps patch), then the emitted bumped version object will have the Patch version bumped and the values will be numbers:

    .pipe(azpBump())

Emitted task.json version object:

    "version"{
        "Major": 0,
        "Minor": 1,
        "Patch": 2
    },

If instead you specified 'string' for the versionPropertyType, then the emitted bumped version object will have the Patch version bumped and the values will be strings:

    .pipe(azpBump({ versionPropertyType: 'string' }))

Emitted task.json version object:

    "version"{
        "Major": "0",
        "Minor": "1",
        "Patch": "2"
    },

indent: number OR string

  • Default Value: 2
  • Allowed Values: Any positive whole number between 1 and 10 inclusive, or the tab character '\t'
  • Description: Controls the spacing indent value to use in the updated task.json file(s). If a number is specified, each level in the json file will be indented by that number of space characters. Alternatively, if the tab '\t' character is specified, then each level will be indented with a tab.

For example to indent by 4 spaces:

    .pipe(azpBump({ indent: 4 }))

Or if you prefer a tab:

    .pipe(azpBump({ indent: '\t' }))

License

MIT - see license details here

Contributing

Need to open an issue? Click the below links to create one:

See the Guidelines for more info about building and developing.

Package Sidebar

Install

npm i gulp-azp-bump

Weekly Downloads

2

Version

2.0.0

License

MIT

Unpacked Size

19.2 kB

Total Files

8

Last publish

Collaborators

  • traviskosarek
  • ronswanson
  • beverts312
  • calebcartwright
  • swellbot