From 207e743708663b0057fb676a11c3e8c19b58fdb9 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Wed, 5 Jun 2024 21:05:59 +0100 Subject: [PATCH] extension: update AMO instruction and prepare for store release --- doc/addons-mozilla-org.org | 23 +++++++++---------- extension/amo-metadata.json | 44 ++++++++++++++++++++++++++++++++++++- extension/build | 5 +++-- extension/package.json | 4 ++-- extension/src/background.ts | 2 +- 5 files changed, 59 insertions(+), 19 deletions(-) diff --git a/doc/addons-mozilla-org.org b/doc/addons-mozilla-org.org index 566a8efc..f186e833 100644 --- a/doc/addons-mozilla-org.org +++ b/doc/addons-mozilla-org.org @@ -4,20 +4,20 @@ To provide the source code, run: =git archive master --output=promnesia-source.z Also can point them at https://github.com/karlicoss/promnesia/tree/master/extension -The build instruction assume that the zip file with source code is in =/path/to/promnesia-source.zip= (on the HOST system). +The build instructions assume that the zip file with source code is in =/path/to/promnesia-source.zip= (on the HOST system). *Make sure to replace it with the actual path to the source code zip file.* * Building addon -To build you need *Ubuntu 22.04/Jammy* and *Node 18*. The easiest way to build cleanly would be a Docker container: +To build you need *Ubuntu 24.04/Noble* and *Node 20*. The easiest way to build cleanly would be a Docker container: #+begin_src # on the HOST system: cleanup previous container -- if it didn't exist in the first, it will show an error, ignore it docker rm -f promnesia_build # on the HOST system: create the container -docker create --name promnesia_build -it ubuntu:jammy /bin/bash +docker create --name promnesia_build -it ubuntu:noble /bin/bash # on the HOST system: put the sources into the container docker cp /path/to/promnesia-source.zip promnesia_build:/promnesia.zip @@ -25,29 +25,26 @@ docker cp /path/to/promnesia-source.zip promnesia_build:/promnesia.zip # on the HOST system: start the container docker start -i promnesia_build -# INSIDE the container -$ apt update && apt install -y sudo - #+end_src After that build the addon (run these commands INSIDE the container if you choose to do it with Docker): #+begin_src -$ sudo apt update && sudo apt install -y git curl unzip -$ curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - -$ sudo apt install -y nodejs +$ apt update && apt install -y git curl unzip +$ curl -fsSL https://deb.nodesource.com/setup_20.x | bash - +$ DEBIAN_FRONTEND=noninteractive apt install -y nodejs $ unzip promnesia.zip -d promnesia -$ cd promnesia/extension/ +$ cd promnesia $ npm install -$ ./build --firefox --release --lint +$ ./build --firefox --release --lint --publish=skip #+end_src -The final artifact will be in =/promnesia/extension/dist/artifacts/firefox/promnesia-.zip= (INSIDE the container). +The final artifact will be in =/promnesia/dist/artifacts/firefox/promnesia-.zip= (INSIDE the container). If you need to get it back onto the HOST system (e.g. to test in the browser), run on the HOST system (e.g. in a separate terminal): #+begin_src -docker cp promnesia_build:/promnesia/extension/dist/artifacts/firefox/promnesia-.zip . +docker cp promnesia_build:/promnesia/dist/artifacts/firefox/promnesia-.zip . #+end_src This will copy it into the current directory on the HOST system. diff --git a/extension/amo-metadata.json b/extension/amo-metadata.json index 152b9ffb..7eca8002 100644 --- a/extension/amo-metadata.json +++ b/extension/amo-metadata.json @@ -1,5 +1,47 @@ { "version": { - "approval_notes": "just testing approval notes via API" + "approval_notes": " +You can find up-to-date extension code here https://github.com/karlicoss/promnesia/tree/master/extension + +The build instructions assume that the zip file with source code is in =/path/to/promnesia-source.zip= (on the HOST system). +*Make sure to replace it with the actual path to the source code zip file.* + +To build you need *Ubuntu 24.04/Noble* and *Node 20*. The easiest way to build cleanly would be a Docker container: + +``` +# on the HOST system: cleanup previous container -- if it didn't exist in the first, it will show an error, ignore it +docker rm -f promnesia_build + +# on the HOST system: create the container +docker create --name promnesia_build -it ubuntu:noble /bin/bash + +# on the HOST system: put the sources into the container +docker cp /path/to/promnesia-source.zip promnesia_build:/promnesia.zip + +# on the HOST system: start the container +docker start -i promnesia_build +``` + +After that build the addon (run these commands INSIDE the container if you choose to do it with Docker): + +``` +$ apt update && apt install -y git curl unzip +$ curl -fsSL https://deb.nodesource.com/setup_20.x | bash - +$ DEBIAN_FRONTEND=noninteractive apt install -y nodejs +$ unzip promnesia.zip -d promnesia +$ cd promnesia +$ npm install +$ ./build --firefox --release --lint --publish=skip +``` + + +The final artifact will be in =/promnesia/dist/artifacts/firefox/promnesia-.zip= (INSIDE the container). + +If you need to get it back onto the HOST system (e.g. to test in the browser), run on the HOST system (e.g. in a separate terminal): + +docker cp promnesia_build:/promnesia/dist/artifacts/firefox/promnesia-.zip . + +This will copy it into the current directory on the HOST system. +" } } diff --git a/extension/build b/extension/build index d14b3dd3..1c7e7fa3 100755 --- a/extension/build +++ b/extension/build @@ -32,7 +32,7 @@ def main() -> None: p.add_argument('--release', action='store_true', help="Use release flavor of build") p.add_argument('--watch' , action='store_true') p.add_argument('--lint' , action='store_true') - p.add_argument('--publish', choices=['listed', 'unlisted'], help="Publish on chrome web store/addons.mozilla.org") + p.add_argument('--publish', choices=['listed', 'unlisted', 'skip'], help="Publish on chrome web store/addons.mozilla.org") p.add_argument('--v3', action='store_const', const='3', dest='manifest') p.add_argument('--v2', action='store_const', const='2', dest='manifest') @@ -115,7 +115,8 @@ def main() -> None: if args.release: assert args.lint # TODO not sure.. - if args.publish is not None: + if args.publish not in {None, 'skip'}: + # 'skip' mode is useful to build exactly same build as for the store, but without actually uploading assert args.lint assert args.release diff --git a/extension/package.json b/extension/package.json index d8628824..a1cbbe2a 100644 --- a/extension/package.json +++ b/extension/package.json @@ -1,7 +1,7 @@ { "name": "Promnesia", - "version": "1.3.0.2", - "version_name": "released on 2024.06.05", + "version": "1.3.1", + "version_name": "released on 2024.06.06", "description": "Recall which pages you already visited, why and in which context", "scripts": { "test": "jest", diff --git a/extension/src/background.ts b/extension/src/background.ts index 3d7d58b0..5c333ba1 100644 --- a/extension/src/background.ts +++ b/extension/src/background.ts @@ -145,7 +145,7 @@ async function updateState(tab: TabUrl): Promise { await browser.scripting.insertCSS ({target: target, files: ['sidebar-outer.css']}) await browser.scripting.insertCSS ({target: target, files: ['sidebar.css' ]}) await browser.scripting.insertCSS ({target: target, css: opts.position_css }) - await browser.scripting.executeScript({target: target, files: ['sidebar.js' ]}) + await executeScript ({target: target, files: ['sidebar.js'] }) proceed = true // successful code injection } catch (error) { const msg = (error as Error).message