From 404ae170d4f865767e8c4c2db44093e97d90491c Mon Sep 17 00:00:00 2001 From: Dominik Hebeler <dominik@suma-ev.de> Date: Tue, 19 Mar 2024 15:46:13 +0100 Subject: [PATCH] update README --- .gitignore | 3 ++- README.md | 34 +++++++++++++++++++++++++++++++--- build/helpers/.env | 2 +- build/helpers/prod.sh | 15 +++++++++++++++ manifest.json | 2 +- package-lock.json | 11 +---------- package.json | 6 +++--- 7 files changed, 54 insertions(+), 19 deletions(-) create mode 100755 build/helpers/prod.sh diff --git a/.gitignore b/.gitignore index 5ae4a77..fc0004c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /node_modules -/js \ No newline at end of file +/js +/dist \ No newline at end of file diff --git a/README.md b/README.md index cb02fb5..c4359d3 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,37 @@ -The official WebExtension for the German search engine MetaGer. - -This extension is currently in an unfinished state and not recomended for production use. +# The official WebExtension for the German search engine MetaGer. Copyright © SUMA-EV and contributors +## Build the extension yourself (Firefox) + +We are using webpack to provide the necessary libraries for this extension. You will either need to have [nodejs v20](https://nodejs.org/en/download) or [docker](https://docs.docker.com/engine/install/) installed on your system for the build. + +### Debug using nodejs + +#### Build the js files: +```bash +npm run dev +``` +#### Debug the extension in your browser +```bash +node_modules/web-ext/bin/web-ext.js run +``` + +### Build production using nodejs + +#### Build the js files and package the extension under `./dist/` using nodejs +```bash +npm run prod +``` + +#### Build the js files and package the extension under `./dist/` using docker +There is a helper script in this repo that runs the necessary docker command +```bash +./build/helpers/prod.sh +``` + +## License + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the diff --git a/build/helpers/.env b/build/helpers/.env index ebbf249..a5ee677 100644 --- a/build/helpers/.env +++ b/build/helpers/.env @@ -1 +1 @@ -NODE_VERSION=21 \ No newline at end of file +NODE_VERSION=20 \ No newline at end of file diff --git a/build/helpers/prod.sh b/build/helpers/prod.sh new file mode 100755 index 0000000..4acdfe2 --- /dev/null +++ b/build/helpers/prod.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Verify that docker is installed +if ! command -v docker &> /dev/null +then + echo "docker seems to not be installed on your system"; + exit 1; +fi + +CURRENT_DIR=`dirname $BASH_SOURCE`; + +# Export variables to this environment +source $CURRENT_DIR/.env + +docker run -it --rm -v $CURRENT_DIR/../../:/data --workdir=/data node:$NODE_VERSION npm run prod diff --git a/manifest.json b/manifest.json index c039845..3ef6571 100644 --- a/manifest.json +++ b/manifest.json @@ -7,7 +7,7 @@ "default_locale": "en", "browser_specific_settings": { "gecko": { - "id": "firefoxextension@metager.org", + "id": "firefoxextension@metager.de", "strict_min_version": "120.0" } }, diff --git a/package-lock.json b/package-lock.json index 89f21b7..e20b26f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "metager-webextension", + "name": "data", "lockfileVersion": 3, "requires": true, "packages": { @@ -7,7 +7,6 @@ "dependencies": { "blind-signatures": "^1.0.7", "buffer": "^6.0.3", - "cookie": "^0.6.0", "crypto-browserify": "^3.12.0", "node-rsa": "^1.1.1", "process": "^0.11.10", @@ -2049,14 +2048,6 @@ "url": "https://github.com/yeoman/configstore?sponsor=1" } }, - "node_modules/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/core-js": { "version": "3.29.0", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.29.0.tgz", diff --git a/package.json b/package.json index 1257219..c676fda 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,6 @@ "dependencies": { "blind-signatures": "^1.0.7", "buffer": "^6.0.3", - "cookie": "^0.6.0", "crypto-browserify": "^3.12.0", "node-rsa": "^1.1.1", "process": "^0.11.10", @@ -15,6 +14,7 @@ "webpack-cli": "^5.1.4" }, "scripts": { - "dev": "npm i --clean && webpack --mode=development" + "dev": "npm i --clean && webpack --mode=development", + "prod": "npm i --clean && webpack --mode=production --no-devtool --no-watch && node_modules/web-ext/bin/web-ext.js build -a dist --overwrite-dest --ignore-files=build dist .gitignore .git *.md package* webpack.config.js" } -} +} \ No newline at end of file -- GitLab