1 Star 1 Fork 1

beeworkshop/URLRedirector

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Gruntfile.js 4.66 KB
一键复制 编辑 原始数据 按行查看 历史
Yingcai FENG 提交于 2017-03-27 22:19 . 支持 edge
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
// Task configuration.
clean: ['dist/'],
copy: {
prepare: {
files: [
{expand:true, cwd: 'src/', src: ['**'], dest: 'dist/firefox/'},
{expand:true, cwd: 'src/', src: ['**'], dest: 'dist/firefox-offline/'},
{expand:true, cwd: 'src/', src: ['**'], dest: 'dist/chrome/'},
{expand:true, cwd: 'src/', src: ['**'], dest: 'dist/edge/'}
]
},
firefox_manifest: {
expand: true,
cwd: 'src/',
src: 'manifest.json',
dest: 'dist/firefox/',
options: {
process: function (content, srcpath) {
var pkg = grunt.file.readJSON('package.json');
var json = JSON.parse(content);
json.version = pkg.version;
return JSON.stringify(json, null, 2);
}
}
},
firefox_offline_manifest: {
expand: true,
cwd: 'src/',
src: 'manifest.json',
dest: 'dist/firefox-offline/',
options: {
process: function (content, srcpath) {
var pkg = grunt.file.readJSON('package.json');
var json = JSON.parse(content);
json.version = pkg.version;
json.name = "URLRedirector-offline";
json.applications.gecko.id = "URLRedirector-offline@fengyc";
return JSON.stringify(json, null, 2);
}
}
},
chrome_manifest: {
expand: true,
cwd: 'src',
src: 'manifest.json',
dest: 'dist/chrome/',
options: {
process: function (content, srcpath) {
var pkg = grunt.file.readJSON('package.json');
var json = JSON.parse(content);
json.version = pkg.version;
delete json.applications;
return JSON.stringify(json, null, 2);
}
}
},
chrome_webstore: {
expand: true,
cwd: 'src/options',
src: 'options.js',
dest: 'dist/chrome/options/',
options: {
process: function (content, srcpath) {
/* Fix chrome webstore url */
var pkg = grunt.file.readJSON('package.json');
var chromeWebStoreURL = pkg.publishConfig["chrome-webstore"];
return content.replace(/var.*ADDON_URL.*=.*/, 'var ADDON_URL = "' + chromeWebStoreURL + '";' );
}
}
},
edge_manifest: {
expand: true,
cwd: 'src',
src: 'manifest.json',
dest: 'dist/edge/',
options: {
process: function (content, srcpath) {
var pkg = grunt.file.readJSON('package.json');
var json = JSON.parse(content);
json.version = pkg.version;
json.author = pkg.author.name;
json.background.persistent = true;
json.options_page = json.options_ui.page;
delete json.options_ui;
delete json.browser_action.browser_style;
return JSON.stringify(json, null, 2);
}
}
}
},
compress: {
firefox: {
options: {
archive: 'dist/<%= pkg.name %>-firefox-v<%= pkg.version %>.zip'
},
files: [
{expand: true, cwd: 'dist/firefox/', src: ['**'], dest: '/'}
]
},
firefox_offline: {
options: {
archive: 'dist/<%= pkg.name %>-firefox-offline-v<%= pkg.version %>.zip'
},
files: [
{expand: true, cwd: 'dist/firefox-offline/', src: ['**'], dest: '/'}
]
},
chrome: {
options: {
archive: 'dist/<%= pkg.name %>-chrome-v<%= pkg.version %>.zip'
},
files: [
{expand: true, cwd: 'dist/chrome', src: ['**'], dest: '/'}
]
},
edge: {
options: {
archive: 'dist/<%= pkg.name %>-edge-v<%= pkg.version %>.zip'
},
files: [
{expand: true, cwd: 'dist/edge', src: ['**'], dest: '/'}
]
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-clean');
// Default task.
grunt.registerTask('default', ['clean', 'copy', 'compress']);
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/beeworkshop/URLRedirector.git
[email protected]:beeworkshop/URLRedirector.git
beeworkshop
URLRedirector
URLRedirector
master

搜索帮助