Set up different building system depending on the type of extension.
This commit is contained in:
parent
7ddb59862c
commit
c08121ba08
75
Gruntfile.js
75
Gruntfile.js
@ -21,40 +21,38 @@ module.exports = function(grunt) {
|
|||||||
],
|
],
|
||||||
dest: 'tmp/script.coffee'
|
dest: 'tmp/script.coffee'
|
||||||
},
|
},
|
||||||
manifest: {
|
|
||||||
options: { process: { data: pkg } },
|
|
||||||
src: 'src/manifest.json',
|
|
||||||
dest: 'builds/crx/manifest.json'
|
|
||||||
},
|
|
||||||
crx: {
|
crx: {
|
||||||
options: { process: { data: pkg } },
|
options: { process: { data: pkg } },
|
||||||
src: [
|
files: {
|
||||||
'src/banner.js',
|
'builds/crx/manifest.json': 'src/manifest.json',
|
||||||
'tmp/script.js'
|
'builds/crx/script.js': [
|
||||||
],
|
'src/banner.js',
|
||||||
dest: 'builds/crx/script.js'
|
'tmp/script.js'
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
metadata: {
|
userjs: {
|
||||||
options: { process: { data: pkg } },
|
|
||||||
src: 'src/metadata.js',
|
|
||||||
dest: 'builds/<%= pkg.name %>.meta.js'
|
|
||||||
},
|
|
||||||
userscript: {
|
|
||||||
options: { process: { data: pkg } },
|
options: { process: { data: pkg } },
|
||||||
src: [
|
src: [
|
||||||
'src/metadata.js',
|
'src/metadata.js',
|
||||||
'src/banner.js',
|
'src/banner.js',
|
||||||
'tmp/script.js'
|
'tmp/script.js'
|
||||||
],
|
],
|
||||||
dest: 'builds/<%= pkg.name %>.user.js'
|
dest: 'builds/<%= pkg.name %>.js'
|
||||||
|
},
|
||||||
|
userscript: {
|
||||||
|
options: { process: { data: pkg } },
|
||||||
|
files: {
|
||||||
|
'builds/<%= pkg.name %>.meta.js': 'src/metadata.js',
|
||||||
|
'builds/<%= pkg.name %>.user.js': [
|
||||||
|
'src/metadata.js',
|
||||||
|
'src/banner.js',
|
||||||
|
'tmp/script.js'
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
copy: {
|
copy: {
|
||||||
userjs: {
|
|
||||||
// Lazily copy the userscript
|
|
||||||
src: 'builds/<%= pkg.name %>.user.js',
|
|
||||||
dest: 'builds/<%= pkg.name %>.js'
|
|
||||||
},
|
|
||||||
crx: {
|
crx: {
|
||||||
src: 'img/*.png',
|
src: 'img/*.png',
|
||||||
dest: 'builds/crx/',
|
dest: 'builds/crx/',
|
||||||
@ -99,7 +97,7 @@ module.exports = function(grunt) {
|
|||||||
'css/**/*',
|
'css/**/*',
|
||||||
'img/**/*'
|
'img/**/*'
|
||||||
],
|
],
|
||||||
tasks: 'default'
|
tasks: 'build'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
compress: {
|
compress: {
|
||||||
@ -129,18 +127,37 @@ module.exports = function(grunt) {
|
|||||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||||
grunt.loadNpmTasks('grunt-exec');
|
grunt.loadNpmTasks('grunt-exec');
|
||||||
|
|
||||||
grunt.registerTask('default', [
|
grunt.registerTask('default', ['build']);
|
||||||
|
|
||||||
|
grunt.registerTask('set-build', 'Set the build type variable', function(type) {
|
||||||
|
pkg.type = type;
|
||||||
|
grunt.log.ok('pkg.type = %s', type);
|
||||||
|
});
|
||||||
|
grunt.registerTask('build', ['build-crx', 'build-userjs', 'build-userscript']);
|
||||||
|
grunt.registerTask('build-crx', [
|
||||||
|
'set-build:crx',
|
||||||
'concat:coffee',
|
'concat:coffee',
|
||||||
'coffee:script',
|
'coffee:script',
|
||||||
'concat:manifest',
|
|
||||||
'concat:crx',
|
'concat:crx',
|
||||||
'copy:crx',
|
'copy:crx',
|
||||||
'concat:userscript',
|
|
||||||
'concat:metadata',
|
|
||||||
'copy:userjs',
|
|
||||||
'clean:tmp'
|
'clean:tmp'
|
||||||
]);
|
]);
|
||||||
grunt.registerTask('release', ['default', 'exec:commit', 'exec:push', 'compress:crx']);
|
grunt.registerTask('build-userjs', [
|
||||||
|
'set-build:userjs',
|
||||||
|
'concat:coffee',
|
||||||
|
'coffee:script',
|
||||||
|
'concat:userjs',
|
||||||
|
'clean:tmp'
|
||||||
|
]);
|
||||||
|
grunt.registerTask('build-userscript', [
|
||||||
|
'set-build:userscript',
|
||||||
|
'concat:coffee',
|
||||||
|
'coffee:script',
|
||||||
|
'concat:userscript',
|
||||||
|
'clean:tmp'
|
||||||
|
]);
|
||||||
|
|
||||||
|
grunt.registerTask('release', ['build', 'exec:commit', 'exec:push', 'compress:crx']);
|
||||||
grunt.registerTask('patch', ['bump', 'updcl:3']);
|
grunt.registerTask('patch', ['bump', 'updcl:3']);
|
||||||
grunt.registerTask('minor', ['bump:minor', 'updcl:2']);
|
grunt.registerTask('minor', ['bump:minor', 'updcl:2']);
|
||||||
grunt.registerTask('major', ['bump:major', 'updcl:1']);
|
grunt.registerTask('major', ['bump:major', 'updcl:1']);
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
// @grant GM_deleteValue
|
// @grant GM_deleteValue
|
||||||
// @grant GM_openInTab
|
// @grant GM_openInTab
|
||||||
// @run-at document-start
|
// @run-at document-start
|
||||||
// @updateURL <%= meta.page %>/builds/<%= name %>.meta.js
|
// @updateURL <%= meta.page %>builds/<%= name %>.meta.js
|
||||||
// @downloadURL <%= meta.page %>/builds/<%= name %>.user.js
|
// @downloadURL <%= meta.page %>builds/<%= name %>.user.js
|
||||||
// @icon data:image/png;base64,<%= grunt.file.read('img/icon48.png', {encoding: 'base64'}) %>
|
// @icon data:image/png;base64,<%= grunt.file.read('img/icon48.png', {encoding: 'base64'}) %>
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user