Update dependencies and formatting fixes with Biome

This commit is contained in:
Lewin Kelly 2024-04-16 13:01:52 +01:00
parent acc08d999e
commit b8b4ab51b9
15 changed files with 1293 additions and 668 deletions

View File

@ -1,12 +0,0 @@
{
"semi": false,
"arrowParens": "avoid",
"printWidth": 80,
"tabWidth": 4,
"useTabs": true,
"bracketSameLine": true,
"htmlWhitespaceSensitivity": "ignore",
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}

26
biome.json Normal file
View File

@ -0,0 +1,26 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"formatter": {
"indentWidth": 4
},
"files": {
"ignore": ["*.svelte"]
},
"linter": {
"rules": {
"nursery": {
"all": true,
"noUndeclaredDependencies": "off",
"noNodejsModules": "off",
"noConsole": "off"
}
}
},
"javascript": {
"formatter": {
"semicolons": "asNeeded",
"trailingComma": "es5",
"arrowParentheses": "asNeeded"
}
}
}

View File

@ -1,6 +1,6 @@
[build.environment]
NODE_VERSION = "20.7.0"
NPM_VERSION = "10.1.0"
NODE_VERSION = "21.7.3"
NPM_VERSION = "10.5.0"
[build]
command = "npm run build"

View File

@ -5,37 +5,35 @@
"scripts": {
"dev": "vite dev",
"build": "vite build",
"format": "biome format src --write",
"lint": "biome lint src",
"preview": "vite preview",
"buildview": "vite build && vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check .",
"format": "prettier --plugin-search-dir . --write ."
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
},
"devDependencies": {
"@sveltejs/adapter-static": "^2.0.3",
"@sveltejs/kit": "^1.25.1",
"@types/marked": "^5.0.2",
"@types/nprogress": "^0.2.1",
"@unocss/extractor-svelte": "^0.56.4",
"@unocss/transformer-directives": "^0.56.4",
"marked": "^9.0.3",
"@biomejs/biome": "^1.7.0",
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "^2.5.6",
"@types/marked": "^6.0.0",
"@types/nprogress": "^0.2.3",
"@unocss/extractor-svelte": "^0.59.3",
"@unocss/transformer-directives": "^0.59.3",
"marked": "^12.0.1",
"mdsvex": "^0.11.0",
"prettier": "^3.0.3",
"prettier-plugin-svelte": "^3.0.3",
"prettier-plugin-tailwindcss": "^0.5.4",
"stylus": "^0.60.0",
"svelte": "^4.2.1",
"svelte-check": "^3.5.2",
"svelte-preprocess": "^5.0.4",
"sveltekit-autoimport": "^1.7.1",
"stylus": "^0.63.0",
"svelte": "^4.2.14",
"svelte-check": "^3.6.9",
"svelte-preprocess": "^5.1.3",
"sveltekit-autoimport": "^1.8.0",
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"unocss": "^0.56.4",
"vite": "^4.5.2"
"typescript": "^5.4.5",
"unocss": "^0.59.3",
"vite": "^5.2.9"
},
"dependencies": {
"nprogress": "^0.2.0"
},
"packageManager": "pnpm@8.7.4"
"packageManager": "pnpm@9.0.0"
}

View File

@ -1,10 +1,10 @@
---
name: Mercury 2
website: https://banland.xyz
name: Mercury 2
website: https://mercury2.com
logo: mercury.svg
clients:
- 2013
overview: |
Mercury 2 is the successor to the original Mercury 1 from 2021. Provides an enhanced experience in comparison to its predecessor whilst using the classic 2013 client. Currently in private beta.
author: taskmanager
---
---

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
<footer class="mt-a text-#8c8b8a @light:text-#4c4b4a p-5 pt-12 text-center">
<a href="/" class="pe-1.5">Revival Archive</a>
2023
2024
<nav class="mb-4 mt-5 text-white">
<a href="/about">About</a>
|

View File

@ -1,9 +1,16 @@
// Builds on the Svelte fade function to allow for easier delays for
// Builds on the Svelte fade function to allow for easier delays for
// staggered animations, taken directly from Mercury
import { fade } from "svelte/transition"
import { fade, type FadeParams } from "svelte/transition"
export default (node: HTMLElement, props: any = { duration: 300 }) => {
export default (
node: HTMLElement,
props: FadeParams & {
num?: number
total?: number
max?: number
} = { duration: 300 }
) => {
if (props.num && props.total)
props.delay = (props.num * 150) / Math.min(props.total, props?.max || 6)
return fade(node, props)

View File

@ -9,5 +9,5 @@ export default (date: Date, updated = false) => {
hour: "numeric",
minute: "numeric",
})
return d == "Invalid Date" ? `Not yet ${text}` : `${Text} ${d}`
return d === "Invalid Date" ? `Not yet ${text}` : `${Text} ${d}`
}

