feat: convert as web extension

works well in both firefox and chrome
This commit is contained in:
Xmader 2020-10-29 03:23:02 -04:00
parent e1aa292ffa
commit 54145a753a
2 changed files with 16 additions and 1 deletions

View File

@ -22,11 +22,14 @@
"*://musescore.com/*/*"
],
"js": [
"dist/main.js"
"src/web-ext.js"
],
"run_at": "document_start"
}
],
"web_accessible_resources": [
"dist/main.js"
],
"dependencies": {
"pdfkit": "git+https://github.com/Xmader/pdfkit.git",
"svg-to-pdfkit": "^0.1.8",
@ -48,6 +51,8 @@
"scripts": {
"build": "rollup -c",
"watch": "npm run build -- --watch",
"start:ext": "web-ext run",
"start:ext-chrome": "npm run start:ext -- -t chromium",
"bump-version:patch": "npm version patch --no-git-tag",
"bump-version:minor": "npm version minor --no-git-tag"
}

10
src/web-ext.js Normal file
View File

@ -0,0 +1,10 @@
// entry file for the Web Extension
/* eslint-disable no-undef */
const MAIN_FILE = 'dist/main.js'
const script = document.createElement('script')
script.src = chrome.runtime.getURL(MAIN_FILE)
script.addEventListener('load', () => script.remove())
document.documentElement.appendChild(script)