Compare commits
No commits in common. "9882a965eb8d9e9159f5a83aec669f972a5e9281" and "9730ba356b1526da13aeff19ea2b5da3a0fa3c5b" have entirely different histories.
9882a965eb
...
9730ba356b
16 changed files with 3719 additions and 6329 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -9,6 +9,3 @@ node_modules
|
|||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
generated/prisma
|
||||
dev.db
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
src/content/**/*
|
||||
*.md
|
||||
*.html
|
||||
.svelte-kit
|
||||
build
|
||||
drafts
|
||||
generated
|
||||
node_modules
|
||||
124
package.json
124
package.json
|
|
@ -1,67 +1,61 @@
|
|||
{
|
||||
"name": "thomaswilson-sveltekit",
|
||||
"license": "UNLICENSED",
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"check": "svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"lint": "prettier --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
|
||||
"format": "prettier --config ./prettierrc --write --plugin-search-dir=. .",
|
||||
"test": "vitest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/kit": "^2.51.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
||||
"@types/better-sqlite3": "^7.6.13",
|
||||
"@types/leaflet": "^1.9.15",
|
||||
"@types/node": "^25.3.2",
|
||||
"@types/sanitize-html": "^2.13.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.55.0",
|
||||
"@typescript-eslint/parser": "^8.55.0",
|
||||
"dotenv": "^17.3.1",
|
||||
"eslint": "^9.17.0",
|
||||
"eslint-config-prettier": "^10.1.1",
|
||||
"eslint-plugin-svelte": "^3.15.0",
|
||||
"prettier": "^3.4.2",
|
||||
"prettier-plugin-svelte": "^3.3.2",
|
||||
"prisma": "^7.4.2",
|
||||
"svelte": "^5.50.3",
|
||||
"svelte-check": "^4.3.6",
|
||||
"svelte-preprocess": "^6.0.0",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.7.2",
|
||||
"vite": "^6.0.7",
|
||||
"vitest": "^3.0.8"
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@prisma/adapter-better-sqlite3": "^7.4.2",
|
||||
"@prisma/client": "^7.4.2",
|
||||
"@sveltejs/adapter-node": "^5.5.3",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"date-fns": "^4.1.0",
|
||||
"feed": "^4.2.2",
|
||||
"js-yaml": "^4.1.0",
|
||||
"just-shuffle": "^4.2.0",
|
||||
"leaflet": "^1.9.4",
|
||||
"node-fetch": "^3.3.2",
|
||||
"rehype-stringify": "^10.0.1",
|
||||
"remark": "^15.0.1",
|
||||
"remark-frontmatter": "^5.0.0",
|
||||
"remark-gfm": "^4.0.0",
|
||||
"remark-parse": "^11.0.0",
|
||||
"remark-rehype": "^11.1.1",
|
||||
"remark-stringify": "^11.0.0",
|
||||
"sanitize-html": "^2.14.0",
|
||||
"sass": "^1.85.1",
|
||||
"strip-markdown": "^6.0.0",
|
||||
"unified": "^11.0.5",
|
||||
"zod": "^3.24.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.0.0"
|
||||
}
|
||||
"name": "thomaswilson-sveltekit",
|
||||
"license": "UNLICENSED",
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"check": "svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
|
||||
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. .",
|
||||
"test": "vitest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/kit": "^2.51.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
||||
"@types/leaflet": "^1.9.15",
|
||||
"@types/sanitize-html": "^2.13.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.55.0",
|
||||
"@typescript-eslint/parser": "^8.55.0",
|
||||
"eslint": "^9.17.0",
|
||||
"eslint-config-prettier": "^10.1.1",
|
||||
"eslint-plugin-svelte": "^3.15.0",
|
||||
"prettier": "^3.4.2",
|
||||
"prettier-plugin-svelte": "^3.3.2",
|
||||
"svelte": "^5.50.3",
|
||||
"svelte-check": "^4.3.6",
|
||||
"svelte-preprocess": "^6.0.0",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.7.2",
|
||||
"vite": "^6.0.7",
|
||||
"vitest": "^3.0.8"
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@sveltejs/adapter-node": "^5.5.3",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"date-fns": "^4.1.0",
|
||||
"feed": "^4.2.2",
|
||||
"js-yaml": "^4.1.0",
|
||||
"just-shuffle": "^4.2.0",
|
||||
"leaflet": "^1.9.4",
|
||||
"node-fetch": "^3.3.2",
|
||||
"rehype-stringify": "^10.0.1",
|
||||
"remark": "^15.0.1",
|
||||
"remark-frontmatter": "^5.0.0",
|
||||
"remark-gfm": "^4.0.0",
|
||||
"remark-parse": "^11.0.0",
|
||||
"remark-rehype": "^11.1.1",
|
||||
"remark-stringify": "^11.0.0",
|
||||
"sanitize-html": "^2.14.0",
|
||||
"sass": "^1.85.1",
|
||||
"strip-markdown": "^6.0.0",
|
||||
"unified": "^11.0.5",
|
||||
"zod": "^3.24.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
9763
pnpm-lock.yaml
9763
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +0,0 @@
|
|||
onlyBuiltDependencies:
|
||||
- '@prisma/engines'
|
||||
- better-sqlite3
|
||||
- prisma
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// This file was generated by Prisma, and assumes you have installed the following:
|
||||
// npm install --save-dev prisma dotenv
|
||||
import "dotenv/config";
|
||||
import { defineConfig } from "prisma/config";
|
||||
|
||||
export default defineConfig({
|
||||
schema: "./prisma/schema.prisma",
|
||||
migrations: {
|
||||
path: "prisma/migrations",
|
||||
},
|
||||
datasource: {
|
||||
url: process.env["DATABASE_URL"],
|
||||
},
|
||||
});
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
generator client {
|
||||
provider = "prisma-client"
|
||||
output = "../generated/prisma"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
}
|
||||
|
||||
model PhotoPost {
|
||||
id Int @id @default(autoincrement())
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
15
src/app.d.ts
vendored
15
src/app.d.ts
vendored
|
|
@ -1,15 +1,10 @@
|
|||
/// <reference types="@sveltejs/kit" />
|
||||
import type { PrismaClient } from '../generated/prisma/client.ts';
|
||||
|
||||
// See https://kit.svelte.dev/docs/types#app
|
||||
// for information about these interfaces
|
||||
declare global {
|
||||
namespace App {
|
||||
interface Locals {
|
||||
prisma: PrismaClient;
|
||||
}
|
||||
// interface Platform {}
|
||||
// interface Session {}
|
||||
// interface Stuff {}
|
||||
}
|
||||
declare namespace App {
|
||||
// interface Locals {}
|
||||
// interface Platform {}
|
||||
// interface Session {}
|
||||
// interface Stuff {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
import type { Handle } from '@sveltejs/kit';
|
||||
import { PrismaClientFactory } from './prisma/PrismaClientFactory.js';
|
||||
|
||||
export const handle: Handle = async ({ event, resolve }) => {
|
||||
const prismaClient = PrismaClientFactory.fromEnv().createClient();
|
||||
event.locals.prisma = prismaClient;
|
||||
const response = await resolve(event);
|
||||
return response;
|
||||
};
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
import { notStrictEqual } from "node:assert";
|
||||
import { PrismaBetterSqlite3 } from "@prisma/adapter-better-sqlite3";
|
||||
import { PrismaClient } from "../../generated/prisma/client.js";
|
||||
import { env } from "$env/dynamic/private";
|
||||
|
||||
export class PrismaClientFactory {
|
||||
private constructor(private readonly databaseUrl: string) {}
|
||||
public static fromEnv(): PrismaClientFactory {
|
||||
const value = env.PRIVATE_DATABASE_URL ?? "";
|
||||
notStrictEqual(value, "", `"env.PRIVATE_DATABASE_URL" must be defined`);
|
||||
|
||||
return new PrismaClientFactory(value);
|
||||
}
|
||||
|
||||
createClient(): PrismaClient {
|
||||
const adapter = new PrismaBetterSqlite3({ url: this.databaseUrl });
|
||||
const prisma = new PrismaClient({ adapter });
|
||||
return prisma;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
import type { PageServerLoad } from './$types.js';
|
||||
|
||||
export const load: PageServerLoad = async ({ locals }) => {
|
||||
const allPosts = await locals.prisma.photoPost.findMany({
|
||||
orderBy: { createdAt: 'asc' },
|
||||
});
|
||||
return {
|
||||
allPosts,
|
||||
};
|
||||
};
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<script lang="ts">
|
||||
import type { PageProps } from "./$types.js";
|
||||
|
||||
const { data }: PageProps = $props();
|
||||
</script>
|
||||
|
||||
<h1>Photo Posts</h1>
|
||||
<p>You have {data.allPosts.length} Photo Posts</p>
|
||||
|
|
@ -1,21 +1,19 @@
|
|||
import adapter from "@sveltejs/adapter-node";
|
||||
import preprocess from "svelte-preprocess";
|
||||
import adapter from '@sveltejs/adapter-node';
|
||||
import preprocess from 'svelte-preprocess';
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
extensions: [".svelte", ".md"],
|
||||
// Consult https://github.com/sveltejs/svelte-preprocess
|
||||
// for more information about preprocessors
|
||||
preprocess: [preprocess()],
|
||||
extensions: ['.svelte', '.md'],
|
||||
// Consult https://github.com/sveltejs/svelte-preprocess
|
||||
// for more information about preprocessors
|
||||
preprocess: [preprocess()],
|
||||
|
||||
kit: {
|
||||
adapter: adapter({ split: false }),
|
||||
|
||||
env: {
|
||||
publicPrefix: "PUBLIC_",
|
||||
privatePrefix: "PRIVATE_",
|
||||
},
|
||||
},
|
||||
kit: {
|
||||
adapter: adapter({ split: false }),
|
||||
env: {
|
||||
publicPrefix: 'PUBLIC_'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
import { sveltekit } from "@sveltejs/kit/vite";
|
||||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
|
||||
/** @type {import('vite').UserConfig} */
|
||||
const config = {
|
||||
plugins: [sveltekit()],
|
||||
resolve: {
|
||||
alias: {
|
||||
$lib: "/src/lib",
|
||||
$srcPrisma: "/src/prisma",
|
||||
},
|
||||
},
|
||||
plugins: [sveltekit()],
|
||||
resolve: {
|
||||
alias: {
|
||||
$lib: '/src/lib',
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
|
@ -3,12 +3,13 @@ export default {
|
|||
resolve: {
|
||||
alias: {
|
||||
$lib: '/src/lib',
|
||||
$srcPrisma: '/src/prisma',
|
||||
},
|
||||
}
|
||||
},
|
||||
test: {
|
||||
deps: {
|
||||
inline: ['date-fns'],
|
||||
},
|
||||
},
|
||||
};
|
||||
inline: [
|
||||
"date-fns"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -19,5 +19,4 @@ COPY --from=builder /app/node_modules node_modules/
|
|||
COPY package.json .
|
||||
EXPOSE 3000
|
||||
ENV NODE_ENV=production
|
||||
VOLUME /data
|
||||
CMD [ "node", "build" ]
|
||||
|
|
|
|||
Loading…
Reference in a new issue