View File

@ -6,7 +6,7 @@
# Revival Archive
### a [Mercury](https://banland.xyz) project
### a [Mercury](https://mercury2.com) project
<div in:fade|global class="content">
Welcome to the Revival Archive, a website dedicated to keeping track of active/defunct old Roblox private servers.

View File

@ -1,18 +1,17 @@
import type { PostMetadata } from "$lib/types"
export async function load() {
const allPostFiles = import.meta.glob("../../../pages/blog/*.md")
const allPostFiles = import.meta.glob("../../../pages/blog/*.md")
export const load = async () => ({
posts: await Promise.all(
Object.keys(allPostFiles).map(async path => {
const { metadata } = (await allPostFiles[path]()) as {
metadata: PostMetadata
}
return {
posts: Promise.all(
Object.keys(allPostFiles).map(async path => {
const { metadata } = (await allPostFiles[path]()) as any
return {
...(metadata as PostMetadata),
path: path.match(/(\w+)\.md/)?.[1],
}
})
),
}
}
return {
...metadata,
path: path.match(/(\w+)\.md/)?.[1],
}
})
),
})

View File

@ -3,24 +3,26 @@ import { load as loadBlog } from "../../blog/+page"
import type { PostMetadata } from "$lib/types"
export async function load({ params }) {
let data: any
let data: {
metadata: PostMetadata
default: string
}
try {
data = await import(`../../../../pages/blog/${params.post}.md`)
} catch (e) {
throw error(404, "Post not found")
error(404, "Post not found")
return
}
const posts = await (await loadBlog()).posts
// remove the current post from the list
posts.splice(
posts.findIndex(post => post.title == data.metadata.title),
1
)
const { posts } = await loadBlog()
return {
...(data.metadata as PostMetadata),
...data.metadata,
content: data.default,
posts,
// remove the current post from the list
posts: posts.toSpliced(
posts.findIndex(post => post.title === data.metadata.title),
1
),
}
}

View File

@ -6,10 +6,12 @@ export async function load() {
return {
reviews: Promise.all(
Object.keys(allPostFiles).map(async path => {
const { metadata } = (await allPostFiles[path]()) as any
const { metadata } = (await allPostFiles[path]()) as {
metadata: RevivalMetadata
}
return {
...(metadata as RevivalMetadata),
...metadata,
path: path.match(/(\w+)\.md/)?.[1],
}
})

View File

@ -3,27 +3,32 @@ import { load as loadParent } from "../../revivals/+page"
import type { RevivalMetadata } from "$lib/types"
export async function load({ params }) {
let data: any
let data: {
metadata: RevivalMetadata
default: string
}
try {
data = await import(`../../../../pages/revivals/${params.revival}.md`)
} catch (e) {
throw error(404, "Revival not found")
error(404, "Revival not found")
return
}
let revivals = await (await loadParent()).revivals
const { revivals } = await loadParent()
// remove the current revival from the list
revivals.splice(
revivals.findIndex(revival => revival.name == data.metadata.name),
1
)
// remove revivals that don't have a rating
revivals = revivals.filter(revival => revival.rating)
return {
...(data.metadata as RevivalMetadata),
...data.metadata,
content: data.default,
revivals,
revivals: revivals
.toSpliced(
revivals.findIndex(
revival => revival.name === data.metadata.name
),
1
)
// remove revivals that don't have a rating
.filter(revival => revival.rating),
}
}

View File

@ -1,18 +1,18 @@
import type { RevivalMetadata } from "$lib/types"
export async function load() {
const allPostFiles = import.meta.glob("../../../pages/revivals/*.md")
const allPostFiles = import.meta.glob("../../../pages/revivals/*.md")
return {
revivals: Promise.all(
Object.keys(allPostFiles).map(async path => {
const { metadata } = (await allPostFiles[path]()) as any
export const load = async () => ({
revivals: await Promise.all(
Object.keys(allPostFiles).map(async path => {
const { metadata } = (await allPostFiles[path]()) as {
metadata: RevivalMetadata
}
return {
...(metadata as RevivalMetadata),
path: path.match(/(\w+)\.md/)?.[1],
}
})
),
}
}
return {
...metadata,
path: path.match(/(\w+)\.md/)?.[1],
}
})
),
})