This project uses Conventional Commits to automate versioning. If you're a new contributor, don't worry about this. When you open a PR, a maintainer will change the PR's title so it's in the style of conventional commits, but that's all.
The extension requires globally installed:
-
The version of Node.js used is specified in
.nvmrc
. It is recommended to use version managers - e.g. fnm. -
If
rustup
is used, it should automatically install everything you need when building. If not, you need to manually install the version and target specified in the rust-toolchain.toml file. -
To install:
cargo install --locked cargo-run-bin
-
install dependencies::
pnpm i
this will also automatically build
segmenter-utils
-
if you don't want the dev-version of the extension to conflict with the prod-version, create a
.env.local
file with the contents:[email protected] # more about Gecko ID: # https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_specific_settings#extension_id_format
-
run
pnpm dev:ff
to build an extension for Firefox-based browsers -
load the extension from the
.output/firefox-mv2
directory
Here are some helpful commands:
pnpm build:ff
- builds an extension for Firefoxpnpm zip:ff
- builds and packages an extension for Firefoxpnpm test
- runs the tests oncepnpm test:watch
- runs tests in watch modepnpm su:watch
- starts a dev build ofsegmenter-utils
in watch modepnpm test-build-reproducibility
- checks if build is reproducible (this is required to pass an AMO review)
A copy of the https://coub.com/graphql
GraphQL schema is stored in the repository for type checking. Usually there is no need to touch it, but if the schema becomes outdated, to update it, execute:
pnpm gql:fetch-schema # executes an Introspection query and saves its response
pnpm gql:gen # generates types based on the scheme
To generate N
fake channels for the blockedChannels
storage:
- run
$ node ./utils/fakeBlockedChannels.js N # N is a positive integer Wrote 1,000 channels to blockedChannels.json
- open the extension settings and import the backup from the created
blockedChannels.json
file
-
set up a local server that serves files from the
docs
directoryThis server must work over HTTPS, but even self-signed certificates will work. I have a server listening on
localhost:8080
, but if you have a different host - replace it in the following steps. -
create
.env.local
with the contents:VITE_GECKO_UPDATE_URL=https://localhost:8080/updates.json
-
disable certificate validation in
about:config
by creating a settings:extensions.install.requireBuiltInCerts = false extensions.update.requireBuiltInCerts = false
-
build a ZIP with the new version of the extension, change its extension from
.zip
to.xpi
and copy it todocs
so that the new version is indocs/coub-addons-x.x.x-firefox.xpi
Here and below
x.x.x
is used instead of the extension version, don't forget to replace it with the real one. -
add the new version to
docs/updates.json
in theupdates
field:{ "updates": [ // ... other updates ... { "version": "x.x.x", "update_link": "https://localhost:8080/coub-addons-x.x.x-firefox.xpi" } ] }
-
open
about:addons
, click on the gear and selectCheck for Updates
to force check for updates
If something doesn't work, see Testing Automatic Updating.
At the moment releases are done manually. To create a release, run pnpm bump
.
This will automatically bump up the version based on new commits added since the previous tag, generate a CHANGELOG.md
, build and package the extension for Firefox, creating two files in the .output
directory:
coub-addons-x.x.x-firefox.zip
- unsigned extensioncoub-addons-x.x.x-sources.zip
- source code of the extension for review in AMO
where x.x.x
is the new version of the extension after bump
(e.g. 0.1.20
).
To publish a release, run:
pnpm release-build
pnpm tsx ./utils/upload/index.ts