@youtyan/code-viewer 0.1.0 → 0.1.2

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.
package/README.md CHANGED
@@ -7,32 +7,39 @@ Requires [Bun](https://bun.sh/) on your `PATH`.
7
7
  ## Usage
8
8
 
9
9
  ```sh
10
- bunx @youtyan/code-viewer --cwd /path/to/repo --open
10
+ bunx @youtyan/code-viewer --cwd /path/to/repo
11
11
  ```
12
12
 
13
13
  Or after installing globally:
14
14
 
15
15
  ```sh
16
16
  npm install -g @youtyan/code-viewer
17
- code-viewer --cwd /path/to/repo --open
17
+ code-viewer --cwd /path/to/repo
18
18
  ```
19
19
 
20
20
  Arguments after options are passed to `git diff`. By default it compares
21
21
  `HEAD` with the working tree.
22
22
 
23
23
  ```sh
24
- code-viewer --open HEAD~1 HEAD
25
- code-viewer --cwd /path/to/repo --open --staged
24
+ code-viewer HEAD~1 HEAD
25
+ code-viewer --cwd /path/to/repo --staged
26
26
  ```
27
27
 
28
+ Pass `--open` only when you want the browser opened automatically.
29
+
28
30
  ## Development
29
31
 
30
32
  ```sh
31
33
  bun install
32
34
  bun run verify
33
- bun run preview --cwd /path/to/repo --open
35
+ bun run preview --cwd /path/to/repo
34
36
  ```
35
37
 
38
+ `bun run preview` is the development runner. It rebuilds the browser bundle
39
+ when `web-src/app.ts` changes, restarts the preview server when
40
+ `web-src/server/*.ts` changes, and keeps the URL stable on
41
+ `http://127.0.0.1:64160/` unless you pass `--port <port>`.
42
+
36
43
  ## License
37
44
 
38
45
  MIT. Third-party licenses for bundled browser assets are included under
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@youtyan/code-viewer",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Local browser-based git diff viewer",
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,6 +22,7 @@
22
22
  "files": [
23
23
  "web",
24
24
  "web-src/server",
25
+ "web-src/routes.ts",
25
26
  "web-src/types.ts",
26
27
  "README.md",
27
28
  "LICENSE"
@@ -30,8 +31,9 @@
30
31
  "build": "bun build --target=browser --format=iife --outfile=web/app.js web-src/app.ts",
31
32
  "check": "tsc --noEmit",
32
33
  "check:bundle": "bun build --target=browser --format=iife --outfile=/tmp/code-viewer-app.js web-src/app.ts && cmp /tmp/code-viewer-app.js web/app.js",
33
- "dev": "bun build --watch --target=browser --format=iife --outfile=web/app.js web-src/app.ts",
34
- "preview": "bun run web-src/server/preview.ts",
34
+ "dev": "bun run web-src/server/dev.ts",
35
+ "preview": "bun run web-src/server/dev.ts",
36
+ "preview:raw": "bun run web-src/server/preview.ts",
35
37
  "test": "bun test",
36
38
  "verify": "bun run check && bun run build && bun run check:bundle && bun run test && node --check web/app.js",
37
39
  "pack:dry": "npm pack --dry-run",