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.*
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
|
|
||||||
generated/prisma
|
|
||||||
dev.db
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
src/content/**/*
|
|
||||||
*.md
|
|
||||||
*.html
|
|
||||||
.svelte-kit
|
|
||||||
build
|
|
||||||
drafts
|
|
||||||
generated
|
|
||||||
node_modules
|
|
||||||
10
package.json
10
package.json
|
|
@ -8,26 +8,22 @@
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"check": "svelte-check --tsconfig ./tsconfig.json",
|
"check": "svelte-check --tsconfig ./tsconfig.json",
|
||||||
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
||||||
"lint": "prettier --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
|
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
|
||||||
"format": "prettier --config ./prettierrc --write --plugin-search-dir=. .",
|
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. .",
|
||||||
"test": "vitest"
|
"test": "vitest"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/kit": "^2.51.0",
|
"@sveltejs/kit": "^2.51.0",
|
||||||
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
||||||
"@types/better-sqlite3": "^7.6.13",
|
|
||||||
"@types/leaflet": "^1.9.15",
|
"@types/leaflet": "^1.9.15",
|
||||||
"@types/node": "^25.3.2",
|
|
||||||
"@types/sanitize-html": "^2.13.0",
|
"@types/sanitize-html": "^2.13.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.55.0",
|
"@typescript-eslint/eslint-plugin": "^8.55.0",
|
||||||
"@typescript-eslint/parser": "^8.55.0",
|
"@typescript-eslint/parser": "^8.55.0",
|
||||||
"dotenv": "^17.3.1",
|
|
||||||
"eslint": "^9.17.0",
|
"eslint": "^9.17.0",
|
||||||
"eslint-config-prettier": "^10.1.1",
|
"eslint-config-prettier": "^10.1.1",
|
||||||
"eslint-plugin-svelte": "^3.15.0",
|
"eslint-plugin-svelte": "^3.15.0",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"prettier-plugin-svelte": "^3.3.2",
|
"prettier-plugin-svelte": "^3.3.2",
|
||||||
"prisma": "^7.4.2",
|
|
||||||
"svelte": "^5.50.3",
|
"svelte": "^5.50.3",
|
||||||
"svelte-check": "^4.3.6",
|
"svelte-check": "^4.3.6",
|
||||||
"svelte-preprocess": "^6.0.0",
|
"svelte-preprocess": "^6.0.0",
|
||||||
|
|
@ -38,8 +34,6 @@
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@prisma/adapter-better-sqlite3": "^7.4.2",
|
|
||||||
"@prisma/client": "^7.4.2",
|
|
||||||
"@sveltejs/adapter-node": "^5.5.3",
|
"@sveltejs/adapter-node": "^5.5.3",
|
||||||
"@types/js-yaml": "^4.0.9",
|
"@types/js-yaml": "^4.0.9",
|
||||||
"date-fns": "^4.1.0",
|
"date-fns": "^4.1.0",
|
||||||
|
|
|
||||||
3423
pnpm-lock.yaml
3423
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())
|
|
||||||
}
|
|
||||||
9
src/app.d.ts
vendored
9
src/app.d.ts
vendored
|
|
@ -1,15 +1,10 @@
|
||||||
/// <reference types="@sveltejs/kit" />
|
/// <reference types="@sveltejs/kit" />
|
||||||
import type { PrismaClient } from '../generated/prisma/client.ts';
|
|
||||||
|
|
||||||
// See https://kit.svelte.dev/docs/types#app
|
// See https://kit.svelte.dev/docs/types#app
|
||||||
// for information about these interfaces
|
// for information about these interfaces
|
||||||
declare global {
|
declare namespace App {
|
||||||
namespace App {
|
// interface Locals {}
|
||||||
interface Locals {
|
|
||||||
prisma: PrismaClient;
|
|
||||||
}
|
|
||||||
// interface Platform {}
|
// interface Platform {}
|
||||||
// interface Session {}
|
// interface Session {}
|
||||||
// interface Stuff {}
|
// 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 adapter from '@sveltejs/adapter-node';
|
||||||
import preprocess from "svelte-preprocess";
|
import preprocess from 'svelte-preprocess';
|
||||||
|
|
||||||
/** @type {import('@sveltejs/kit').Config} */
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
const config = {
|
const config = {
|
||||||
extensions: [".svelte", ".md"],
|
extensions: ['.svelte', '.md'],
|
||||||
// Consult https://github.com/sveltejs/svelte-preprocess
|
// Consult https://github.com/sveltejs/svelte-preprocess
|
||||||
// for more information about preprocessors
|
// for more information about preprocessors
|
||||||
preprocess: [preprocess()],
|
preprocess: [preprocess()],
|
||||||
|
|
||||||
kit: {
|
kit: {
|
||||||
adapter: adapter({ split: false }),
|
adapter: adapter({ split: false }),
|
||||||
|
|
||||||
env: {
|
env: {
|
||||||
publicPrefix: "PUBLIC_",
|
publicPrefix: 'PUBLIC_'
|
||||||
privatePrefix: "PRIVATE_",
|
}
|
||||||
},
|
}
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,13 @@
|
||||||
import { sveltekit } from "@sveltejs/kit/vite";
|
import { sveltekit } from '@sveltejs/kit/vite';
|
||||||
|
|
||||||
/** @type {import('vite').UserConfig} */
|
/** @type {import('vite').UserConfig} */
|
||||||
const config = {
|
const config = {
|
||||||
plugins: [sveltekit()],
|
plugins: [sveltekit()],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
$lib: "/src/lib",
|
$lib: '/src/lib',
|
||||||
$srcPrisma: "/src/prisma",
|
}
|
||||||
},
|
}
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|
@ -3,12 +3,13 @@ export default {
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
$lib: '/src/lib',
|
$lib: '/src/lib',
|
||||||
$srcPrisma: '/src/prisma',
|
}
|
||||||
},
|
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
deps: {
|
deps: {
|
||||||
inline: ['date-fns'],
|
inline: [
|
||||||
},
|
"date-fns"
|
||||||
},
|
]
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -19,5 +19,4 @@ COPY --from=builder /app/node_modules node_modules/
|
||||||
COPY package.json .
|
COPY package.json .
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
VOLUME /data
|
|
||||||
CMD [ "node", "build" ]
|
CMD [ "node", "build" ]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue