Skip to content

Languages and Toolchains

kurokyuu edited this page Nov 19, 2026 · 1 revision

Languages and toolchains

Rust scripts, PHP and JavaScript/TypeScript projects, and Firefox browser extensions.

Rust scripts

Next to the Python and C# scripts, a single-file rust-script program is an option when Rust is the better tool (speed, a crate that already does the job). rust.py runs them, in any project that has a [rust] block, whether or not it is a cargo crate:

python3 Scripts/rust.py script --list            # Scripts/rust/*.rs, with the first comment line as purpose
python3 Scripts/rust.py script NAME -- args      # rust-script --debug Scripts/rust/NAME.rs args
python3 Scripts/rust.py script NAME --release    # the optimised build, for one that crunches data

A debug build by default: a script runs once or twice, and rust-script's optimised build costs more compile time than it saves. Dependencies go in the script's own //! ```cargo manifest block. Needs rust-script on the PATH (cargo install rust-script).

PHP and JavaScript / TypeScript / Vue

php.py ([php]) and web.py ([web]) are the two small ones, for a project that is PHP, JS, or both (a Nextcloud app):

python3 Scripts/php.py lint | test | verify   # php -l under [php] sources; phpunit (vendor/bin, else the system one on tests/)
python3 Scripts/web.py install | lint | typecheck | test | build | verify   # npm run <step>, a missing script is skipped

php.py runs the local php, else a throw-away podman php:8.5-cli with the project mounted. web.py knows no tool: eslint, tsc, vue-tsc, vitest, vite are the project's devDependencies behind its package.json scripts.

Browser extensions

browser_extension.py lints, builds and signs the Firefox add-on a project carries, in any project with a [browser_extension] block:

python3 Scripts/browser_extension.py status      # name, version, signed versions, whether the credentials are set
python3 Scripts/browser_extension.py bump        # 1.4 -> 1.5 in manifest.json (or `bump 2.0`); only ever upwards
python3 Scripts/browser_extension.py lint
python3 Scripts/browser_extension.py sign        # lint, then Mozilla signs it unlisted; the .xpi lands in web-ext-artifacts/
python3 Scripts/browser_extension.py build       # an unsigned .zip, for Chrome or a manual upload

upload puts the signed .xpi of the current version on a Nextcloud over WebDAV, so the other machines can install it: Internal Programs/{Project}/{BrowserExtension}/{project}-ext-{version}.xpi, missing folders created, the same version replaced. Machines in between need it, a listed add-on does not. NXT_CLD_USR names the user, NXT_CLD_KW_SEC_KEY the KDE Wallet key that holds its app password (Nextcloud → Settings → Security → App password; read with kwallet-query); nextcloud_url (else DEVSCRIPTS_NEXTCLOUD_URL), nextcloud_folder and nextcloud_project in the [browser_extension] block override the rest.

Every upload needs a higher version than any before it, so sign refuses a version that already has a .xpi in the artifacts folder and says to bump. The credentials are AMO_JWT_ISSUER and AMO_JWT_SECRET in the environment (addons.mozilla.org → Developer Hub → API keys); they reach web-ext through WEB_EXT_API_KEY and WEB_EXT_API_SECRET, not through the command line. sign --listed publishes in the public directory instead. Install the result in Firefox through Add-ons → gear → Install Add-on From File; a Manifest V3 add-on's host permissions are granted separately under Add-ons → the add-on → Permissions. browser_extension.test.py checks it.

Clone this wiki locally