gulp/versioning.js
function extractPackageVersion(inPath) {
    if (!inPath) {
        throw new Error('Input path argument is required');
    }

    // Require here so we have the update version.
    const pkg = fs.readFileSync(inPath, 'utf-8');

    // index 0 is line that matched, index 1 is first control group (version number in this case)
    const matches = /"version": "([0-9]+\.[0-9]+\.[0-9]+)"/.exec(pkg);
    const version = matches[1];

    return version;
}
function extractPackageVersion(inPath) {
    if (!inPath) {
        throw new Error('Input path argument is required');
    }

    // Require here so we have the update version.
    const pkg = fs.readFileSync(inPath, 'utf-8');

    // index 0 is line that matched, index 1 is first control group (version number in this case)
    const matches = /"version": "([0-9]+\.[0-9]+\.[0-9]+)"/.exec(pkg);
    const version = matches[1];

    return version;
}
function extractPackageVersion ( inPath ) { if ( ! inPath ) { throw new Error ( 'Input path argument is required' ) ; } // Require here so we have the update version. const pkg = fs . readFileSync ( inPath , 'utf-8' ) ; // index 0 is line that matched, index 1 is first control group (version number in this case) const matches = / "version": "([0-9]+\.[0-9]+\.[0-9]+)" / . exec ( pkg ) ; const version = matches [ 1 ] ; return version ; }
Sync function that takes a package.json path and extracts the version from it.
@param  {string} inPath Path to the project's package.json
@return {string}        The extracted version number in the form 'X.Y.Z'
Sync function that takes a package . json path and extracts the version from it .