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

broccoli-version

v1.2.0

Published

Broccoli plugin for incrementing version numbers in .json files

Downloads

7

Readme

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.