tools/sign.js
This commit is contained in:
parent
39f4e05520
commit
1ad999e12e
@ -1,5 +1,4 @@
|
|||||||
path = require 'path'
|
path = require 'path'
|
||||||
crx = require 'crx'
|
|
||||||
|
|
||||||
module.exports = (grunt) ->
|
module.exports = (grunt) ->
|
||||||
grunt.util.linefeed = '\n'
|
grunt.util.linefeed = '\n'
|
||||||
@ -113,6 +112,8 @@ module.exports = (grunt) ->
|
|||||||
""".split('\n').join('&&')
|
""".split('\n').join('&&')
|
||||||
install:
|
install:
|
||||||
command: 'node tools/install.js'
|
command: 'node tools/install.js'
|
||||||
|
sign:
|
||||||
|
command: (channel='') -> "node tools/sign.js #{channel}"
|
||||||
'copy-builds':
|
'copy-builds':
|
||||||
command: '<%= builds.map(file => `node tools/cp.js testbuilds/${file} builds/${file}`).join("&&") %>'
|
command: '<%= builds.map(file => `node tools/cp.js testbuilds/${file} builds/${file}`).join("&&") %>'
|
||||||
markdown:
|
markdown:
|
||||||
@ -215,21 +216,10 @@ module.exports = (grunt) ->
|
|||||||
'shell:copy-zip'
|
'shell:copy-zip'
|
||||||
]
|
]
|
||||||
|
|
||||||
grunt.registerTask 'sign-channel', 'Sign CRX package', (channel='') ->
|
|
||||||
done = @async()
|
|
||||||
pkg = grunt.config 'pkg'
|
|
||||||
privateKey = grunt.file.read "../#{pkg.meta.path}.keys/#{pkg.name}.pem"
|
|
||||||
archive = grunt.file.read "testbuilds/#{pkg.name}#{channel}.crx.zip", {encoding: null}
|
|
||||||
extension = new crx {privateKey, loaded: true}
|
|
||||||
extension.pack(archive).then((data) ->
|
|
||||||
grunt.file.write "testbuilds/#{pkg.name}#{channel}.crx", data
|
|
||||||
done()
|
|
||||||
).catch(done)
|
|
||||||
|
|
||||||
grunt.registerTask 'sign', [
|
grunt.registerTask 'sign', [
|
||||||
'sign-channel'
|
'shell:sign'
|
||||||
'sign-channel:-beta'
|
'shell:sign:-beta'
|
||||||
'sign-channel:-noupdate'
|
'shell:sign:-noupdate'
|
||||||
]
|
]
|
||||||
|
|
||||||
grunt.registerTask 'build-userscript', [
|
grunt.registerTask 'build-userscript', [
|
||||||
|
|||||||
14
tools/sign.js
Normal file
14
tools/sign.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
fs = require('fs');
|
||||||
|
crx = require('crx');
|
||||||
|
|
||||||
|
var pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
||||||
|
var channel = process.argv[2] || '';
|
||||||
|
|
||||||
|
var privateKey = fs.readFileSync(`../${pkg.meta.path}.keys/${pkg.name}.pem`)
|
||||||
|
var archive = fs.readFileSync(`testbuilds/${pkg.name}${channel}.crx.zip`);
|
||||||
|
var extension = new crx({privateKey, loaded: true});
|
||||||
|
extension.pack(archive).then((data) =>
|
||||||
|
fs.writeFileSync(`testbuilds/${pkg.name}${channel}.crx`, data)
|
||||||
|
).catch(function(err) {
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user