@youtyan/code-viewer 0.1.16 → 0.1.18
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 +34 -8
- package/dist/code-viewer.js +2374 -0
- package/package.json +24 -18
- package/web/app.js +489 -211
- package/web/style.css +12 -0
- package/web-src/routes.ts +0 -148
- package/web-src/server/cache.ts +0 -64
- package/web-src/server/dev-assets.ts +0 -37
- package/web-src/server/dev.ts +0 -100
- package/web-src/server/git.ts +0 -506
- package/web-src/server/preview.ts +0 -1160
- package/web-src/server/range.ts +0 -236
- package/web-src/server/runtime.d.ts +0 -61
- package/web-src/server/search.ts +0 -104
- package/web-src/types.ts +0 -142
package/README.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Local browser-based code and git diff viewer.
|
|
4
4
|
|
|
5
|
-
Requires
|
|
5
|
+
Requires Node.js 20 or newer when installed from npm. Development uses
|
|
6
|
+
[Bun](https://bun.sh/).
|
|
6
7
|
|
|
7
8
|
## Features
|
|
8
9
|
|
|
@@ -16,27 +17,52 @@ Requires [Bun](https://bun.sh/) on your `PATH`.
|
|
|
16
17
|
|
|
17
18
|
## Usage
|
|
18
19
|
|
|
20
|
+
From inside a git repository, run it without installing:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npx @youtyan/code-viewer
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The server prints a local URL. Add `--open` if you want the browser opened
|
|
27
|
+
automatically:
|
|
28
|
+
|
|
19
29
|
```sh
|
|
20
|
-
|
|
30
|
+
npx @youtyan/code-viewer --open
|
|
21
31
|
```
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
To inspect another repository, pass `--cwd`:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
npx @youtyan/code-viewer --cwd /path/to/repo
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Equivalent one-shot commands also work:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
pnpm dlx @youtyan/code-viewer
|
|
43
|
+
bunx @youtyan/code-viewer
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Or install it globally:
|
|
24
47
|
|
|
25
48
|
```sh
|
|
26
49
|
npm install -g @youtyan/code-viewer
|
|
27
|
-
code-viewer
|
|
50
|
+
code-viewer
|
|
28
51
|
```
|
|
29
52
|
|
|
30
|
-
|
|
31
|
-
`
|
|
53
|
+
The published CLI runs on Node.js 20 or newer. Bun is supported as a package
|
|
54
|
+
runner through `bunx`, but the npm package no longer requires Bun at runtime.
|
|
55
|
+
|
|
56
|
+
Arguments after options are passed to `git diff`. By default, code-viewer
|
|
57
|
+
compares `HEAD` with the working tree.
|
|
32
58
|
|
|
33
59
|
```sh
|
|
60
|
+
npx @youtyan/code-viewer HEAD~1 HEAD
|
|
61
|
+
npx @youtyan/code-viewer --staged
|
|
34
62
|
code-viewer HEAD~1 HEAD
|
|
35
63
|
code-viewer --cwd /path/to/repo --staged
|
|
36
64
|
```
|
|
37
65
|
|
|
38
|
-
Pass `--open` only when you want the browser opened automatically.
|
|
39
|
-
|
|
40
66
|
## Repository View
|
|
41
67
|
|
|
42
68
|
Open the root URL to browse the repository tree. Folder pages keep the sidebar
|