Skip to content

Commit

Permalink
extension: update AMO instruction and prepare for store release
Browse files Browse the repository at this point in the history
  • Loading branch information
karlicoss committed Jun 5, 2024
1 parent d882758 commit 97575f4
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 19 deletions.
23 changes: 10 additions & 13 deletions doc/addons-mozilla-org.org
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,47 @@ 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

# 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-<version>.zip= (INSIDE the container).
The final artifact will be in =/promnesia/dist/artifacts/firefox/promnesia-<version>.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-<version>.zip .
docker cp promnesia_build:/promnesia/dist/artifacts/firefox/promnesia-<version>.zip .
#+end_src

This will copy it into the current directory on the HOST system.
Expand Down
44 changes: 43 additions & 1 deletion extension/amo-metadata.json
Original file line number Diff line number Diff line change
@@ -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-<version>.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-<version>.zip .

This will copy it into the current directory on the HOST system.
"
}
}
5 changes: 3 additions & 2 deletions extension/build
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions extension/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion extension/src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async function updateState(tab: TabUrl): Promise<void> {
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
Expand Down

0 comments on commit 97575f4

Please sign in to comment.