From c4e77577bfafb1ae0cb6ae5795b83f045af89cd3 Mon Sep 17 00:00:00 2001 From: Jannis Baum Date: Mon, 13 Apr 2026 15:35:36 +0200 Subject: [PATCH 1/4] fix(#295): manual loader --- loader.mjs | 4 ++++ package.json | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 loader.mjs diff --git a/loader.mjs b/loader.mjs new file mode 100644 index 0000000..9e43805 --- /dev/null +++ b/loader.mjs @@ -0,0 +1,4 @@ +import { register } from 'node:module'; +import { pathToFileURL } from 'node:url'; + +register('ts-node/esm', pathToFileURL('./')); diff --git a/package.json b/package.json index 74d8775..474d95d 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,11 @@ "repository": "https://github.com/jannis-baum/vivify.git", "author": "Jannis Baum", "scripts": { - "dev": "VIV_TIMEOUT=0 VIV_PORT=3000 NODE_ENV=development nodemon --ignore tests/rendering/symlinks --exec node --loader ts-node/esm src/app.ts", - "viv": "VIV_PORT=3000 node --loader ts-node/esm src/app.ts", + "dev": "VIV_TIMEOUT=0 VIV_PORT=3000 NODE_ENV=development nodemon --ignore tests/rendering/symlinks --exec node --import ./loader.mjs src/app.ts", + "viv": "VIV_PORT=3000 node --import ./loader.mjs src/app.ts", "lint": "eslint src static", "lint-markdown": "markdownlint-cli2 --config .github/.markdownlint-cli2.yaml", - "test": "node --loader ts-node/esm --test tests/unit/cli.ts tests/unit/alerts.ts", + "test": "node --import ./loader.mjs --test tests/unit/cli.ts tests/unit/alerts.ts", "deduplicate": "yarn-deduplicate" }, "type": "module", From cb4c669924f46af41f4685365629de4f3bd1521a Mon Sep 17 00:00:00 2001 From: Jannis Baum Date: Wed, 1 Apr 2026 10:51:00 +0200 Subject: [PATCH 2/4] feat(#291): config option to specify browser options --- src/cli.ts | 4 ++-- src/config.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 1d19e4b..8276f99 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -2,7 +2,7 @@ import axios from 'axios'; import { existsSync } from 'fs'; import open from 'open'; import { resolve as presolve } from 'path'; -import { address } from './config.js'; +import { address, config } from './config.js'; import { pathToURL, preferredPath } from './utils/path.js'; // exported for unit test @@ -20,7 +20,7 @@ export const getPathAndLine = ( }; export const openFileAt = async (path: string) => - open(`${address}${pathToURL(preferredPath(path))}`); + open(`${address}${pathToURL(preferredPath(path))}`, { app: config.browserOptions }); const openTarget = async (target: string) => { const { path, line } = getPathAndLine(target); diff --git a/src/config.ts b/src/config.ts index a3f14c5..de56439 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,5 +1,6 @@ import fs from 'fs'; import { globSync } from 'glob'; +import { App } from 'open'; import { homedir } from 'os'; import path from 'path'; @@ -26,6 +27,7 @@ type Config = { titles?: Record; fallbackIcon?: string; }; + browserOptions?: App | App[]; }; // fills in values from config file config that are not present From f55833ccadb420ef8a0a7b657fa31ac65d74c698 Mon Sep 17 00:00:00 2001 From: Jannis Baum Date: Wed, 1 Apr 2026 10:59:53 +0200 Subject: [PATCH 3/4] docs(#291): document browser options --- docs/customization.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/customization.md b/docs/customization.md index 27994b5..fe21514 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -110,6 +110,14 @@ keys: ``` For alerts customization, see [full explanation with examples](alerts.md). +- **`"browserOptions"`**\ + Options to specify which browser to open, including arguments, as specified + [here](https://www.npmjs.com/package/open#app). Examples: + + ```json + "browserOptions": { name: "firefox" } + "browserOptions": { name: "chromium", arguments: ["--incognito"] } + ``` ### Reloading config From a694c67043108aee0ed62fbe568771fb5969c566 Mon Sep 17 00:00:00 2001 From: Jannis Baum <85999315+jannis-baum@users.noreply.github.com> Date: Sat, 4 Apr 2026 09:41:15 +0200 Subject: [PATCH 4/4] docs(#291): fix json quoting Co-authored-by: Tuure Piitulainen --- docs/customization.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/customization.md b/docs/customization.md index fe21514..653078f 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -115,8 +115,8 @@ keys: [here](https://www.npmjs.com/package/open#app). Examples: ```json - "browserOptions": { name: "firefox" } - "browserOptions": { name: "chromium", arguments: ["--incognito"] } + "browserOptions": { "name": "firefox" } + "browserOptions": { "name": "chromium", "arguments": ["--incognito"] } ``` ### Reloading config