add points

This commit is contained in:
polv committed 2026-03-23 22:26:30 +07:00
1 parent e3d06ebe9f
commit f2782a1f99
5 files changed
+321 -1

No files matched your search

+10 -1
View File
@@ -2,6 +2,10 @@ const { Webview } = require("webview-nodejs");
const { spawn } = require("child_process");
const PORT = 5173;
/**
* I don’t see an alternative: “DeprecationWarning: Passing args to a child process with shell option true …”
* https://github.com/nodejs/help/issues/5063
*/
const p = spawn("pnpm", ["vitepress", "dev", "--port", String(PORT), "docs"], {
shell: true,
stdio: "inherit",
@@ -14,7 +18,7 @@ w.init(/* js */ `
document.addEventListener('click', (ev) => {
if (ev.target.matches('a')) {
const href = ev.target.href || '';
if (href.startsWith('https://')) ev.preventDefault();
if (href.startsWith('https://resources.allsetlearning.com/chinese/')) ev.preventDefault();
}
})
`);
@@ -22,4 +26,9 @@ w.navigate(`http://localhost:${PORT}`);
w.show();
console.log(p.kill("SIGINT"));
/**
* node:child_process#spawn doesn't fire close event if app exits immediately after spawned app exits
* ??? https://github.com/oven-sh/bun/issues/3083
*/
require("kill-port")(PORT);