Skip to content

Commit 8d1d4a6

Browse files
committed
WIP - svelte-kit example
exceptionless/Website#38
1 parent e3133b8 commit 8d1d4a6

File tree

11 files changed

+803
-30
lines changed

11 files changed

+803
-30
lines changed

example/svelte-kit/.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
node_modules
3+
/build
4+
/.svelte-kit
5+
/package

example/svelte-kit/README.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# create-svelte
2+
3+
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte);
4+
5+
## Creating a project
6+
7+
If you're seeing this, you've probably already done this step. Congrats!
8+
9+
```bash
10+
# create a new project in the current directory
11+
npm init svelte@next
12+
13+
# create a new project in my-app
14+
npm init svelte@next my-app
15+
```
16+
17+
> Note: the `@next` is temporary
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+
## Building
31+
32+
Before creating a production version of your app, install an [adapter](https://kit.svelte.dev/docs#adapters) for your target environment. Then:
33+
34+
```bash
35+
npm run build
36+
```
37+
38+
> You can preview the built app with `npm run preview`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.

example/svelte-kit/jsconfig.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"paths": {
5+
"$lib": ["src/lib"],
6+
"$lib/*": ["src/lib/*"]
7+
}
8+
},
9+
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
10+
}

example/svelte-kit/package.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "svelte-kit",
3+
"version": "0.0.1",
4+
"private": true,
5+
"scripts": {
6+
"dev": "svelte-kit dev",
7+
"build": "svelte-kit build",
8+
"preview": "svelte-kit preview"
9+
},
10+
"dependencies": {
11+
"@exceptionless/browser": "2.0.0-dev"
12+
},
13+
"devDependencies": {
14+
"@sveltejs/kit": "next",
15+
"svelte": "^3.42.6"
16+
},
17+
"type": "module"
18+
}

example/svelte-kit/src/app.html

+12
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="/favicon.png" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
%svelte.head%
8+
</head>
9+
<body>
10+
<div id="svelte">%svelte.body%</div>
11+
</body>
12+
</html>

example/svelte-kit/src/global.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="@sveltejs/kit" />

example/svelte-kit/src/hooks.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Exceptionless } from "@exceptionless/browser";
2+
3+
Exceptionless.startup(c => {
4+
c.apiKey = "LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw";
5+
c.serverUrl = "http://localhost:5000";
6+
});
7+
8+
/** @type {import('@sveltejs/kit').HandleError} */
9+
export async function handleError({ error, request }) {
10+
await Exceptionless.submitException(error);
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<h1>Welcome to SvelteKit</h1>
2+
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
3+
4+
<script>
5+
const badVariable = () => {
6+
return fakeVariable;
7+
}
8+
badVariable();
9+
</script>

example/svelte-kit/static/favicon.png

1.53 KB
Loading

example/svelte-kit/svelte.config.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/** @type {import('@sveltejs/kit').Config} */
2+
const config = {
3+
kit: {
4+
// hydrate the <div id="svelte"> element in src/app.html
5+
target: '#svelte',
6+
}
7+
};
8+
9+
export default config;

0 commit comments

Comments
 (0)