@thetinkerinc/sprout 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # Sprout
2
+
3
+ ## Just add water
4
+
5
+ A collection of utilities for building SvelteKit apps
@@ -0,0 +1,4 @@
1
+ import * as k from 'kysely';
2
+ export interface DB {
3
+ }
4
+ export declare function getDb(): Promise<k.Kysely<DB>>;
@@ -0,0 +1,55 @@
1
+ import * as k from 'kysely';
2
+ import { Pool, types } from 'pg';
3
+ export async function getDb() {
4
+ types.setTypeParser(types.builtins.NUMERIC, (v) => Number(v));
5
+ types.setTypeParser(types.builtins.INT8, (v) => Number(v));
6
+ const connectionString = await getConnectionString();
7
+ return new k.Kysely({
8
+ dialect: new k.PostgresDialect({
9
+ pool: new Pool({
10
+ connectionString
11
+ })
12
+ })
13
+ });
14
+ }
15
+ async function getConnectionString() {
16
+ let connectionString;
17
+ const dev = await getDev();
18
+ if (dev) {
19
+ try {
20
+ ({ DATABASE_URL: connectionString } = await import('$env/static/private'));
21
+ }
22
+ catch (_err) {
23
+ connectionString = process.env.DATABASE_URL;
24
+ }
25
+ }
26
+ else {
27
+ try {
28
+ const { getRequestEvent } = await import('$app/server');
29
+ const event = getRequestEvent();
30
+ connectionString = event.platform.env.HYPERDRIVE.connectionString;
31
+ }
32
+ catch (_err) {
33
+ try {
34
+ ({ DATABASE_URL: connectionString } = await import('$env/static/private'));
35
+ }
36
+ catch (_err) {
37
+ connectionString = process.env.DATABASE_URL;
38
+ }
39
+ }
40
+ }
41
+ if (!connectionString) {
42
+ throw new Error('Could not find connection string');
43
+ }
44
+ return connectionString;
45
+ }
46
+ async function getDev() {
47
+ let dev;
48
+ try {
49
+ ({ dev } = await import('$app/environment'));
50
+ }
51
+ catch (_err) {
52
+ ({ DEV: dev } = await import('esm-env'));
53
+ }
54
+ return dev;
55
+ }
File without changes
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ // Reexport your entry components here
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "@thetinkerinc/sprout",
3
+ "version": "0.0.1",
4
+ "license": "MIT",
5
+ "scripts": {
6
+ "dev": "vite dev",
7
+ "build": "vite build && npm run prepack",
8
+ "preview": "vite preview",
9
+ "upload": "npm publish --access=public",
10
+ "prepare": "svelte-kit sync || echo ''",
11
+ "prepack": "svelte-kit sync && svelte-package && publint",
12
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
13
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
14
+ "format": "prettier --write .",
15
+ "lint": "eslint .",
16
+ "cleanup": "run-s format lint check",
17
+ "release": "run-s build upload",
18
+ "cf-typegen": "wrangler types src/worker-configuration.d.ts"
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "!dist/**/*.test.*",
23
+ "!dist/**/*.spec.*"
24
+ ],
25
+ "sideEffects": [
26
+ "**/*.css"
27
+ ],
28
+ "svelte": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
30
+ "type": "module",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "svelte": "./dist/index.js"
35
+ },
36
+ "./db": {
37
+ "types": "./dist/db/index.d.ts",
38
+ "svelte": "./dist/db/index.js"
39
+ }
40
+ },
41
+ "peerDependencies": {
42
+ "svelte": "^5.0.0",
43
+ "@sveltejs/kit": "^2.49.2"
44
+ },
45
+ "devDependencies": {
46
+ "@eslint/compat": "^2.0.0",
47
+ "@eslint/js": "^9.39.2",
48
+ "@inlang/paraglide-js": "^2.7.1",
49
+ "@sveltejs/adapter-cloudflare": "^7.2.4",
50
+ "@sveltejs/kit": "^2.49.2",
51
+ "@sveltejs/package": "^2.5.7",
52
+ "@sveltejs/vite-plugin-svelte": "^6.2.1",
53
+ "@tailwindcss/forms": "^0.5.11",
54
+ "@tailwindcss/typography": "^0.5.19",
55
+ "@tailwindcss/vite": "^4.1.18",
56
+ "@types/node": "^25.0.3",
57
+ "@types/pg": "^8.16.0",
58
+ "eslint": "^9.39.2",
59
+ "eslint-config-prettier": "^10.1.8",
60
+ "eslint-plugin-svelte": "^3.13.1",
61
+ "globals": "^17.0.0",
62
+ "npm-run-all": "^4.1.5",
63
+ "prettier": "^3.7.4",
64
+ "prettier-plugin-svelte": "^3.4.1",
65
+ "prettier-plugin-tailwindcss": "^0.7.2",
66
+ "publint": "^0.3.16",
67
+ "svelte": "^5.46.1",
68
+ "svelte-check": "^4.3.5",
69
+ "tailwindcss": "^4.1.18",
70
+ "typescript": "^5.9.3",
71
+ "typescript-eslint": "^8.51.0",
72
+ "vite": "^7.3.0"
73
+ },
74
+ "keywords": [
75
+ "svelte"
76
+ ],
77
+ "dependencies": {
78
+ "kysely": "^0.28.9",
79
+ "pg": "^8.16.3"
80
+ }
81
+ }