How to use the google-closure-compiler/package.json.version.replace function in google-closure-compiler

To help you get started, we’ve selected a few google-closure-compiler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Feverqwe / tSearch / Gruntfile.js View on Github external
var compressJs = (function () {
        var ccVersion = require('google-closure-compiler/package.json').version;
        var version = ccVersion.replace(/[^\d]/, '_');
        var ClosureCompiler = require('google-closure-compiler').compiler;
        var crypto = require('crypto');
        var fs = require('fs');
        var getHash = function(filePath) {
            return new Promise(function (resolve) {
                var fd = fs.createReadStream(filePath);
                var hash = crypto.createHash('sha256');
                hash.setEncoding('hex');
                fd.on('end', function () {
                    hash.end();
                    resolve(hash.read());
                });
                fd.pipe(hash);
            });
        };
        var fileExists = function (filePath) {