diff --git a/.eslintrc.cjs b/.eslintrc.cjs
deleted file mode 100644
index f93cba77..00000000
--- a/.eslintrc.cjs
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @type {import('eslint').ESLint.Options} */
-module.exports = {
- root: true,
- ignorePatterns: [".eslintrc.cjs"],
- parser: "@typescript-eslint/parser",
- parserOptions: {
- ecmaVersion: "latest",
- sourceType: "module",
- project: [__dirname + "/app/tsconfig.json"],
- },
- extends: [
- "eslint:recommended",
- "plugin:@typescript-eslint/strict-type-checked",
- "plugin:@typescript-eslint/stylistic-type-checked",
- ],
- rules: {
- "@typescript-eslint/no-unused-expressions": "off",
- "@typescript-eslint/restrict-template-expressions": ["error", { allowNumber: true }],
- "@typescript-eslint/no-non-null-assertion": "off",
- "@typescript-eslint/consistent-type-definitions": ["error", "type"],
- "@typescript-eslint/no-unused-vars": [
- "error",
- { argsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_" },
- ],
- "@typescript-eslint/consistent-type-imports": [
- "warn",
- { prefer: "type-imports", fixStyle: "inline-type-imports" },
- ],
- },
-};
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 183b24f1..860e117d 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -13,13 +13,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
- uses: actions/checkout@v4
+ uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup node
- uses: actions/setup-node@v4
+ uses: actions/setup-node@v6
with:
- node-version: 20.x
+ node-version: 24.x
- name: Install bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
@@ -34,17 +34,10 @@ jobs:
echo "Code not properly formatted. Please run 'bun run format' locally and commit changes."
exit 1
fi
- - name: Validate tailwind.css
- run: |
- bun run tailwind:compile
- if [[ $(git status --porcelain) ]]; then
- echo "Outdated tailwind.css found. Please run 'bun run tailwind:compile' locally and commit changes."
- exit 1
- fi
- name: Lint & check types
run: bun run check
- - name: Test
- run: bun test
+ # - name: Test
+ # run: bun test
Release:
needs: [Test]
@@ -58,11 +51,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
- uses: actions/checkout@v4
+ uses: actions/checkout@v6
- name: Setup node
- uses: actions/setup-node@v4
+ uses: actions/setup-node@v6
with:
- node-version: 20.x
+ node-version: 24.x
- name: Install bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
diff --git a/.oxfmtrc.json b/.oxfmtrc.json
new file mode 100644
index 00000000..695afe96
--- /dev/null
+++ b/.oxfmtrc.json
@@ -0,0 +1,21 @@
+{
+ "$schema": "./node_modules/oxfmt/configuration_schema.json",
+ "ignorePatterns": [".github"],
+ "printWidth": 100,
+ "tabWidth": 3,
+ "sortImports": {
+ "newlinesBetween": false
+ },
+ "sortTailwindcss": {
+ "stylesheet": "./app/web/static/app.css",
+ "functions": ["cn"]
+ },
+ "overrides": [
+ {
+ "files": ["*.json", "*.md"],
+ "options": {
+ "tabWidth": 2
+ }
+ }
+ ]
+}
diff --git a/.prettierignore b/.prettierignore
deleted file mode 100644
index 26b57c6a..00000000
--- a/.prettierignore
+++ /dev/null
@@ -1,2 +0,0 @@
-tailwind.css
-.github/dependabot.yml
diff --git a/.prettierrc.json b/.prettierrc.json
deleted file mode 100644
index 081f39bd..00000000
--- a/.prettierrc.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "tabWidth": 4,
- "printWidth": 100,
- "plugins": ["prettier-plugin-organize-imports"],
- "overrides": [
- {
- "files": ["*.json", "*.md", "*.yml"],
- "options": { "tabWidth": 2 }
- }
- ]
-}
diff --git a/README.md b/README.md
index 61887b30..9ddea764 100644
--- a/README.md
+++ b/README.md
@@ -12,21 +12,21 @@ https://github.com/wallpants/github-preview.nvim/assets/47203170/e332a671-0ee4-4
## ✨ Features
-* [💻 Linux / macOS / WSL](/docs/FEATURES.md#-linux--macos--wsl)
-* [🔴 LIVE updates](/docs/FEATURES.md#-live-updates)
-* [♻️ Synced Scrolling](/docs/FEATURES.md#%EF%B8%8F-synced-scrolling)
-* [🌈 Dark & Light modes](/docs/FEATURES.md#-dark--light-modes)
-* [🖍️ Cursorline in Preview](/docs/FEATURES.md#%EF%B8%8F-cursorline-in-preview)
-* [📹 Video Support](/docs/FEATURES.md#-video-support)
-* [🏞️ Local Image Support](/docs/FEATURES.md#%EF%B8%8F-local-image-support)
-* [🧜 Mermaid Support](/docs/FEATURES.md#-mermaid-support)
-* [📌 Single-file mode](/docs/FEATURES.md#-single-file-mode)
-* [📂 Repository mode](/docs/FEATURES.md#-repository-mode)
+- [💻 Linux / macOS / WSL](/docs/FEATURES.md#-linux--macos--wsl)
+- [🔴 LIVE updates](/docs/FEATURES.md#-live-updates)
+- [♻️ Synced Scrolling](/docs/FEATURES.md#%EF%B8%8F-synced-scrolling)
+- [🌈 Dark & Light modes](/docs/FEATURES.md#-dark--light-modes)
+- [🖍️ Cursorline in Preview](/docs/FEATURES.md#%EF%B8%8F-cursorline-in-preview)
+- [📹 Video Support](/docs/FEATURES.md#-video-support)
+- [🏞️ Local Image Support](/docs/FEATURES.md#%EF%B8%8F-local-image-support)
+- [🧜 Mermaid Support](/docs/FEATURES.md#-mermaid-support)
+- [📌 Single-file mode](/docs/FEATURES.md#-single-file-mode)
+- [📂 Repository mode](/docs/FEATURES.md#-repository-mode)
## ✅ Requirements
-* [x] [Bun](https://bun.sh)
-* [x] [Neovim](https://neovim.io)
+- [x] [Bun](https://bun.sh)
+- [x] [Neovim](https://neovim.io)
## 📦 Installation
diff --git a/app/env.ts b/app/env.ts
new file mode 100644
index 00000000..306a68b7
--- /dev/null
+++ b/app/env.ts
@@ -0,0 +1,13 @@
+import { z } from "zod";
+
+export const ENV = z
+ .object({
+ NVIM: z.string(),
+ LOG_LEVEL: z.enum(["debug", "verbose", "info", "none"]),
+ IS_DEV: z.boolean(),
+ })
+ .parse({
+ NVIM: process.env.NVIM,
+ LOG_LEVEL: process.env.LOG_LEVEL,
+ IS_DEV: process.env.LOG_LEVEL !== "none",
+ });
diff --git a/app/github-preview.ts b/app/github-preview.ts
index ddbf451f..a6d3fdbc 100644
--- a/app/github-preview.ts
+++ b/app/github-preview.ts
@@ -1,300 +1,287 @@
+import { existsSync } from "node:fs";
+import { basename, dirname, normalize, resolve } from "node:path";
import { type Server } from "bun";
-import { NVIM_LOG_LEVELS, attach, type LogLevel, type Nvim } from "bunvim";
+import { NVIM_LOG_LEVELS, attach, type Nvim } from "bunvim";
import { globby } from "globby";
import { isBinaryFile } from "isbinaryfile";
-import { existsSync } from "node:fs";
-import { basename, dirname, normalize, resolve } from "node:path";
-import { parse } from "valibot";
-import { startServer } from "./server";
-import { UNALIVE_URL } from "./server/http";
+import { ENV } from "./env";
+import { startServer, UNALIVE_URL } from "./server";
import { EDITOR_EVENTS_TOPIC } from "./server/websocket";
import {
- PluginPropsSchema,
- type Config,
- type ContentChange,
- type CustomEvents,
- type PluginProps,
- type UpdateConfigAction,
- type WsServerMessage,
+ PluginPropsSchema,
+ type Config,
+ type ContentChange,
+ type GithubPreviewConfig,
+ type PluginProps,
+ type UpdateConfigAction,
+ type WsServerMessage,
+ type CustomEvents,
} from "./types";
-const ENV = {
- NVIM: process.env["NVIM"],
- LOG_LEVEL: process.env["LOG_LEVEL"] as LogLevel | undefined,
- DEV: Boolean(process.env["IS_DEV"]),
-};
-
export class GithubPreview {
- nvim: Nvim
- with ♥️ by{" "}
-
- wallpants.io
-
-
+ with ♥️ by{" "}
+
+ wallpants.io
- )}
- File explorer only available when in repository mode. File explorer only available when in repository mode.
- Temporarily override your settings.
-
+ Temporarily override your settings.
+ {name} {name} {disabled} {disabled}
+
+
+ )}
+
Files
- Files
+ Single-file mode
+ Single-file mode
-
- To persist changes, update your{" "}
-
- neovim config files
-
- .
-
+ To persist changes, update your{" "}
+
+ neovim config files
+
+ .
+