Skip to content
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3253d70
Replace npm with pnpm
noClaps Nov 4, 2026
e8bf18f
Replace ESLint with Oxlint
noClaps Nov 4, 2026
e8a5e48
Replace Prettier with Oxfmt
noClaps Nov 4, 2026
705b953
Update lockfile
noClaps Nov 4, 2026
067a0e6
Update @types/node
noClaps Nov 4, 2026
00400e4
Add Knip and add undeclared dependencies
noClaps Nov 4, 2026
5bf07ce
Downgrade to history@4.10.1
noClaps Nov 4, 2026
0c72357
Update Vite and @vitejs/plugin-react to latest versions
noClaps Nov 5, 2026
26cf87f
Update TypeScript to latest version
noClaps Nov 5, 2026
4564259
Update code block comment in README.md
noClaps Nov 5, 2026
8d3272a
Replace redux-devtools-extension with @redux-devtools/extension
noClaps Nov 5, 2026
17263ca
Import React global instead of glob import as React
noClaps Nov 5, 2026
415f5db
Update Vite
noClaps Nov 6, 2026
410e2ed
Update react-markdown
noClaps Nov 6, 2026
50f9f93
Update react-helmet-async
noClaps Nov 6, 2026
43461c1
Update react-intersection-observer
noClaps Nov 6, 2026
0b2ca1a
Update CI for pnpm tooling
Codycody31 Nov 6, 2026
00b5e82
Update lint script to run both oxlint and knip
noClaps Nov 8, 2026
dac2e05
Modernise code from suggestions by e18e CLI
noClaps Nov 8, 2026
9327e96
Update dependencies
noClaps Nov 8, 2026
7ac720e
Remove esbuild from pnpm-workspace.yaml
noClaps Nov 8, 2026
760c139
Replace redux, redux-thunk and @redux-devtools/extension with
noClaps Nov 8, 2026
6066091
Add .zed to gitignore
noClaps Nov 8, 2026
4865bb9
Add linting and formatting step in CI
noClaps Nov 8, 2026
a35a633
Fix issues raised by Knip
noClaps Nov 8, 2026
74b6e0e
Remove more unused code
noClaps Nov 8, 2026
e040264
Remove unneeded react-router dependency
noClaps Nov 8, 2026
b4df1fa
Fix Oxlint errors and warnings
noClaps Nov 8, 2026
5044657
Format
noClaps Nov 8, 2026
073db16
Use React Router v5.1 style Route component
noClaps Nov 8, 2026
56e464a
Update dependencies
noClaps Nov 8, 2026
ebb0505
Update to React Router v6
noClaps Nov 9, 2026
92622d9
Fix issues in React Router v6 migration
noClaps Nov 9, 2026
58ebf5b
Update to React Router v7
noClaps Nov 9, 2026
5949e12
Update to React Router v8, react-redux v9, React v19
noClaps Nov 9, 2026
3f45c4f
Remove react-helmet-async
noClaps Nov 9, 2026
52b6cbc
Fix bug when navigating between posts
noClaps Nov 9, 2026
0aa6713
Update react-error-boundary to latest version
noClaps Nov 9, 2026
780107d
Run tsc -b in lint script
noClaps Nov 9, 2026
fba62cf
Update dependencies
noClaps Nov 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,35 @@ jobs:
if: steps.changes.outputs.code == 'true'
run: go vet -mod=readonly ./...

- name: Set up pnpm
if: steps.changes.outputs.code == 'true'
uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
with:
version: "12"

- name: Set up Node.js
if: steps.changes.outputs.code == 'true'
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: '24'
cache: npm
cache-dependency-path: ui/package-lock.json
node-version-file: ui/package.json
cache: pnpm
cache-dependency-path: ui/pnpm-lock.yaml

- name: Install frontend dependencies
if: steps.changes.outputs.code == 'true'
working-directory: ui
run: npm ci --prefer-offline --no-audit --no-fund
run: pnpm install --frozen-lockfile --prefer-offline

- name: Build frontend and service worker
if: steps.changes.outputs.code == 'true'
run: |
cp config.default.yaml config.yaml
npm --prefix ui run build
pnpm --dir ui run build
test -s ui/dist/index.html
test -s ui/dist/service-worker.js

