Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
/ broccoli-version Public archive

Broccoli plugin for incrementing version numbers in package.json and bower.json files

License

Notifications You must be signed in to change notification settings

stfsy/broccoli-version

Repository files navigation

Broccoli Version Plugin

Build Status Dependency Status DevDependency Status Npm downloads Npm Version Git tag Github issues License

Broccoli plugin for incrementing version numbers in bower.json and package.json files

Example

const BroccoliVersion = require('broccoli-version')

const versioned = new BroccoliVersion('app', {
    major: false,
    minor: false,
    patch: true,
    meta: (options) => {
        if(!options.major && !options.minor && !options.patch) {
            return options.meta += 1
        } else {
            return 0
        }
    }
    targets: {
        npm: true,
        bower: false
    }
})

module.exports = versioned

Example incrementing daily builds

const BroccoliVersion = require('broccoli-version')

const versioned = new BroccoliVersion('app', {
    meta: (options) => {
        let builds = 0
            
        const now = new Date()
        const string = [now.getFullYear(), now.getMonth() + 1, now.getDay()].join('')

        if (options.meta && options.meta.indexOf(string) > -1) {
            builds = parseInt(options.meta.split('-')[1])
        }

        return [string, ++builds].join('-')
    },
    targets: {
        npm: true,
        bower: false
    }
})

module.exports = versioned

Installation

npm install broccoli-version --save-dev

Documentation

new BroccoliVersion(inputNodes, options)

  • inputNodes: An array of input nodes, or a string pointing to a folder.

  • options:

    • major, minor, patch: Boolean flags specifying what parts of the version number should be incremented.

    • meta: An optional function returning additional build metadata. The function is called with the three boolean flags mentioned above plus the current value of the build meta data or null. Build meta data is appended to the version with a leading '+'.

    • targets: An object specifying what configuration files should be updated. Needs at least npm set to true.

The returned output node contains umodified copies of all files and subfolders of the input nodes.

License

This project is distributed under the MIT license.

About

Broccoli plugin for incrementing version numbers in package.json and bower.json files

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published