Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
```
Comment thread
jannis-baum marked this conversation as resolved.

### Reloading config

Expand Down
4 changes: 4 additions & 0 deletions loader.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { register } from 'node:module';
import { pathToFileURL } from 'node:url';

register('ts-node/esm', pathToFileURL('./'));
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from 'fs';
import { globSync } from 'glob';
import { App } from 'open';
import { homedir } from 'os';
import path from 'path';

Expand All @@ -26,6 +27,7 @@ type Config = {
titles?: Record<string, string>;
fallbackIcon?: string;
};
browserOptions?: App | App[];
};

// fills in values from config file config that are not present
Expand Down
Loading