reviw 0.10.3 → 0.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.cjs +16 -12
  2. package/package.json +6 -6
package/cli.cjs CHANGED
@@ -21,7 +21,7 @@ const marked = require("marked");
21
21
  const yaml = require("js-yaml");
22
22
 
23
23
  // --- CLI arguments ---------------------------------------------------------
24
- const VERSION = "0.10.3";
24
+ const VERSION = require("./package.json").version;
25
25
  const args = process.argv.slice(2);
26
26
 
27
27
  const filePaths = [];
@@ -4188,7 +4188,7 @@ function shutdownAll() {
4188
4188
  process.on("SIGINT", shutdownAll);
4189
4189
  process.on("SIGTERM", shutdownAll);
4190
4190
 
4191
- function createFileServer(filePath) {
4191
+ function createFileServer(filePath, fileIndex = 0) {
4192
4192
  return new Promise((resolve) => {
4193
4193
  const baseName = path.basename(filePath);
4194
4194
  const baseDir = path.dirname(filePath);
@@ -4403,14 +4403,18 @@ function createFileServer(filePath) {
4403
4403
  : process.platform === "win32"
4404
4404
  ? "start"
4405
4405
  : "xdg-open";
4406
- try {
4407
- spawn(opener, [url], { stdio: "ignore", detached: true });
4408
- } catch (err) {
4409
- console.warn(
4410
- "Failed to open browser automatically. Please open this URL manually:",
4411
- url,
4412
- );
4413
- }
4406
+ // Add delay for multiple files to avoid browser ignoring rapid open commands
4407
+ const delay = fileIndex * 300;
4408
+ setTimeout(() => {
4409
+ try {
4410
+ spawn(opener, [url], { stdio: "ignore", detached: true });
4411
+ } catch (err) {
4412
+ console.warn(
4413
+ "Failed to open browser automatically. Please open this URL manually:",
4414
+ url,
4415
+ );
4416
+ }
4417
+ }, delay);
4414
4418
  }
4415
4419
  startWatcher();
4416
4420
  resolve(ctx);
@@ -4619,8 +4623,8 @@ function createDiffServer(diffContent) {
4619
4623
  // File mode: files specified
4620
4624
  console.log(`Starting servers for ${resolvedPaths.length} file(s)...`);
4621
4625
  serversRunning = resolvedPaths.length;
4622
- for (const filePath of resolvedPaths) {
4623
- await createFileServer(filePath);
4626
+ for (let i = 0; i < resolvedPaths.length; i++) {
4627
+ await createFileServer(resolvedPaths[i], i);
4624
4628
  }
4625
4629
  console.log("Close all browser tabs or Submit & Exit to finish.");
4626
4630
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reviw",
3
- "version": "0.10.3",
3
+ "version": "0.10.5",
4
4
  "description": "Lightweight file reviewer with in-browser comments for CSV, TSV, Markdown, and Git diffs.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,10 +9,6 @@
9
9
  "files": [
10
10
  "cli.cjs"
11
11
  ],
12
- "scripts": {
13
- "test": "vitest run",
14
- "test:watch": "vitest"
15
- },
16
12
  "license": "MIT",
17
13
  "author": "kazuph",
18
14
  "publishConfig": {
@@ -31,5 +27,9 @@
31
27
  "@playwright/test": "^1.57.0",
32
28
  "playwright": "^1.57.0",
33
29
  "vitest": "^4.0.14"
30
+ },
31
+ "scripts": {
32
+ "test": "vitest run",
33
+ "test:watch": "vitest"
34
34
  }
35
- }
35
+ }