- name: Run linting and formatting checks
if: steps.changes.outputs.code == 'true'
run: |
pnpm --dir ui run lint
pnpm --dir ui oxfmt --check
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
node_modules
.vscode
.idea
.zed
/ui/dist/
/config.yaml
/ui-config.yaml
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To setup a development environment of Discuit on your local computer:

1. Install Go (1.21 or higher) by following the instructions at
[go.dev.](https://go.dev/doc/install)
1. Install MariaDB (11.3 or higher), Redis, Node.js (and NPM). On Ubuntu, for
1. Install MariaDB (11.3 or higher), Redis, pnpm. On Ubuntu, for
instance, you might have to run the following commands:

```shell
Expand All @@ -32,8 +32,8 @@ To setup a development environment of Discuit on your local computer:
sudo apt install redis-server
sudo systemctl start redis.service

# Install Node.js and NPM
sudo apt install nodejs npm
# Install pnpm
curl -fsSL https://get.pnpm.io | sh -
```

1. Create a MariaDB database.
Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ go build

# Build the React app
cd ui
npm ci
npm run build
pnpm ci
pnpm run build
cd ..

6 changes: 3 additions & 3 deletions docker/Dockerfile.amd64
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ COPY server/ ./server/
RUN go build -o discuit .

# Use official Node image for the frontend build
FROM node:24 AS frontend-builder
FROM ghcr.io/pnpm/pnpm:12 AS frontend-builder

# The entrypoint builds the UI so it can use the deployment's config.
WORKDIR /app/ui
COPY ui/package*.json ./
RUN npm ci --prefer-offline --no-audit --no-fund
COPY ui/package.json pnpm-lock.yaml pnpm-workspace.yaml ./
RUN pnpm ci --prefer-offline
COPY ui/ .

# Final stage: setup the runtime environment
Expand Down
6 changes: 3 additions & 3 deletions docker/Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ COPY server/ ./server/
RUN go build -ldflags "-s -w" -o discuit .

# Use official Node image for the frontend build
FROM node:24 AS frontend-builder
FROM ghcr.io/pnpm/pnpm:12 AS frontend-builder

# The entrypoint builds the UI so it can use the deployment's config.
WORKDIR /app/ui
COPY ui/package*.json ./
RUN npm ci --prefer-offline --no-audit --no-fund
RUN pnpm ci --prefer-offline
COPY ui/ .

# Final stage: setup the runtime environment
FROM node:24
FROM ghcr.io/pnpm/pnpm:24
# Avoid prompts from the package manager during build
ENV DEBIAN_FRONTEND=noninteractive

Expand Down
2 changes: 1 addition & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mysql -e "GRANT ALL PRIVILEGES ON discuit.* TO 'discuit'@'127.0.0.1';"
# Build the UI
echo "Building the UI..."
cd /app/ui
npm run build
pnpm run build
cd ..

# Start the Discuit server
Expand Down
29 changes: 0 additions & 29 deletions ui/.eslintrc.cjs

This file was deleted.

5 changes: 4 additions & 1 deletion ui/.prettierrc → ui/.oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"semi": true,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "es5",
"sortPackageJson": false,
"overrides": [
{
"files": ["*.html", "*.scss"],
Expand All @@ -12,5 +14,6 @@
"trailingComma": "none"
}
}
]
],
"ignorePatterns": ["node_modules", "/dist"]
}
153 changes: 153 additions & 0 deletions ui/.oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["typescript", "react", "unicorn"],
"categories": {
"correctness": "off"
},
"env": {
"builtin": true,
"es2026": true,
"browser": true
},
"settings": {
"react": {
"version": "18.2"
}
},
"ignorePatterns": ["**/dist", "**/.eslintrc.cjs"],
"rules": {
"constructor-super": "error",
"for-direction": "error",
"getter-return": "error",
"no-async-promise-executor": "error",
"no-case-declarations": "error",
"no-class-assign": "error",
"no-compare-neg-zero": "error",
"no-cond-assign": "error",
"no-const-assign": "error",
"no-constant-binary-expression": "error",
"no-constant-condition": "error",
"no-control-regex": "error",
"no-debugger": "error",
"no-delete-var": "error",
"no-dupe-class-members": "error",
"no-dupe-else-if": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-empty": "error",
"no-empty-character-class": "error",
"no-empty-pattern": "error",
"no-empty-static-block": "error",
"no-ex-assign": "error",
"no-extra-boolean-cast": "error",
"no-fallthrough": "error",
"no-func-assign": "error",
"no-global-assign": "error",
"no-import-assign": "error",
"no-invalid-regexp": "error",
"no-irregular-whitespace": "error",
"no-loss-of-precision": "error",
"no-misleading-character-class": "error",
"no-new-native-nonconstructor": "error",
"no-nonoctal-decimal-escape": "error",
"no-obj-calls": "error",
"no-prototype-builtins": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-self-assign": "error",
"no-setter-return": "error",
"no-shadow-restricted-names": "error",
"no-sparse-arrays": "error",
"no-this-before-super": "error",
"no-unassigned-vars": "error",
"no-unreachable": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
"no-unsafe-optional-chaining": "error",
"no-unused-labels": "error",
"no-unused-private-class-members": "error",
"no-unused-vars": "error",
"no-useless-backreference": "error",
"no-useless-catch": "error",
"no-useless-escape": "error",
"no-with": "error",
"preserve-caught-error": "error",
"require-yield": "error",
"use-isnan": "error",
"valid-typeof": "error",
"no-array-constructor": "error",
"no-unused-expressions": "error",
"react/display-name": "error",
"react/jsx-key": "error",
"react/jsx-no-comment-textnodes": "error",
"react/jsx-no-duplicate-props": "error",
"react/jsx-no-undef": "error",
"react/no-children-prop": "error",
"react/no-danger-with-children": "error",
"react/no-direct-mutation-state": "error",
"react/no-find-dom-node": "error",
"react/no-is-mounted": "error",
"react/no-render-return-value": "error",
"react/no-string-refs": "error",
"react/no-unescaped-entities": "error",
"react/no-unknown-property": "error",
"react/rules-of-hooks": "error",
"react/exhaustive-deps": "warn",
"react/only-export-components": [
"warn",
{
"allowConstantExport": true
}
],
"typescript/ban-ts-comment": "error",
"typescript/no-duplicate-enum-values": "error",
"typescript/no-empty-object-type": "error",
"typescript/no-explicit-any": "error",
"typescript/no-extra-non-null-assertion": "error",
"typescript/no-misused-new": "error",
"typescript/no-namespace": "error",
"typescript/no-non-null-asserted-optional-chain": "error",
"typescript/no-require-imports": "error",
"typescript/no-this-alias": "error",
"typescript/no-unnecessary-type-constraint": "error",
"typescript/no-unsafe-declaration-merging": "error",
"typescript/no-unsafe-function-type": "error",
"typescript/no-wrapper-object-types": "error",
"typescript/prefer-as-const": "error",
"typescript/prefer-namespace-keyword": "error",
"typescript/triple-slash-reference": "error"
},
"overrides": [
{
"files": [],
"rules": {
"constructor-super": "off",
"getter-return": "off",
"no-class-assign": "off",
"no-const-assign": "off",
"no-dupe-class-members": "off",
"no-dupe-keys": "off",
"no-func-assign": "off",
"no-import-assign": "off",
"no-new-native-nonconstructor": "off",
"no-obj-calls": "off",
"no-redeclare": "off",
"no-setter-return": "off",
"no-this-before-super": "off",
"no-unreachable": "off",
"no-unsafe-negation": "off",
"no-var": "error",
"no-with": "off",
"prefer-const": "error",
"prefer-rest-params": "error",
"prefer-spread": "error"
}
},
{
"files": ["**/service-worker.js"],
"env": {
"serviceworker": true
}
}
]
}
2 changes: 0 additions & 2 deletions ui/.prettierignore

This file was deleted.

4 changes: 4 additions & 0 deletions ui/knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://unpkg.com/knip@6/schema.json",
"tags": ["-lintignore"]
}
Loading