diff --git a/.gitignore b/.gitignore index b8278a6..a7131bd 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,20 @@ node_modules/ dist/ package-lock.json +build/content.css +build/content.js +build/editor.html +build/editor.js +build/hide.svg +build/icon_48.png +build/icon_96.png +build/logo.svg +build/main.css +build/manifest.json +build/minimize.svg +build/options.html +build/popup.html +build/service.js +build/templates.html +build/ui.css +build/ui.js diff --git a/Extension/manifest.firefox.json b/Extension/manifest.firefox.json index 7064df8..35f7ff1 100644 --- a/Extension/manifest.firefox.json +++ b/Extension/manifest.firefox.json @@ -18,7 +18,6 @@ "default_popup": "popup.html" }, "background": { - "service_worker": "service.js", "scripts": [ "service.js" ] diff --git a/Extension/manifest.json b/Extension/manifest.json deleted file mode 100644 index 22c7e67..0000000 --- a/Extension/manifest.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "Consent-O-Matic", - "description": "Automatic handling of GDPR consent forms", - "author": "CAVI - Aarhus University", - "homepage_url": "https://github.com/cavi-au/Consent-O-Matic", - "version": "1.1.0", - "manifest_version": 3, - "permissions": [ - "activeTab", - "tabs", - "storage" - ], - "host_permissions": [ - "" - ], - "action": { - "default_title": "Consent-O-Matic", - "default_popup": "popup.html" - }, - "background": { - "service_worker": "service.js", - "scripts": [ - "service.js" - ] - }, - "content_scripts": [ - { - "matches": [ - "" - ], - "js": [ - "content.js" - ], - "css": [ - "content.css" - ], - "all_frames": true, - "match_about_blank": true, - "run_at": "document_start" - } - ], - "options_ui": { - "page": "options.html", - "open_in_tab": true - }, - "icons": { - "48": "icon_48.png", - "96": "icon_96.png" - }, - "browser_specific_settings": { - "gecko": { - "id": "gdpr@cavi.au.dk", - "strict_min_version": "109.0" - } - } -} \ No newline at end of file diff --git a/Extension/manifest.ios.safari.json b/Extension/manifest.safari.json similarity index 100% rename from Extension/manifest.ios.safari.json rename to Extension/manifest.safari.json diff --git a/README.md b/README.md index 42d3c73..735f473 100644 --- a/README.md +++ b/README.md @@ -118,9 +118,10 @@ Lastly, if you intend to review or make changes to the code, you can build and i git clone https://github.com/cavi-au/Consent-O-Matic.git cd Consent-O-Matic npm install -npm run build ``` -Then proceed as above for installing release archives but point the browser at the `dist` folder. +and then run one of ```npm run build-firefox``` or ```npm run build-chromium``` or ```npm run build-safari``` + +For Firefox or Chromium you can now proceed as above for installing release archives but point the browser at the `build` folder or a folder where you extracted the zip from build/dist/. Safari requires loading the XCode project to further build an app. We do not recommend installing from source. diff --git a/package.json b/package.json index 56ca440..ae7d3b5 100644 --- a/package.json +++ b/package.json @@ -8,13 +8,17 @@ "url": "https://github.com/cavi-au/Consent-O-Matic" }, "scripts": { - "build": "webpack" + "build-firefox": "webpack --env target=firefox", + "build-chromium": "webpack --env target=chromium", + "build-safari": "webpack --env target=safari" }, "dependencies": { + "copy-webpack-plugin": "^12.0.2", "glob": "^10.3.12", "html-minimizer-webpack-plugin": "^5.0.0", "sass": "^1.77.0", "sass-loader": "^14.2.1", - "webpack-cli": "^5.1.4" + "webpack-cli": "^5.1.4", + "zip-webpack-plugin": "^4.0.1" } } diff --git a/webpack.config.js b/webpack.config.js index 89e516a..e5adaf1 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,13 +1,15 @@ const HtmlMinimizerPlugin = require("html-minimizer-webpack-plugin"); +const PACKAGE = require('./package.json'); +const ZipPlugin = require('zip-webpack-plugin'); +const CopyPlugin = require("copy-webpack-plugin"); const path = require('path'); const glob = require("glob"); -module.exports = { +module.exports = env=>({ mode: 'production', entry: { service: ['./Extension/background.js'], content: [ './Extension/contentScript.js', - "./Extension/manifest.json", "./Extension/content.scss", "./Extension/icon_48.png", "./Extension/icon_96.png", @@ -28,7 +30,7 @@ module.exports = { output: { publicPath: "", filename: '[name].js', - path: path.resolve(__dirname, 'dist') + path: path.resolve(__dirname, 'build') }, module: { parser: { @@ -63,5 +65,13 @@ module.exports = { '...', new HtmlMinimizerPlugin(), ], - }, -} \ No newline at end of file + }, + plugins: [ + new CopyPlugin({patterns: [{from: "Extension/manifest."+env.target+".json", to: "manifest.json",force:true }]}), + new ZipPlugin({ + path: 'dist/', + filename: PACKAGE.name+"-v"+PACKAGE.version+"-unpacked-release-"+env.target+".zip", + exclude: [/^dist/] + }) + ] +}); \ No newline at end of file