Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev to stable #167

Draft
wants to merge 16 commits into
base: stable
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## SERVER:
# Set log verbosity [3]:integer
# (0=none <- 1=error <- 2=warn <- 3=info <- 4=debug)
#LOGLEVEL=3

# Port for the server [3000]:integer
#PORT=3000
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ updates:
schedule:
interval: weekly
labels:
- dependency:gha
- dependency:gha
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
container:
if: ${{ github.repository_owner == 'jspaste' && inputs.image-action != 'none' }}
name: Build container image
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io

Expand All @@ -34,7 +34,7 @@ jobs:

steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

Expand Down Expand Up @@ -66,12 +66,12 @@ jobs:
echo "tags=${TAGS[*]}" >>"$GITHUB_OUTPUT"

- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false

- name: Setup production dependencies
run: bun install --frozen-lockfile --production
- name: Setup dependencies
run: bun install --frozen-lockfile

- name: Run build:server
run: bun run build:server
Expand Down Expand Up @@ -106,8 +106,8 @@ jobs:

- if: ${{ inputs.image-action == 'build-release' }}
name: Attest image
uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3
uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1.4.4
with:
subject-name: ${{ env.REGISTRY }}/${{ steps.build-image.outputs.image }}
subject-name: "${{ env.REGISTRY }}/${{ steps.build-image.outputs.image }}"
subject-digest: ${{ steps.push-image.outputs.digest }}
push-to-registry: false
push-to-registry: false
87 changes: 0 additions & 87 deletions .github/workflows/security.yml

This file was deleted.

17 changes: 7 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,28 @@ permissions:
contents: read

jobs:
lint:
test:
name: Test
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: Setup Bun
uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2.0.1

- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false

- name: Setup production dependencies
run: bun install --frozen-lockfile --production
- name: Setup dependencies
run: bun install --frozen-lockfile

- name: Run build:server
run: bun run build:server

- name: Setup development dependencies
run: bun install --frozen-lockfile

- name: Run lint
run: bun run lint
run: bun run lint
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM docker.io/oven/bun:1-distroless
WORKDIR /frontend/

COPY --chown=nonroot ./dist ./
COPY --chown=nonroot ./dist/ ./
COPY --chown=nonroot ./LICENSE ./

LABEL org.opencontainers.image.url="https://jspaste.eu" \
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Frontend

This repository contains the frontend code for [JSPaste](https://jspaste.eu).

## Supported Browsers

In case you are using an older browser than the ones listed, please do not open issues about it.

- Chromium >= 111
- Firefox >= 121
- Safari >= 16

*Last checked commit
[`5982621`](https://github.com/JSPaste/Frontend/commit/59826216a47e08e0f150486b6cf983ba7cd8fa57) on 27 October 2024*
5 changes: 3 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"files": {
"ignore": ["./dist/**", "*.spec.ts"],
"ignoreUnknown": true
Expand All @@ -26,7 +26,8 @@
"noStaticOnlyClass": "off"
},
"suspicious": {
"noAssignInExpressions": "off"
"noAssignInExpressions": "off",
"noConsoleLog": "error"
}
}
},
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion bunfig.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ auto = "disable"

