From 4311c2b6c229f554af46b28af9bf69b04902c803 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 11 Apr 2015 08:03:37 -0700 Subject: [PATCH] Feed our own zip file into the crx module. This gives us control over the timestamps, eliminating the last non-deterministic part of the build process (I hope). --- Gruntfile.coffee | 40 ++++-- npm-shrinkwrap.json | 336 ++++++++++++++++++++++++-------------------- package.json | 2 +- 3 files changed, 214 insertions(+), 164 deletions(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 10941bb43..74fdb6157 100755 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -1,3 +1,5 @@ +crx = require 'crx' + module.exports = (grunt) -> grunt.util.linefeed = '\n' @@ -134,7 +136,7 @@ module.exports = (grunt) -> expand: true filter: (src) -> pkg = grunt.config 'pkg' - grunt.file.isFile(src) and !grunt.file.isMatch(src, "testbuilds/#{pkg.name}#{pkg.meta.suffix.dev}.user.js") + grunt.file.isFile(src) and not grunt.file.isMatch(src, "testbuilds/#{pkg.name}#{pkg.meta.suffix.dev}.user.js") and not /\.crx\.zip$/.test(src) web: src: 'test.html' dest: 'index.html' @@ -236,6 +238,17 @@ module.exports = (grunt) -> privateKey: '../<%= pkg.name %>-keys/<%= pkg.name %>.pem' compress: + crx: + options: + archive: 'testbuilds/<%= pkg.name %><%= pkg.meta.suffix[pkg.channel] %>.crx.zip' + level: 9 + pretty: true + expand: true + flatten: true + src: 'testbuilds/crx<%= pkg.meta.suffix[pkg.channel] %>/*' + dest: '/' + date: '<%= pkg.meta.date %>' + mode: parseInt('644', 8) zip: options: archive: 'testbuilds/<%= pkg.name %>.zip' @@ -330,6 +343,7 @@ module.exports = (grunt) -> grunt.registerTask 'build-crx-channel', [ 'concat:crx' 'copy:crx' + 'compress:crx' ] grunt.registerTask 'build-crx', [ @@ -348,13 +362,21 @@ module.exports = (grunt) -> 'clean:tmpcrx' ] - grunt.registerTask 'pack', [ - 'set-channel:stable' - 'crx:prod' - 'set-channel:beta' - 'crx:prod' - 'set-channel:noupdate' - 'crx:prod' + grunt.registerTask 'sign-channel', 'Sign CRX package', (channel) -> + done = @async() + pkg = grunt.config 'pkg' + privateKey = grunt.file.read "../#{pkg.name}-keys/#{pkg.name}.pem" + archive = grunt.file.read "testbuilds/#{pkg.name}#{pkg.meta.suffix[channel]}.crx.zip", {encoding: null} + extension = new crx {privateKey, loaded: true} + extension.pack(archive).then((data) -> + grunt.file.write "testbuilds/#{pkg.name}#{pkg.meta.suffix[channel]}.crx", data + done() + ).catch(done) + + grunt.registerTask 'sign', [ + 'sign-channel:stable' + 'sign-channel:beta' + 'sign-channel:noupdate' ] grunt.registerTask 'build-userscript', [ @@ -381,7 +403,7 @@ module.exports = (grunt) -> grunt.registerTask 'full', [ 'build' - 'pack' + 'sign' 'copy:builds' ] diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index aad65934d..46cc83a2c 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -3,6 +3,188 @@ "npm-shrinkwrap-version": "5.3.0", "node-version": "v0.10.29", "dependencies": { + "crx": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/crx/-/crx-3.0.2.tgz", + "dependencies": { + "archiver": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/archiver/-/archiver-0.8.1.tgz", + "dependencies": { + "buffer-crc32": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.5.tgz" + }, + "file-utils": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/file-utils/-/file-utils-0.1.5.tgz", + "dependencies": { + "findup-sync": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz", + "dependencies": { + "lodash": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.1.tgz" + } + } + }, + "glob": { + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "minimatch": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", + "dependencies": { + "lru-cache": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.5.2.tgz" + }, + "sigmund": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz" + } + } + } + } + }, + "iconv-lite": { + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz" + }, + "isbinaryfile": { + "version": "0.1.9", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-0.1.9.tgz" + }, + "lodash": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.1.0.tgz" + }, + "minimatch": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", + "dependencies": { + "lru-cache": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.5.2.tgz" + }, + "sigmund": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz" + } + } + }, + "rimraf": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz" + } + } + }, + "lazystream": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-0.1.0.tgz" + }, + "lodash": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.1.tgz" + }, + "readable-stream": { + "version": "1.0.33", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz", + "dependencies": { + "core-util-is": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" + }, + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" + } + } + }, + "zip-stream": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-0.3.7.tgz", + "dependencies": { + "crc32-stream": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-0.2.0.tgz" + }, + "debug": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-1.0.4.tgz", + "dependencies": { + "ms": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.6.2.tgz" + } + } + }, + "deflate-crc32-stream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/deflate-crc32-stream/-/deflate-crc32-stream-0.1.2.tgz" + } + } + } + } + }, + "commander": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.7.1.tgz", + "dependencies": { + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz" + } + } + }, + "es6-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-2.0.1.tgz" + }, + "node-rsa": { + "version": "0.2.23", + "resolved": "https://registry.npmjs.org/node-rsa/-/node-rsa-0.2.23.tgz", + "dependencies": { + "asn1": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.2.tgz" + }, + "lodash": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.3.0.tgz" + } + } + }, + "temp": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/temp/-/temp-0.8.1.tgz", + "dependencies": { + "rimraf": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz" + } + } + }, + "wrench": { + "version": "1.5.8", + "resolved": "https://registry.npmjs.org/wrench/-/wrench-1.5.8.tgz" + } + } + }, "font-awesome": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/font-awesome/-/font-awesome-4.3.0.tgz" @@ -815,160 +997,6 @@ } } }, - "grunt-crx": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/grunt-crx/-/grunt-crx-0.3.4.tgz", - "dependencies": { - "crx": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/crx/-/crx-0.4.4.tgz", - "dependencies": { - "archiver": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/archiver/-/archiver-0.8.1.tgz", - "dependencies": { - "buffer-crc32": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.5.tgz" - }, - "file-utils": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/file-utils/-/file-utils-0.1.5.tgz", - "dependencies": { - "findup-sync": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz", - "dependencies": { - "lodash": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.1.tgz" - } - } - }, - "glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", - "dependencies": { - "inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" - }, - "minimatch": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", - "dependencies": { - "lru-cache": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.5.0.tgz" - }, - "sigmund": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz" - } - } - } - } - }, - "iconv-lite": { - "version": "0.2.11", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz" - }, - "isbinaryfile": { - "version": "0.1.9", - "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-0.1.9.tgz" - }, - "lodash": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.1.0.tgz" - }, - "minimatch": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", - "dependencies": { - "lru-cache": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.5.0.tgz" - }, - "sigmund": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz" - } - } - }, - "rimraf": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz" - } - } - }, - "lazystream": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-0.1.0.tgz" - }, - "lodash": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.1.tgz" - }, - "readable-stream": { - "version": "1.0.33", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz", - "dependencies": { - "core-util-is": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" - }, - "inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" - } - } - }, - "zip-stream": { - "version": "0.3.7", - "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-0.3.7.tgz", - "dependencies": { - "crc32-stream": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-0.2.0.tgz" - }, - "debug": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-1.0.4.tgz", - "dependencies": { - "ms": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.6.2.tgz" - } - } - }, - "deflate-crc32-stream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/deflate-crc32-stream/-/deflate-crc32-stream-0.1.2.tgz" - } - } - } - } - }, - "commander": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.6.0.tgz" - }, - "wrench": { - "version": "1.5.8", - "resolved": "https://registry.npmjs.org/wrench/-/wrench-1.5.8.tgz" - } - } - } - } - }, "grunt-markdown": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/grunt-markdown/-/grunt-markdown-0.7.0.tgz", diff --git a/package.json b/package.json index 344553b75..712e8a401 100755 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ } }, "devDependencies": { + "crx": "^3.0.2", "font-awesome": "4.3.0", "grunt": "^0.4.5", "grunt-concurrent": "^1.0.0", @@ -53,7 +54,6 @@ "grunt-contrib-copy": "^0.8.0", "grunt-contrib-jshint": "^0.11.1", "grunt-contrib-watch": "^0.6.1", - "grunt-crx": "^0.3.4", "grunt-markdown": "^0.7.0", "grunt-shell": "^1.1.2", "grunt-webstore-upload": "^0.8.2",