diff --git a/apps/sveltekit/.gitignore b/apps/sveltekit/.gitignore index 8f6c617..6635cf5 100644 --- a/apps/sveltekit/.gitignore +++ b/apps/sveltekit/.gitignore @@ -6,7 +6,5 @@ node_modules .env .env.* !.env.example -.vercel -.output vite.config.js.timestamp-* vite.config.ts.timestamp-* diff --git a/apps/sveltekit/README.md b/apps/sveltekit/README.md index 5c91169..7e05305 100644 --- a/apps/sveltekit/README.md +++ b/apps/sveltekit/README.md @@ -1,38 +1,17 @@ -# create-svelte +# Sveltekit Demo application for Vercel Speed-insights -Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte). +## Setup -## Creating a project +This application was created with the following commands: -If you're seeing this, you've probably already done this step. Congrats! +- `cd apps` +- `pnpm create svelte@latest sveltekit` (answers: Skeleton project, JavaScript with JSDoc, no additional option) +- `cd sveltekit` +- add `src/+layout.js` to include `import { injectSpeedInsights } from '@vercel/speed-insights/sveltekit'; injectSpeedInsights();` +- edit package.json to add `"@vercel/speed-insights": "workspace:*"` dependency and change `@sveltejs/adapter-auto` into `@sveltejs/adapter-vercel` +- eddi `svelte.config.js` to change `@sveltejs/adapter-auto` into `@sveltejs/adapter-vercel` +- `pnpm i` -```bash -# create a new project in the current directory -npm create svelte@latest +## Usage -# create a new project in my-app -npm create svelte@latest my-app -``` - -## 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 - -To create a production version of your app: - -```bash -npm run build -``` - -You can preview the production build with `npm run preview`. - -> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. +Start it with `cd apps/sveltekit` + `pnpm dev` and browse to [http://localhost:5173](http://localhost:5173) diff --git a/apps/sveltekit/tsconfig.json b/apps/sveltekit/jsconfig.json similarity index 80% rename from apps/sveltekit/tsconfig.json rename to apps/sveltekit/jsconfig.json index 794b95b..4043666 100644 --- a/apps/sveltekit/tsconfig.json +++ b/apps/sveltekit/jsconfig.json @@ -8,9 +8,10 @@ "resolveJsonModule": true, "skipLibCheck": true, "sourceMap": true, - "strict": true + "strict": true, + "moduleResolution": "bundler" } - // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias + // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias and https://kit.svelte.dev/docs/configuration#files // // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes // from the referenced tsconfig.json - TypeScript does not merge them in diff --git a/apps/sveltekit/package.json b/apps/sveltekit/package.json index ebc1743..1c57e6d 100644 --- a/apps/sveltekit/package.json +++ b/apps/sveltekit/package.json @@ -1,26 +1,21 @@ { - "name": "svelte", + "name": "sveltekit3", "version": "0.0.1", + "private": true, "type": "module", "scripts": { "build": "vite build", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch", "dev": "vite dev", "preview": "vite preview" }, - "dependencies": { - "@vercel/speed-insights": "workspace:*" - }, "devDependencies": { - "@fontsource/fira-mono": "^4.5.10", - "@neoconfetti/svelte": "^1.0.0", - "@sveltejs/adapter-auto": "^2.0.0", - "@sveltejs/kit": "^1.20.4", - "@types/cookie": "^0.5.1", - "svelte": "^4.0.5", - "svelte-check": "^3.4.3", - "tslib": "^2.4.1", + "@sveltejs/adapter-vercel": "^3.1.0", + "@sveltejs/kit": "^1.27.4", + "@vercel/speed-insights": "workspace:*", + "svelte": "^4.2.7", + "svelte-check": "^3.6.0", "typescript": "^5.0.0", "vite": "^4.4.2" } diff --git a/apps/sveltekit/src/app.html b/apps/sveltekit/src/app.html index 84ffad1..f8b2ff3 100644 --- a/apps/sveltekit/src/app.html +++ b/apps/sveltekit/src/app.html @@ -1,12 +1,15 @@ -
- - - - %sveltekit.head% - - -