Make manifest a common template

This commit is contained in:
Ilya Ig. Petrov 2017-02-23 03:48:21 +00:00
parent 8441fd956e
commit fce97347ff
10 changed files with 49 additions and 77 deletions

View File

@ -49,25 +49,16 @@ gulp.task('clean', function() {
});
const fullContext = {
version: '0.21',
nameSuffixEn: '',
nameSuffixRu: '',
};
const miniContext = Object.assign({}, fullContext, {
nameSuffixEn: ' MINI',
nameSuffixRu: ' МИНИ',
});
const contexts = require('./src/templates-data').contexts;
gulp.task('_cp-common', ['clean'], function() {
gulp.src(['./src/extension-common/**/*'])
.pipe(templatePlugin(miniContext))
.pipe(templatePlugin(contexts.mini))
.pipe(gulp.dest('./build/extension-mini'))
gulp.src(['./src/extension-common/**/*'])
.pipe(templatePlugin(fullContext))
.pipe(templatePlugin(contexts.full))
.pipe(gulp.dest('./build/extension-full'));
});
@ -75,7 +66,7 @@ gulp.task('_cp-common', ['clean'], function() {
gulp.task('_cp-mini', ['_cp-common'], function() {
gulp.src(['./src/extension-mini/**/*'])
.pipe(templatePlugin(miniContext))
.pipe(templatePlugin(contexts.mini))
.pipe(gulp.dest('./build/extension-mini'));
});
@ -83,7 +74,7 @@ gulp.task('_cp-mini', ['_cp-common'], function() {
gulp.task('_cp-full', ['_cp-common'], function() {
gulp.src(['./src/extension-full/**/*'])
.pipe(templatePlugin(fullContext))
.pipe(templatePlugin(contexts.full))
.pipe(gulp.dest('./build/extension-full'));
});

View File

@ -12,31 +12,31 @@
"homepage_url": "https://github.com/anticensorship-russia/chromium-extension",
"permissions": [
"proxy",
"webRequest",
"alarms",
"storage",
"<all_urls>",
"tabs",
"contextMenus",
"notifications"
"proxy"
, "alarms"
, "storage"
, "<all_urls>"
, "tabs"
, "contextMenus"
, "notifications"
${extra_permissions}
],
"background": {
"scripts": [
"00-init-apis.js",
"11-error-handlers-api.js",
"12-errors-lib.js",
"13-http-lib.js",
"14-ip-to-host-api.js",
"15-pac-kitchen-api.js",
"17-sync-pac-script-with-pac-provider-api.js",
"30-block-informer.js",
"40-context-menus.js"
"00-init-apis.js"
, "11-error-handlers-api.js"
, "12-errors-lib.js"
, "13-http-lib.js"
${scripts_2x}
, "35-pac-kitchen-api.js"
, "37-sync-pac-script-with-pac-provider-api.js"
${scripts_7x}
, "80-context-menus.js"
]
},
"browser_action": {
"default_title": "Этот сайт благословлён | Версия ${version}",
"default_title": "Этот сайт благословлён | Версия ${version + versionSuffix}",
"default_popup": "/pages/choose-pac-provider/index.html"
},
"options_ui": {

View File

@ -1,45 +0,0 @@
{
"manifest_version": 2,
"name": "__MSG_extName__",
"default_locale": "ru",
"description": "__MSG_extDesc__",
"version": "0.0.${version}",
"icons": {
"128": "/icons/default-128.png"
},
"author": "ilyaigpetrov@gmail.com",
"homepage_url": "https://github.com/anticensorship-russia/chromium-extension",
"permissions": [
"proxy",
"alarms",
"storage",
"<all_urls>",
"tabs",
"contextMenus",
"notifications"
],
"background": {
"persistent": false,
"scripts": [
"00-init-apis.js",
"11-error-handlers-api.js",
"12-errors-lib.js",
"13-http-lib.js",
"15-pac-kitchen-api.js",
"17-sync-pac-script-with-pac-provider-api.js",
"40-context-menus.js",
"50-for-mini-only.js"
]
},
"browser_action": {
"default_title": "Этот сайт благословлён | Версия ${version}-mini",
"default_popup": "/pages/choose-pac-provider/index.html"
},
"options_ui": {
"page": "/pages/choose-pac-provider/index.html",
"chrome_style": true
}
}

View File

@ -0,0 +1,26 @@
'use strict';
const commonContext = {
version: '0.21',
};
exports.contexts = {};
exports.contexts.full = Object.assign({}, commonContext, {
versionSuffix: '',
nameSuffixEn: '',
nameSuffixRu: '',
extra_permissions: ', "webRequest"',
scripts_2x: ', "20-ip-to-host-api.js"',
scripts_7x: ', "70-block-informer.js"',
});
exports.contexts.mini = Object.assign({}, commonContext, {
versionSuffix: '-mini',
nameSuffixEn: ' MINI',
nameSuffixRu: ' МИНИ',
extra_permissions: '',
scripts_2x: ', "20-for-mini-only.js"',
scripts_7x: '',
});