Parcourir la source

Add Safari extension build target (#896)

Suhail Khan il y a 2 ans
Parent
commit
f680bf6d81
3 fichiers modifiés avec 52 ajouts et 0 suppressions
  1. 36 0
      Extensions/combined/manifest-safari.json
  2. 1 0
      package.json
  3. 15 0
      webpack.config.js

+ 36 - 0
Extensions/combined/manifest-safari.json

@@ -0,0 +1,36 @@
+{
+  "name": "__MSG_extensionName__",
+  "description": "__MSG_extensionDesc__",
+  "default_locale": "en",
+  "version": "3.0.0.8",
+  "manifest_version": 2,
+  "background": {
+    "scripts": ["ryd.background.js"],
+    "persistent": false
+  },
+  "icons": {
+    "48": "icons/icon48.png",
+    "128": "icons/icon128.png"
+  },
+  "permissions": [
+    "activeTab",
+    "*://*.youtube.com/*",
+    "storage",
+    "*://returnyoutubedislikeapi.com/*"
+  ],
+  "browser_action": {
+    "default_popup": "popup.html"
+  },
+  "content_scripts": [
+    {
+      "matches": ["*://*.youtube.com/*"],
+      "exclude_matches": ["*://*.music.youtube.com/*"],
+      "run_at": "document_idle",
+      "css": ["content-style.css"],
+      "js": ["ryd.content-script.js"]
+    }
+  ],
+  "options_ui": {
+    "page": "popup.html"
+  }
+}

+ 1 - 0
package.json

@@ -7,6 +7,7 @@
     "start": "echo To build for development, please use \"npm run dev\". To build for production, please use \"npm run build\".",
     "dev": "webpack --mode=production --watch",
     "build": "webpack --mode=production",
+    "build:safari": "webpack --mode=production && xcrun safari-web-extension-converter Extensions/combined/dist/safari --project-location Extensions/combined/dist --bundle-identifier com.returnyoutubedislike.safari-ext --force",
     "test": "echo \"Error: no test specified\" && exit 1"
   },
   "repository": {

+ 15 - 0
webpack.config.js

@@ -56,6 +56,17 @@ module.exports = {
           from: "./Extensions/combined/manifest-firefox.json",
           to: "./firefox/manifest.json",
         },
+        {
+          from: "./Extensions/combined",
+          to: "./safari",
+          globOptions: {
+            ignore: ignorePatterns,
+          },
+        },
+        {
+          from: "./Extensions/combined/manifest-safari.json",
+          to: "./safari/manifest.json",
+        },
       ],
     }),
     new FileManagerPlugin({
@@ -70,6 +81,10 @@ module.exports = {
               source: "./Extensions/combined/dist/**.js",
               destination: "./Extensions/combined/dist/chrome/",
             },
+            {
+              source: "./Extensions/combined/dist/**.js",
+              destination: "./Extensions/combined/dist/safari/",
+            },
           ],
         },
       },