A desktop browser with x402 built in: when a page asks for payment, it pays in stablecoins and shows the content.

9 downloads

Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-browser.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-browser.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-browser.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 toolbar: Back and Forward are greyed out when there's nowhere to go cc08c7a 1 week, 2 days ago History
version.mjs · 3.0 KB · 64 lines
1#!/usr/bin/env node
2// The browser's version (see src/version.ts for the scheme).
3//
4// node apps/browser/scripts/version.mjs show it: 2026.11v1 (package.json: 2026.11.1)
5// node apps/browser/scripts/version.mjs cut cut the next release in this UTC month
6// node apps/browser/scripts/version.mjs cut 2026.11v1 or a given one (either spelling; -beta.N for a pre-release)
7//
8// A cut rewrites the version in apps/browser/package.json and the lockfile, and moves the changelog's Unreleased section
9// under the new version with today's UTC date. It never commits, tags or pushes: it prints the commands for that.
10import { readFileSync, writeFileSync } from "node:fs";
11import { dirname, join } from "node:path";
12import { fileURLToPath } from "node:url";
13import { parseVersion, nextVersion, shownVersion, semverVersion, compareVersions } from "../src/version.ts";
14
15const app = join(dirname(fileURLToPath(import.meta.url)), "..");
16const repo = join(app, "..", "..");
17const pkgPath = join(app, "package.json");
18const lockPath = join(repo, "package-lock.json");
19const changelogPath = join(repo, "CHANGELOG.md");
20
21const pkgText = readFileSync(pkgPath, "utf8");
22const current = JSON.parse(pkgText).version;
23const cur = parseVersion(current);
24const [cmd, arg] = process.argv.slice(2);
25
26if (!cmd) {
27 console.log(cur ? `${shownVersion(cur)} (package.json: ${current})` : `${current} (not a release version yet)`);
28 process.exit(0);
29}
30if (cmd !== "cut") {
31 console.error("usage: version.mjs [cut [version]]");
32 process.exit(2);
33}
34
35const next = arg ? parseVersion(arg) : nextVersion(current, new Date());
36if (!next) {
37 console.error(`"${arg}" is not a version like 2026.11v1 or 2026.11.1`);
38 process.exit(2);
39}
40if (cur && compareVersions(next, cur) <= 0) {
41 console.error(`${shownVersion(next)} is not after the current ${shownVersion(cur)}`);
42 process.exit(1);
43}
44const semver = semverVersion(next);
45const shown = shownVersion(next);
46
47// package.json and the lockfile: replace only the version string, keeping the files' own formatting.
48const versionLine = /("version":\s*")[^"]*(")/;
49writeFileSync(pkgPath, pkgText.replace(versionLine, `$1${semver}$2`));
50const lock = readFileSync(lockPath, "utf8");
51const at = lock.indexOf('"apps/browser": {');
52if (at < 0) throw new Error("apps/browser is not in package-lock.json");
53const head = lock.slice(0, at);
54const rest = lock.slice(at);
55writeFileSync(lockPath, head + rest.replace(versionLine, `$1${semver}$2`));
56
57// The changelog: what was Unreleased becomes this release; a fresh, empty Unreleased goes above it.
58const date = new Date().toISOString().slice(0, 10);
59const log = readFileSync(changelogPath, "utf8");
60if (!log.includes("\n## [Unreleased]\n")) throw new Error("CHANGELOG.md has no ## [Unreleased] heading");
61writeFileSync(changelogPath, log.replace("\n## [Unreleased]\n", `\n## [Unreleased]\n\n## [${shown}] - ${date}\n`));
62
63console.log(`${cur ? shownVersion(cur) : current} → ${shown} (package.json: ${semver})`);
64console.log(`next: git commit -am "${shown}" && git tag -a ${shown} -m "${shown}" (pushing the tag publishes it)`);