Add Edge target and adapt options page to Edge
Now the extension can be built with Edge as a target. This change also
adapts the option page for Edge so it doesn't have a horizontal
scrollbar.
Fixed: translateselectedtext:6
Change-Id: Ie0a38b85d1c604610942b00269004c51fc02963d
diff --git a/Makefile b/Makefile
index b2c9d49..166ca7b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-.PHONY: node_deps clean_dist deps clean_deps serve_chromium release release_chromium_stable release_chromium_beta build_test_extension clean_releases clean
+.PHONY: node_deps clean_dist deps clean_deps serve_chromium serve_edge release release_chromium_stable release_chromium_beta release_edge build_test_extension clean_releases clean
.DEFAULT_GOAL := release
WEBPACK := ./node_modules/webpack-cli/bin/cli.js
@@ -20,7 +20,10 @@
serve_chromium: deps
$(WEBPACK) --mode development --env browser_target=chromium --watch
-release: release_chromium_stable release_chromium_beta
+serve_edge: deps
+ $(WEBPACK) --mode development --env browser_target=edge --watch
+
+release: release_chromium_stable release_chromium_beta release_edge
release_chromium_stable: deps
$(WEBPACK) --mode production --env browser_target=chromium
@@ -32,6 +35,11 @@
$(RELEASE_SCRIPT) -c beta -b chromium -f
rm -rf dist/chromium
+release_edge: deps
+ $(WEBPACK) --mode production --env browser_target=edge
+ $(RELEASE_SCRIPT) -c stable -b edge -f
+ rm -rf dist/edge
+
# Target to build the extension for webext lint in the Zuul Check Pipeline.
build_test_extension: deps
$(WEBPACK) --mode production --env browser_target=chromium
diff --git a/src/options/options.js b/src/options/options.js
index 4ee6e35..ec50b6a 100644
--- a/src/options/options.js
+++ b/src/options/options.js
@@ -7,6 +7,23 @@
import {SHARED_STYLES} from './shared/shared-styles.js';
+let bodyStyles = document.createElement('style');
+// #!if browser_target == 'chromium'
+let widthProperty = 'width: 470px;';
+// #!else
+let widthProperty = '';
+// #!endif
+bodyStyles.textContent = `
+ body {
+ margin: 0;
+ padding: 0;
+ font-size: 90%;
+ ${widthProperty}
+ }
+`;
+
+document.head.append(bodyStyles);
+
export class OptionsPage extends LitElement {
static properties = {
_storageData: {type: Object, state: true},
diff --git a/src/static/options.html b/src/static/options.html
index 376d756..763d2ba 100644
--- a/src/static/options.html
+++ b/src/static/options.html
@@ -3,14 +3,6 @@
<head>
<meta charset="UTF-8">
<title>Options</title>
- <style>
- body {
- margin: 0;
- padding: 0;
- width: 470px;
- font-size: 90%;
- }
- </style>
<link href='http://fonts.googleapis.com/css?family=Roboto:400,700,700italic,400italic' rel='stylesheet' type='text/css'>
</head>
<body>
diff --git a/tools/release.bash b/tools/release.bash
index b838100..91f6b20 100644
--- a/tools/release.bash
+++ b/tools/release.bash
@@ -14,9 +14,8 @@
-h, --help show this help message and exit
-c, --channel indicates the channel of the release. Can be "beta"
or "stable". Defaults to "stable".
- -b, --browser indicates the target browser for the release. As of
- now it can only be "chromium", which is also the
- default value.
+ -b, --browser indicates the target browser for the release. Can be
+ "chromium" or "edge". Defaults to "chromium".
-f, --fast indicates that the release shouldn't generate the
i18n credits JSON file.
@@ -64,7 +63,7 @@
exit
fi
-if [[ $browser != "chromium" ]]; then
+if [[ $browser != "chromium" && $browser != "edge" ]]; then
echo "browser parameter value is incorrect." >&2
usage
exit