refactor(build): improve browser-polyfill inject

This commit is contained in:
Thomas Rupprecht 2023-05-25 08:07:37 +02:00
parent 0495e25b80
commit 8aa6db1275
4 changed files with 4 additions and 3 deletions

View File

@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file.
### 📚 Documentation
- Add logo and screenshot to readme
- Update quick-links
## \[[0.9.2](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.9.2)] - 2023-05-24

View File

@ -17,8 +17,8 @@
},
"scripts": {
"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",
"inject-browser-polyfill": "sed -i -r \"s#// \\[INJECT-BROWSER-POLYFILL]#import '\\./browser-polyfill\\.js';#\" src/*.js",
"uninject-browser-polyfill": "sed -i -r \"s#import '\\./browser-polyfill\\.js';#// \\[INJECT-BROWSER-POLYFILL]#\" src/*.js",
"copy-version": "sed -i 's/^\t\"version\": \".*\",$/\t\"version\": \"'$(rg '^\t\"version\": \"(.+)\",$' -r '$1' < package.json)'\",/' src/manifest.json",
"update-changelog": "npm exec git-cliff > CHANGELOG.md",
"lint": "web-ext lint -w",

View File

@ -94,7 +94,6 @@
</details>
</section>
<!-- [INJECT-BROWSER-POLYFILL] -->
<script type="module" src="popup.js"></script>
</body>
</html>

View File

@ -1,4 +1,5 @@
import { QUICK_LINKS } from './config.js';
// [INJECT-BROWSER-POLYFILL]
const dateTimeFormat = Intl.DateTimeFormat([], { dateStyle: 'medium', timeStyle: 'short' });