salsita/chrome-extension-skeleton

Consider using crx npm module instead of crxmake.sh

ngyikp opened this issue · 2 comments

The bash script can't be easily used on Windows systems, I suggest using the crx module to generate the CRX and the key file if the developer needs to.

Here's a sample Grunt task that I'm using for my extension:

grunt.registerTask('crx', 'Generate crx file for Chrome', function() {
    grunt.log.writeln('Generating crx...');
    var done = this.async();

    var crxFile = new crx({
        privateKey: fs.readFileSync(__dirname + '/../key.pem')
    });

    crxFile.load(__dirname + '/tmp/crx').then(function() {
        return crxFile.pack();
    }).then(function(crxBuffer) {
        fs.writeFile(__dirname + "/dist/out.crx", crxBuffer, function() {
            grunt.log.ok('Done!');
            done();
        });
    });
});

Can you submit a pull request?

Inspired with PR#11, I used grunt-crx to make the skeleton Windows-friendly.