Skip to content

Commit

Permalink
WIP - svelte-kit example
Browse files Browse the repository at this point in the history
  • Loading branch information
niemyjski committed Oct 20, 2021
1 parent e3133b8 commit 8d1d4a6
Show file tree
Hide file tree
Showing 11 changed files with 803 additions and 30 deletions.
5 changes: 5 additions & 0 deletions example/svelte-kit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
38 changes: 38 additions & 0 deletions example/svelte-kit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# create-svelte

Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte);

## Creating a project

If you're seeing this, you've probably already done this step. Congrats!

```bash
# create a new project in the current directory
npm init svelte@next

# create a new project in my-app
npm init svelte@next my-app
```

> Note: the `@next` is temporary
## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open
```

## Building

Before creating a production version of your app, install an [adapter](https://kit.svelte.dev/docs#adapters) for your target environment. Then:

```bash
npm run build
```

> 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.
10 changes: 10 additions & 0 deletions example/svelte-kit/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"$lib": ["src/lib"],
"$lib/*": ["src/lib/*"]
}
},
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
}
18 changes: 18 additions & 0 deletions example/svelte-kit/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "svelte-kit",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "svelte-kit dev",
"build": "svelte-kit build",
"preview": "svelte-kit preview"
},
"dependencies": {
"@exceptionless/browser": "2.0.0-dev"
},
"devDependencies": {
"@sveltejs/kit": "next",
"svelte": "^3.42.6"
},
"type": "module"
}
12 changes: 12 additions & 0 deletions example/svelte-kit/src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%svelte.head%
</head>
<body>
<div id="svelte">%svelte.body%</div>
</body>
</html>
1 change: 1 addition & 0 deletions example/svelte-kit/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="@sveltejs/kit" />
11 changes: 11 additions & 0 deletions example/svelte-kit/src/hooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Exceptionless } from "@exceptionless/browser";

Exceptionless.startup(c => {
c.apiKey = "LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw";
c.serverUrl = "http://localhost:5000";
});

/** @type {import('@sveltejs/kit').HandleError} */
export async function handleError({ error, request }) {
await Exceptionless.submitException(error);
}
9 changes: 9 additions & 0 deletions example/svelte-kit/src/routes/index.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>

<script>
const badVariable = () => {
return fakeVariable;
}
badVariable();
</script>
Binary file added example/svelte-kit/static/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions example/svelte-kit/svelte.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
// hydrate the <div id="svelte"> element in src/app.html
target: '#svelte',
}
};

export default config;
Loading

0 comments on commit 8d1d4a6

Please sign in to comment.