Get rid of suffix table; identify channels by suffix directly.
This commit is contained in:
parent
2343a74dac
commit
d08d69a9db
@ -61,7 +61,7 @@ module.exports = (grunt) ->
|
|||||||
dest: 'tmp/script.coffee'
|
dest: 'tmp/script.coffee'
|
||||||
crx:
|
crx:
|
||||||
files:
|
files:
|
||||||
'testbuilds/crx<%= pkg.meta.suffix[pkg.channel] %>/script.js': [
|
'testbuilds/crx<%= pkg.channel %>/script.js': [
|
||||||
'src/meta/botproc.js'
|
'src/meta/botproc.js'
|
||||||
'LICENSE'
|
'LICENSE'
|
||||||
'src/meta/usestrict.js'
|
'src/meta/usestrict.js'
|
||||||
@ -69,9 +69,9 @@ module.exports = (grunt) ->
|
|||||||
]
|
]
|
||||||
userscript:
|
userscript:
|
||||||
files:
|
files:
|
||||||
'testbuilds/<%= pkg.name %><%= pkg.meta.suffix[pkg.channel] %>.user.js': [
|
'testbuilds/<%= pkg.name %><%= pkg.channel %>.user.js': [
|
||||||
'src/meta/botproc.js'
|
'src/meta/botproc.js'
|
||||||
'testbuilds/<%= pkg.name %><%= pkg.meta.suffix[pkg.channel] %>.meta.js'
|
'testbuilds/<%= pkg.name %><%= pkg.channel %>.meta.js'
|
||||||
'LICENSE'
|
'LICENSE'
|
||||||
'src/meta/usestrict.js'
|
'src/meta/usestrict.js'
|
||||||
'tmp/script-userscript.js'
|
'tmp/script-userscript.js'
|
||||||
@ -80,11 +80,11 @@ module.exports = (grunt) ->
|
|||||||
copy:
|
copy:
|
||||||
crx:
|
crx:
|
||||||
src: ['src/meta/*.png', 'tmp/eventPage.js']
|
src: ['src/meta/*.png', 'tmp/eventPage.js']
|
||||||
dest: 'testbuilds/crx<%= pkg.meta.suffix[pkg.channel] %>/'
|
dest: 'testbuilds/crx<%= pkg.channel %>/'
|
||||||
expand: true
|
expand: true
|
||||||
flatten: true
|
flatten: true
|
||||||
zip:
|
zip:
|
||||||
src: 'testbuilds/<%= pkg.name %><%= pkg.meta.suffix.noupdate %>.crx.zip'
|
src: 'testbuilds/<%= pkg.name %>-noupdate.crx.zip'
|
||||||
dest: 'testbuilds/<%= pkg.name %>.zip'
|
dest: 'testbuilds/<%= pkg.name %>.zip'
|
||||||
builds:
|
builds:
|
||||||
src: ['testbuilds/*.js', 'testbuilds/*.crx', 'testbuilds/*.xml', 'testbuilds/<%= pkg.name %>.zip']
|
src: ['testbuilds/*.js', 'testbuilds/*.crx', 'testbuilds/*.xml', 'testbuilds/<%= pkg.name %>.zip']
|
||||||
@ -119,8 +119,8 @@ module.exports = (grunt) ->
|
|||||||
""".split('\n').join('&&').replace(/\//g, path.sep)
|
""".split('\n').join('&&').replace(/\//g, path.sep)
|
||||||
'templates-crx-meta':
|
'templates-crx-meta':
|
||||||
command: """
|
command: """
|
||||||
node_modules/.bin/coffee tools/templates.coffee src/meta/updates.xml testbuilds/updates<%= pkg.meta.suffix[pkg.channel] %>.xml type=crx channel=<%= pkg.channel %>
|
node_modules/.bin/coffee tools/templates.coffee src/meta/updates.xml testbuilds/updates<%= pkg.channel %>.xml type=crx channel=<%= pkg.channel %>
|
||||||
node_modules/.bin/coffee tools/templates.coffee src/meta/manifest.json testbuilds/crx<%= pkg.meta.suffix[pkg.channel] %>/manifest.json type=crx channel=<%= pkg.channel %>
|
node_modules/.bin/coffee tools/templates.coffee src/meta/manifest.json testbuilds/crx<%= pkg.channel %>/manifest.json type=crx channel=<%= pkg.channel %>
|
||||||
""".split('\n').join('&&').replace(/\//g, path.sep)
|
""".split('\n').join('&&').replace(/\//g, path.sep)
|
||||||
userscript:
|
userscript:
|
||||||
command: """
|
command: """
|
||||||
@ -129,7 +129,7 @@ module.exports = (grunt) ->
|
|||||||
node_modules/.bin/jshint tmp/script-userscript.js
|
node_modules/.bin/jshint tmp/script-userscript.js
|
||||||
""".split('\n').join('&&').replace(/\//g, path.sep)
|
""".split('\n').join('&&').replace(/\//g, path.sep)
|
||||||
'templates-userscript-meta':
|
'templates-userscript-meta':
|
||||||
command: 'node_modules/.bin/coffee tools/templates.coffee src/meta/metadata.js testbuilds/<%= pkg.name %><%= pkg.meta.suffix[pkg.channel] %>.meta.js type=userscript channel=<%= pkg.channel %>'.replace(/\//g, path.sep)
|
command: 'node_modules/.bin/coffee tools/templates.coffee src/meta/metadata.js testbuilds/<%= pkg.name %><%= pkg.channel %>.meta.js type=userscript channel=<%= pkg.channel %>'.replace(/\//g, path.sep)
|
||||||
markdown:
|
markdown:
|
||||||
command: 'node tools/markdown.js'
|
command: 'node tools/markdown.js'
|
||||||
commit:
|
commit:
|
||||||
@ -149,7 +149,7 @@ module.exports = (grunt) ->
|
|||||||
beta:
|
beta:
|
||||||
command: """
|
command: """
|
||||||
git merge --no-commit -s ours beta
|
git merge --no-commit -s ours beta
|
||||||
git checkout beta "builds/*<%= pkg.meta.suffix.beta %>.*" LICENSE CHANGELOG.md img .gitignore .gitattributes
|
git checkout beta "builds/*-beta.*" LICENSE CHANGELOG.md img .gitignore .gitattributes
|
||||||
git commit -am "Move <%= pkg.meta.name %> v<%= pkg.meta.version %> to beta channel."
|
git commit -am "Move <%= pkg.meta.name %> v<%= pkg.meta.version %> to beta channel."
|
||||||
""".split('\n').join('&&')
|
""".split('\n').join('&&')
|
||||||
'tag-stable':
|
'tag-stable':
|
||||||
@ -217,8 +217,8 @@ module.exports = (grunt) ->
|
|||||||
builds: 'builds'
|
builds: 'builds'
|
||||||
testbuilds: 'testbuilds'
|
testbuilds: 'testbuilds'
|
||||||
tmp: 'tmp'
|
tmp: 'tmp'
|
||||||
tmpcrx: 'testbuilds/updates<%= pkg.meta.suffix.noupdate %>.xml'
|
tmpcrx: 'testbuilds/updates-noupdate.xml'
|
||||||
tmpuserscript: 'testbuilds/<%= pkg.name %><%= pkg.meta.suffix.noupdate %>.meta.js'
|
tmpuserscript: 'testbuilds/<%= pkg.name %>-noupdate.meta.js'
|
||||||
|
|
||||||
require('load-grunt-tasks') grunt
|
require('load-grunt-tasks') grunt
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ module.exports = (grunt) ->
|
|||||||
'build'
|
'build'
|
||||||
]
|
]
|
||||||
|
|
||||||
grunt.registerTask 'set-channel', 'Set the update channel', (channel) ->
|
grunt.registerTask 'set-channel', 'Set the update channel', (channel='') ->
|
||||||
pkg = grunt.config 'pkg'
|
pkg = grunt.config 'pkg'
|
||||||
pkg.channel = channel
|
pkg.channel = channel
|
||||||
grunt.config 'pkg', pkg
|
grunt.config 'pkg', pkg
|
||||||
@ -252,11 +252,11 @@ module.exports = (grunt) ->
|
|||||||
|
|
||||||
grunt.registerTask 'build-crx', [
|
grunt.registerTask 'build-crx', [
|
||||||
'shell:crx'
|
'shell:crx'
|
||||||
'set-channel:stable'
|
'set-channel'
|
||||||
'build-crx-channel'
|
'build-crx-channel'
|
||||||
'set-channel:beta'
|
'set-channel:-beta'
|
||||||
'build-crx-channel'
|
'build-crx-channel'
|
||||||
'set-channel:noupdate'
|
'set-channel:-noupdate'
|
||||||
'build-crx-channel'
|
'build-crx-channel'
|
||||||
'copy:zip'
|
'copy:zip'
|
||||||
'clean:tmpcrx'
|
'clean:tmpcrx'
|
||||||
@ -266,28 +266,28 @@ module.exports = (grunt) ->
|
|||||||
pkg = grunt.config 'pkg'
|
pkg = grunt.config 'pkg'
|
||||||
zip = new JSZip()
|
zip = new JSZip()
|
||||||
for file in ['eventPage.js', 'icon128.png', 'icon16.png', 'icon48.png', 'manifest.json', 'script.js']
|
for file in ['eventPage.js', 'icon128.png', 'icon16.png', 'icon48.png', 'manifest.json', 'script.js']
|
||||||
zip.file file, grunt.file.read("testbuilds/crx#{pkg.meta.suffix[pkg.channel]}/#{file}", {encoding: null}), {date: new Date(pkg.meta.date)}
|
zip.file file, grunt.file.read("testbuilds/crx#{pkg.channel}/#{file}", {encoding: null}), {date: new Date(pkg.meta.date)}
|
||||||
output = zip.generate
|
output = zip.generate
|
||||||
type: 'nodebuffer'
|
type: 'nodebuffer'
|
||||||
compression: 'DEFLATE'
|
compression: 'DEFLATE'
|
||||||
compressionOptions: {level: 9}
|
compressionOptions: {level: 9}
|
||||||
grunt.file.write "testbuilds/#{pkg.name}#{pkg.meta.suffix[pkg.channel]}.crx.zip", output
|
grunt.file.write "testbuilds/#{pkg.name}#{pkg.channel}.crx.zip", output
|
||||||
|
|
||||||
grunt.registerTask 'sign-channel', 'Sign CRX package', (channel) ->
|
grunt.registerTask 'sign-channel', 'Sign CRX package', (channel='') ->
|
||||||
done = @async()
|
done = @async()
|
||||||
pkg = grunt.config 'pkg'
|
pkg = grunt.config 'pkg'
|
||||||
privateKey = grunt.file.read "../#{pkg.meta.path}.keys/#{pkg.name}.pem"
|
privateKey = grunt.file.read "../#{pkg.meta.path}.keys/#{pkg.name}.pem"
|
||||||
archive = grunt.file.read "testbuilds/#{pkg.name}#{pkg.meta.suffix[channel]}.crx.zip", {encoding: null}
|
archive = grunt.file.read "testbuilds/#{pkg.name}#{channel}.crx.zip", {encoding: null}
|
||||||
extension = new crx {privateKey, loaded: true}
|
extension = new crx {privateKey, loaded: true}
|
||||||
extension.pack(archive).then((data) ->
|
extension.pack(archive).then((data) ->
|
||||||
grunt.file.write "testbuilds/#{pkg.name}#{pkg.meta.suffix[channel]}.crx", data
|
grunt.file.write "testbuilds/#{pkg.name}#{channel}.crx", data
|
||||||
done()
|
done()
|
||||||
).catch(done)
|
).catch(done)
|
||||||
|
|
||||||
grunt.registerTask 'sign', [
|
grunt.registerTask 'sign', [
|
||||||
'sign-channel:stable'
|
'sign-channel'
|
||||||
'sign-channel:beta'
|
'sign-channel:-beta'
|
||||||
'sign-channel:noupdate'
|
'sign-channel:-noupdate'
|
||||||
]
|
]
|
||||||
|
|
||||||
grunt.registerTask 'build-userscript-channel', [
|
grunt.registerTask 'build-userscript-channel', [
|
||||||
@ -297,11 +297,11 @@ module.exports = (grunt) ->
|
|||||||
|
|
||||||
grunt.registerTask 'build-userscript', [
|
grunt.registerTask 'build-userscript', [
|
||||||
'shell:userscript'
|
'shell:userscript'
|
||||||
'set-channel:stable'
|
'set-channel'
|
||||||
'build-userscript-channel'
|
'build-userscript-channel'
|
||||||
'set-channel:beta'
|
'set-channel:-beta'
|
||||||
'build-userscript-channel'
|
'build-userscript-channel'
|
||||||
'set-channel:noupdate'
|
'set-channel:-noupdate'
|
||||||
'build-userscript-channel'
|
'build-userscript-channel'
|
||||||
'clean:tmpuserscript'
|
'clean:tmpuserscript'
|
||||||
'copy:install'
|
'copy:install'
|
||||||
@ -410,7 +410,7 @@ module.exports = (grunt) ->
|
|||||||
|
|
||||||
grunt.registerTask 'updcl', 'Update the changelog', ->
|
grunt.registerTask 'updcl', 'Update the changelog', ->
|
||||||
{meta, name} = grunt.config('pkg')
|
{meta, name} = grunt.config('pkg')
|
||||||
{version, oldVersions, suffix} = meta
|
{version, oldVersions} = meta
|
||||||
|
|
||||||
branch = version.replace /\.\d+$/, ''
|
branch = version.replace /\.\d+$/, ''
|
||||||
headerLevel = branch.replace(/(\.0)*$/, '').split('.').length
|
headerLevel = branch.replace(/(\.0)*$/, '').split('.').length
|
||||||
@ -418,7 +418,7 @@ module.exports = (grunt) ->
|
|||||||
separator = "#{headerPrefix} v#{branch}"
|
separator = "#{headerPrefix} v#{branch}"
|
||||||
|
|
||||||
today = grunt.template.today 'yyyy-mm-dd'
|
today = grunt.template.today 'yyyy-mm-dd'
|
||||||
filename = "/builds/#{name}#{suffix.noupdate}"
|
filename = "/builds/#{name}-noupdate"
|
||||||
ffLink = "#{oldVersions}#{version}#{filename}.user.js"
|
ffLink = "#{oldVersions}#{version}#{filename}.user.js"
|
||||||
crLink = "#{oldVersions}#{version}#{filename}.crx"
|
crLink = "#{oldVersions}#{version}#{filename}.crx"
|
||||||
line = "**v#{version}** *(#{today})* - [[Firefox](#{ffLink} \"Firefox version\")] [[Chromium](#{crLink} \"Chromium version\")]"
|
line = "**v#{version}** *(#{today})* - [[Firefox](#{ffLink} \"Firefox version\")] [[Chromium](#{crLink} \"Chromium version\")]"
|
||||||
|
|||||||
10
package.json
10
package.json
@ -40,16 +40,6 @@
|
|||||||
"GM_openInTab",
|
"GM_openInTab",
|
||||||
"GM_xmlhttpRequest"
|
"GM_xmlhttpRequest"
|
||||||
],
|
],
|
||||||
"suffix": {
|
|
||||||
"stable": "",
|
|
||||||
"beta": "-beta",
|
|
||||||
"noupdate": "-noupdate"
|
|
||||||
},
|
|
||||||
"namesuffix": {
|
|
||||||
"stable": "",
|
|
||||||
"beta": " beta",
|
|
||||||
"noupdate": ""
|
|
||||||
},
|
|
||||||
"min": {
|
"min": {
|
||||||
"chrome": "33",
|
"chrome": "33",
|
||||||
"firefox": "26",
|
"firefox": "26",
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
"persistent": false
|
"persistent": false
|
||||||
},
|
},
|
||||||
"homepage_url": "<%= meta.page %>",
|
"homepage_url": "<%= meta.page %>",
|
||||||
<% if (channel !== 'noupdate') { %> "update_url": "<%= meta.downloads %>updates<%= meta.suffix[channel] %>.xml",
|
<% if (channel !== '-noupdate') { %> "update_url": "<%= meta.downloads %>updates<%= channel %>.xml",
|
||||||
"key": "<%= meta.appid %>",
|
"key": "<%= meta.appid %>",
|
||||||
<% } %> "minimum_chrome_version": "<%= meta.min.chrome %>",
|
<% } %> "minimum_chrome_version": "<%= meta.min.chrome %>",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name <%= meta.name %><%= meta.namesuffix[channel] %>
|
// @name <%= meta.name %><%= (channel === '-beta') ? ' beta' : '' %>
|
||||||
// @version <%= meta.version %>
|
// @version <%= meta.version %>
|
||||||
// @minGMVer <%= meta.min.greasemonkey %>
|
// @minGMVer <%= meta.min.greasemonkey %>
|
||||||
// @minFFVer <%= meta.min.firefox %>
|
// @minFFVer <%= meta.min.firefox %>
|
||||||
@ -40,7 +40,7 @@
|
|||||||
}).join('\n')
|
}).join('\n')
|
||||||
%>
|
%>
|
||||||
// @run-at document-start
|
// @run-at document-start
|
||||||
// @updateURL <%= (channel !== 'noupdate') ? (meta.downloads + name + meta.suffix[channel] + '.meta.js') : 'https://noupdate.invalid/' %>
|
// @updateURL <%= (channel !== '-noupdate') ? `${meta.downloads}${name}${channel}.meta.js` : 'https://noupdate.invalid/' %>
|
||||||
// @downloadURL <%= (channel !== 'noupdate') ? (meta.downloads + name + meta.suffix[channel] + '.user.js') : 'https://noupdate.invalid/' %>
|
// @downloadURL <%= (channel !== '-noupdate') ? `${meta.downloads}${name}${channel}.user.js` : 'https://noupdate.invalid/' %>
|
||||||
// @icon data:image/png;base64,<%= grunt.file.read('src/meta/icon48.png', {encoding: 'base64'}) %>
|
// @icon data:image/png;base64,<%= grunt.file.read('src/meta/icon48.png', {encoding: 'base64'}) %>
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
|
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
|
||||||
<app appid='<%= meta.appid %>'>
|
<app appid='<%= meta.appid %>'>
|
||||||
<updatecheck codebase='<%= meta.downloads %><%= name %><%= meta.suffix[channel] %>.crx' version='<%= meta.version %>' />
|
<updatecheck codebase='<%= meta.downloads %><%= name %><%= channel %>.crx' version='<%= meta.version %>' />
|
||||||
</app>
|
</app>
|
||||||
</gupdate>
|
</gupdate>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user