[run]
bun = true
silent = true
silent = true
66 changes: 35 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
"license": "EUPL-1.2",
"type": "module",
"scripts": {
"analyse:bundle": "bun run analyze:bundle",
"analyze:bundle": "rm -rf ./dist/ && bun vite build && mv ./dist/client/bundle.html ./dist/client.bundle.html && mv ./dist/server/bundle.html ./dist/server.bundle.html",
"build": "bun run build:server",
"build:server": "rm -rf ./dist/ && bun --bun vite build && bun run script:standalone && bun run script:minify && bun run script:compress",
"build:server:safe": "rm -rf ./dist/ && bun --bun vite build && bun run script:standalone",
"build:server": "rm -rf ./dist/ && bun vite build && bun run script:standalone && bun run script:compress",
"clean:git:all": "bun run clean:git:untracked && bun run clean:git:gc && bun run clean:git:hooks",
"clean:git:all:force": "bun run clean:git:untracked:force && bun run clean:git:gc && bun run clean:git:hooks",
"clean:git:gc": "git gc --aggressive --prune",
"clean:git:hooks": "rm -rf ./.git/hooks/ && bun install -f",
"clean:git:untracked": "git clean -d -x -i",
"clean:git:untracked:force": "git clean -d -x -f",
"dev": "bun run start:dev",
"fix": "bun run fix:biome; bun run fix:package",
"fix:biome": "bun biome check --write",
Expand All @@ -16,60 +23,57 @@
"lint:biome": "bun biome lint",
"lint:tsc": "bun tsc --noEmit",
"script:compress": "bun run ./scripts/compress.ts",
"script:minify": "bun run ./scripts/minify.ts",
"script:standalone": "bun run ./scripts/standalone.ts",
"start": "bun run start:server",
"start:dev": "bun --bun vite",
"start:dev": "bun vite",
"start:rebuild": "bun run build:server && bun run start:server",
"start:rebuild:safe": "bun run build:server:safe && bun run start:server",
"start:server": "NODE_ENV=production bun run --cwd=./dist/ ./server/index.js"
},
"dependencies": {
"@codemirror/autocomplete": "~6.18.1",
"@codemirror/commands": "~6.7.0",
"@codemirror/lang-angular": "~0.1.3",
"@codemirror/autocomplete": "~6.18.3",
"@codemirror/commands": "~6.7.1",
"@codemirror/lang-cpp": "~6.0.2",
"@codemirror/lang-css": "~6.3.0",
"@codemirror/lang-go": "~6.0.1",
"@codemirror/lang-html": "~6.4.9",
"@codemirror/lang-java": "~6.0.1",
"@codemirror/lang-javascript": "~6.2.2",
"@codemirror/lang-json": "~6.0.1",
"@codemirror/lang-liquid": "~6.2.1",
"@codemirror/lang-markdown": "~6.3.0",
"@codemirror/lang-markdown": "~6.3.1",
"@codemirror/lang-php": "~6.0.1",
"@codemirror/lang-python": "~6.1.6",
"@codemirror/lang-rust": "~6.0.1",
"@codemirror/lang-sass": "~6.0.2",
"@codemirror/lang-vue": "~0.1.3",
"@codemirror/lang-xml": "~6.1.0",
"@codemirror/lang-yaml": "~6.1.1",
"@codemirror/language": "~6.10.3",
"@codemirror/state": "~6.4.1",
"@codemirror/view": "~6.34.1",
"@codemirror/view": "~6.35.0",
"@solid-primitives/media": "~2.2.9",
"@solid-primitives/scheduled": "~1.4.3",
"@solid-primitives/scheduled": "~1.4.4",
"@solid-primitives/storage": "~4.2.1",
"@tabler/icons-solidjs": "~3.19.0",
"@types/bun": "~1.1.10",
"@uiw/codemirror-extensions-hyper-link": "~4.23.5",
"@uiw/codemirror-themes": "~4.23.5",
"autoprefixer": "~10.4.20",
"chalk": "~5.3.0",
"daisyui": "~4.12.12",
"loglevel": "~1.9.2",
"postcss": "~8.4.47",
"solid-js": "~1.9.2",
"tailwindcss": "~3.4.13",
"typescript": "~5.6.2",
"vike": "~0.4.198",
"@tabler/icons-solidjs": "~3.22.0",
"@tailwindcss/vite": "4.0.0-beta.2",
"@uiw/codemirror-extensions-hyper-link": "~4.23.6",
"@uiw/codemirror-themes": "~4.23.6",
"daisyui": "5.0.0-alpha.39",
"env-var": "~7.5.0",
"hono": "~4.6.11",
"solid-js": "~1.9.3",
"tailwindcss": "4.0.0-beta.2",
"vike": "~0.4.204",
"vike-solid": "~0.7.6",
"vite": "~5.4.8"
"vite": "~5.4.11"
},
"devDependencies": {
"@biomejs/biome": "~1.9.3",
"lefthook": "~1.7.18",
"sort-package-json": "~2.10.1"
"@biomejs/biome": "~1.9.4",
"@types/bun": "^1.1.13",
"browserslist": "^4.24.2",
"lefthook": "~1.8.4",
"rollup-plugin-visualizer": "~5.12.0",
"sort-package-json": "~2.11.0"
},
"peerDependencies": {
"typescript": "5.5.4"
},
"trustedDependencies": [
"@biomejs/biome",
Expand Down
6 changes: 0 additions & 6 deletions postcss.config.js

This file was deleted.

14 changes: 4 additions & 10 deletions scripts/compress.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { brotliCompressSync, gzipSync } from 'node:zlib';
import { findFiles, writeFile } from './utils.ts';
import { findFiles, writeFile } from '@x-util/fs.ts';

const rootClientDirectory = './dist/client/';
const relativeClientFiles = await findFiles(rootClientDirectory, undefined, /\.(js|mjs|cjs|json|css|html|wasm|svg)$/);
Expand All @@ -9,15 +9,9 @@ await Promise.all(
rootClientFiles.map(async (file) => {
const fileContent = await Bun.file(file).arrayBuffer();

console.debug('[COMPRESS] Compressing:', file);
console.info('[BUILD] Compressing:', file);

await writeFile(
`${file}.gz`,
gzipSync(fileContent, {
level: 9
}).buffer
);

await writeFile(`${file}.br`, brotliCompressSync(fileContent).buffer);
await writeFile(`${file}.gz`, gzipSync(fileContent));
await writeFile(`${file}.br`, brotliCompressSync(fileContent));
})
);
Loading