Skip to content

Commit a73674e

Browse files
committed
chore: scaffold svelte app
1 parent ac560ec commit a73674e

12 files changed

Lines changed: 715 additions & 59 deletions

File tree

packages/svelte-db/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
node_modules
2+
3+
# Output
4+
.output
5+
.vercel
6+
.netlify
7+
.wrangler
8+
/.svelte-kit
9+
/build
10+
/dist
11+
12+
# OS
13+
.DS_Store
14+
Thumbs.db
15+
16+
# Env
17+
.env
18+
.env.*
19+
!.env.example
20+
!.env.test
21+
22+
# Vite
23+
vite.config.js.timestamp-*
24+
vite.config.ts.timestamp-*

packages/svelte-db/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Svelte library
2+
3+
Everything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).
4+
5+
Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
6+
7+
## Creating a project
8+
9+
If you're seeing this, you've probably already done this step. Congrats!
10+
11+
```bash
12+
# create a new project in the current directory
13+
npx sv create
14+
15+
# create a new project in my-app
16+
npx sv create my-app
17+
```
18+
19+
## Developing
20+
21+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
22+
23+
```bash
24+
npm run dev
25+
26+
# or start the server and open the app in a new browser tab
27+
npm run dev -- --open
28+
```
29+
30+
Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
31+
32+
## Building
33+
34+
To build your library:
35+
36+
```bash
37+
npm run package
38+
```
39+
40+
To create a production version of your showcase app:
41+
42+
```bash
43+
npm run build
44+
```
45+
46+
You can preview the production build with `npm run preview`.
47+
48+
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
49+
50+
## Publishing
51+
52+
Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
53+
54+
To publish your library to [npm](https://www.npmjs.com):
55+
56+
```bash
57+
npm publish
58+
```

packages/svelte-db/package.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "@tanstack/svelte-db",
3+
"description": "Svelte integration for @tanstack/db",
4+
"version": "0.0.0",
5+
"scripts": {
6+
"dev": "vite dev",
7+
"build": "vite build && npm run prepack",
8+
"preview": "vite preview",
9+
"prepare": "svelte-kit sync || echo ''",
10+
"prepack": "svelte-kit sync && svelte-package && publint",
11+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
12+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
13+
},
14+
"files": [
15+
"dist",
16+
"!dist/**/*.test.*",
17+
"!dist/**/*.spec.*"
18+
],
19+
"sideEffects": [
20+
"**/*.css"
21+
],
22+
"svelte": "./dist/index.js",
23+
"types": "./dist/index.d.ts",
24+
"type": "module",
25+
"exports": {
26+
".": {
27+
"types": "./dist/index.d.ts",
28+
"svelte": "./dist/index.js"
29+
}
30+
},
31+
"peerDependencies": {
32+
"svelte": "^5.0.0"
33+
},
34+
"devDependencies": {
35+
"@sveltejs/adapter-auto": "^6.0.0",
36+
"@sveltejs/kit": "^2.16.0",
37+
"@sveltejs/package": "^2.0.0",
38+
"@sveltejs/vite-plugin-svelte": "^5.0.0",
39+
"publint": "^0.3.2",
40+
"svelte": "^5.0.0",
41+
"svelte-check": "^4.0.0",
42+
"typescript": "^5.0.0",
43+
"vite": "^6.2.6"
44+
},
45+
"keywords": [
46+
"optimistic",
47+
"svelte",
48+
"typescript"
49+
]
50+
}

packages/svelte-db/src/app.d.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// See https://svelte.dev/docs/kit/types#app.d.ts
2+
// for information about these interfaces
3+
declare global {
4+
namespace App {
5+
// interface Error {}
6+
// interface Locals {}
7+
// interface PageData {}
8+
// interface PageState {}
9+
// interface Platform {}
10+
}
11+
}
12+
13+
export {}

packages/svelte-db/src/app.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
%sveltekit.head%
8+
</head>
9+
<body data-sveltekit-preload-data="hover">
10+
<div>%sveltekit.body%</div>
11+
</body>
12+
</html>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Reexport your entry components here
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h1>Welcome to your library project</h1>
2+
<p>Create your package using @sveltejs/package and preview/showcase your work with SvelteKit</p>
3+
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>
1.53 KB
Loading
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import adapter from '@sveltejs/adapter-auto';
2+
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
3+
4+
/** @type {import('@sveltejs/kit').Config} */
5+
const config = {
6+
// Consult https://svelte.dev/docs/kit/integrations
7+
// for more information about preprocessors
8+
preprocess: vitePreprocess(),
9+
10+
kit: {
11+
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
12+
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
13+
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
14+
adapter: adapter()
15+
}
16+
};
17+
18+
export default config;

packages/svelte-db/tsconfig.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": "./.svelte-kit/tsconfig.json",
3+
"compilerOptions": {
4+
"allowJs": true,
5+
"checkJs": true,
6+
"esModuleInterop": true,
7+
"forceConsistentCasingInFileNames": true,
8+
"resolveJsonModule": true,
9+
"skipLibCheck": true,
10+
"sourceMap": true,
11+
"strict": true,
12+
"module": "NodeNext",
13+
"moduleResolution": "NodeNext"
14+
}
15+
}

0 commit comments

Comments
 (0)