forked from XimeX/usrspace-browser-addon
inject browser-polyfill only in chromium builds
This commit is contained in:
parent
b749f17f35
commit
ae0c2ded1b
|
@ -30,7 +30,10 @@ Example: `npm run watch:firefox-android -- --firefox-apk=org.mozilla.fenix --fir
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
```ssh
|
```ssh
|
||||||
$ npm run build
|
// For Firefox
|
||||||
|
$ npm run build:firefox
|
||||||
|
// For Chromium
|
||||||
|
$ npm run build:chromium
|
||||||
```
|
```
|
||||||
|
|
||||||
## Release
|
## Release
|
||||||
|
|
11
package.json
11
package.json
|
@ -10,6 +10,8 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"copy-browser-polyfill": "cp node_modules/webextension-polyfill/dist/browser-polyfill.js src/browser-polyfill.js",
|
"copy-browser-polyfill": "cp node_modules/webextension-polyfill/dist/browser-polyfill.js src/browser-polyfill.js",
|
||||||
|
"inject-browser-polyfill": "sed -i -r 's/(<!-- \\[INJECT-BROWSER-POLYFILL] -->).*/\\1<script type=\"module\" src=\"browser-polyfill.js\"><\\/script>/' src/*.html",
|
||||||
|
"uninject-browser-polyfill": "sed -i -r 's/(<!-- \\[INJECT-BROWSER-POLYFILL] -->).+/\\1/' src/*.html",
|
||||||
"copy-version": "sed -i 's/^\t\"version\": \".*\",$/\t\"version\": \"'$(rg '^\t\"version\": \"(.+)\",$' -r '$1' < package.json)'\",/' src/manifest.json",
|
"copy-version": "sed -i 's/^\t\"version\": \".*\",$/\t\"version\": \"'$(rg '^\t\"version\": \"(.+)\",$' -r '$1' < package.json)'\",/' src/manifest.json",
|
||||||
"lint": "web-ext lint -w",
|
"lint": "web-ext lint -w",
|
||||||
"test": "echo \"Error: no test specified\" && exit 0",
|
"test": "echo \"Error: no test specified\" && exit 0",
|
||||||
|
@ -17,12 +19,17 @@
|
||||||
"watch:firefox-android": "web-ext run -t firefox-android",
|
"watch:firefox-android": "web-ext run -t firefox-android",
|
||||||
"watch:chromium": "web-ext run -t chromium",
|
"watch:chromium": "web-ext run -t chromium",
|
||||||
"prebuild": "cp LICENSE.txt src/",
|
"prebuild": "cp LICENSE.txt src/",
|
||||||
"build": "web-ext build",
|
"prebuild:firefox": "npm run prebuild",
|
||||||
|
"prebuild:chromium": "npm run prebuild && npm run inject-browser-polyfill",
|
||||||
|
"build:firefox": "web-ext build -i browser-polyfill.js",
|
||||||
|
"build:chromium": "web-ext build",
|
||||||
"postbuild": "rm src/LICENSE.txt",
|
"postbuild": "rm src/LICENSE.txt",
|
||||||
|
"postbuild:firefox": "npm run postbuild",
|
||||||
|
"postbuild:chromium": "npm run postbuild && npm run uninject-browser-polyfill",
|
||||||
"postinstall": "npm run copy-browser-polyfill",
|
"postinstall": "npm run copy-browser-polyfill",
|
||||||
"preversion": "npm run lint && npm test",
|
"preversion": "npm run lint && npm test",
|
||||||
"version": "npm run copy-version && git add -u",
|
"version": "npm run copy-version && git add -u",
|
||||||
"postversion": "npm run build"
|
"postversion": "npm run build:firefox"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>/usr/space</title>
|
<title>/usr/space</title>
|
||||||
<script type="module" src="browser-polyfill.js"></script>
|
|
||||||
|
<!-- [INJECT-BROWSER-POLYFILL] -->
|
||||||
<script type="module" src="background.js"></script>
|
<script type="module" src="background.js"></script>
|
||||||
</head>
|
</head>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
</details>
|
</details>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<script type="module" src="browser-polyfill.js"></script>
|
<!-- [INJECT-BROWSER-POLYFILL] -->
|
||||||
<script type="module" src="popup.js"></script>
|
<script type="module" src="popup.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue