tools/release.js
function bumpVersion(files, bumpType) {
    status('Bump', bumpType, 'version to files:', files.join(' '));
    if (config.dryRun) return '[not available in dry run]';

    var newVersion;
    var originalVersion;
    files.forEach(function(fileName) {
        var filePath = path.join(projectRoot, fileName);

        var data = JSON.parse(fs.readFileSync(filePath));
        originalVersion = data.version;
        var currentVersion = data.version;
        if (!semver.valid(currentVersion)) {
            var msg = 'Invalid version ' + currentVersion +
                ' in file ' + fileName;;
            var err = new Error(msg);
            throw err;
        }

        if (S(currentVersion).endsWith(config.devSuffix)) {
            currentVersion = S(currentVersion).chompRight(config.devSuffix).s;
        }

        if (bumpType === 'dev') {
            newVersion = currentVersion + config.devSuffix;
        } else {
            newVersion = semver.inc(currentVersion, bumpType);
        }
        data.version = newVersion;

        var content = JSON.stringify(data, null, config.indentation);
        fs.writeFileSync(filePath, content);

        status('Bump', originalVersion, '->', newVersion, 'in',
            fileName);
    });

    return newVersion;
}
function bumpVersion(files, bumpType) {
    status('Bump', bumpType, 'version to files:', files.join(' '));
    if (config.dryRun) return '[not available in dry run]';

    var newVersion;
    var originalVersion;
    files.forEach(function(fileName) {
        var filePath = path.join(projectRoot, fileName);

        var data = JSON.parse(fs.readFileSync(filePath));
        originalVersion = data.version;
        var currentVersion = data.version;
        if (!semver.valid(currentVersion)) {
            var msg = 'Invalid version ' + currentVersion +
                ' in file ' + fileName;;
            var err = new Error(msg);
            throw err;
        }

        if (S(currentVersion).endsWith(config.devSuffix)) {
            currentVersion = S(currentVersion).chompRight(config.devSuffix).s;
        }

        if (bumpType === 'dev') {
            newVersion = currentVersion + config.devSuffix;
        } else {
            newVersion = semver.inc(currentVersion, bumpType);
        }
        data.version = newVersion;

        var content = JSON.stringify(data, null, config.indentation);
        fs.writeFileSync(filePath, content);

        status('Bump', originalVersion, '->', newVersion, 'in',
            fileName);
    });

    return newVersion;
}
function bumpVersion ( files , bumpType ) { status ( 'Bump' , bumpType , 'version to files:' , files . join ( ' ' ) ) ; if ( config . dryRun ) return '[not available in dry run]' ; var newVersion ; var originalVersion ; files . forEach ( function ( fileName ) { var filePath = path . join ( projectRoot , fileName ) ; var data = JSON . parse ( fs . readFileSync ( filePath ) ) ; originalVersion = data . version ; var currentVersion = data . version ; if ( ! semver . valid ( currentVersion ) ) { var msg = 'Invalid version ' + currentVersion + ' in file ' + fileName ; ; var err = new Error ( msg ) ; throw err ; } if ( S ( currentVersion ) . endsWith ( config . devSuffix ) ) { currentVersion = S ( currentVersion ) . chompRight ( config . devSuffix ) . s ; } if ( bumpType === 'dev' ) { newVersion = currentVersion + config . devSuffix ; } else { newVersion = semver . inc ( currentVersion , bumpType ) ; } data . version = newVersion ; var content = JSON . stringify ( data , null , config . indentation ) ; fs . writeFileSync ( filePath , content ) ; status ( 'Bump' , originalVersion , '->' , newVersion , 'in' , fileName ) ; } ) ; return newVersion ; }
Bumps version in specified files. Files are assumed to contain JSON data which has "version" key following semantic versioning
Bumps version in specified files . Files are assumed to contain JSON data which has version key following semantic versioning