diff --git a/.gitignore b/.gitignore index 3929abd..bde2dfc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ /web-ext-artifacts -src/browser-polyfill.js diff --git a/CHANGELOG.md b/CHANGELOG.md index ce13712..075e475 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ All notable changes to this project will be documented in this file. - Update dependencies - Update dependencies - Update `husky` +- Update dependencies ### ✳️ Other diff --git a/README.md b/README.md index e2525d3..f9077ee 100644 --- a/README.md +++ b/README.md @@ -43,10 +43,7 @@ Example: `npm run watch:firefox-android -- --firefox-apk=org.mozilla.fenix --fir ## Build ```ssh -// For Firefox -$ npm run build:firefox -// For Chromium -$ npm run build:chromium +$ npm run build ``` ## Release diff --git a/dprint.jsonc b/dprint.jsonc index 40191d3..16060f6 100644 --- a/dprint.jsonc +++ b/dprint.jsonc @@ -20,8 +20,7 @@ }, "excludes": [ "**/node_modules", - "**/*-lock.json", - "src/browser-polyfill.js" + "**/*-lock.json" ], "plugins": [ "https://plugins.dprint.dev/typescript-0.88.7.wasm", diff --git a/eslint.config.js b/eslint.config.js index a7d94f4..76c390a 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -7,7 +7,6 @@ const noUnsanitized = require('eslint-plugin-no-unsanitized'); module.exports = [ { files: ['**/*.js'], - ignores: ['src/browser-polyfill.js'], languageOptions: { globals: { ...globals.browser, diff --git a/package-lock.json b/package-lock.json index 1420e1e..bdb39c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,11 +7,7 @@ "": { "name": "usrspace-browser-addon", "version": "0.9.5", - "hasInstallScript": true, "license": "MIT", - "dependencies": { - "webextension-polyfill": "^0.10.0" - }, "devDependencies": { "@commitlint/cli": "^18.6.0", "@commitlint/config-conventional": "^18.6.0", @@ -8809,11 +8805,6 @@ "node": ">= 8" } }, - "node_modules/webextension-polyfill": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/webextension-polyfill/-/webextension-polyfill-0.10.0.tgz", - "integrity": "sha512-c5s35LgVa5tFaHhrZDnr3FpQpjj1BB+RXhLTYUxGqBVN460HkbM8TBtEqdXWbpTKfzwCcjAZVF7zXCYSKtcp9g==" - }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", diff --git a/package.json b/package.json index 6f66c41..9701304 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,6 @@ "name": "usrspace-browser-addon", "description": "WebExtension for the Hacker-/Maker-Space /usr/space", "version": "0.9.5", - "dependencies": { - "webextension-polyfill": "^0.10.0" - }, "devDependencies": { "@commitlint/cli": "^18.6.0", "@commitlint/config-conventional": "^18.6.0", @@ -25,9 +22,6 @@ "web-ext": "^7.11.0" }, "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]#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": "npm run lint:web-ext && npm run lint:js && npm run lint:css", @@ -42,17 +36,11 @@ "watch:firefox-android": "web-ext run -t firefox-android", "watch:chromium": "web-ext run -t chromium", "prebuild": "cp LICENSE.txt src/", - "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", + "build": "web-ext build", "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", "preversion": "npm run fmt:check && npm run lint && npm test", "version": "npm run copy-version && npm run update-changelog && git add CHANGELOG.md src/manifest.json", - "postversion": "npm run build:firefox", + "postversion": "npm run build", "prepare": "husky", "commit": "git-cz" }, diff --git a/src/background.js b/src/background.js index f2e32c9..580d28a 100644 --- a/src/background.js +++ b/src/background.js @@ -1,5 +1,6 @@ import { REFRESH_TIMEOUT, HOMEPAGE, API_URLS, BADGE_COLORS } from './config.js'; -// [INJECT-BROWSER-POLYFILL] + +globalThis.browser ??= chrome; browser.runtime.onInstalled.addListener(async (details) => { init(); diff --git a/src/popup.js b/src/popup.js index 5932d43..f349f08 100644 --- a/src/popup.js +++ b/src/popup.js @@ -1,5 +1,6 @@ import { QUICK_LINKS } from './config.js'; -// [INJECT-BROWSER-POLYFILL] + +globalThis.browser ??= chrome; const dateTimeFormat = Intl.DateTimeFormat([], { dateStyle: 'medium', timeStyle: 'short' });