diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a8902566fa5e..5fc83158606b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,7 +16,15 @@ cd kit pnpm install ``` -You can now run SvelteKit by linking it into your project with [pnpm `overrides`](https://pnpm.io/package_json#pnpmoverrides): +## Testing Changes + +### Playground + +You can use the playground at [`playgrounds/basic`](./playgrounds/basic/) to experiment with your changes to SvelteKit locally. + +### Linking + +If you want to test against an existing project, you can use [pnpm `overrides`](https://pnpm.io/package_json#pnpmoverrides) in that project: ```jsonc { diff --git a/playgrounds/basic/README.md b/playgrounds/basic/README.md new file mode 100644 index 000000000000..adb570111453 --- /dev/null +++ b/playgrounds/basic/README.md @@ -0,0 +1,5 @@ +You may use this package to experiment with your changes to SvelteKit. + +To prevent any changes you make in this directory from being accidentally committed, run `git update-index --skip-worktree ./**/*.*` in this directory. + +If you would actually like to make some changes to the files here for everyone then run `git update-index --no-skip-worktree ./**/*.*` before committing. diff --git a/playgrounds/basic/jsconfig.json b/playgrounds/basic/jsconfig.json new file mode 100644 index 000000000000..fe45e13fdd06 --- /dev/null +++ b/playgrounds/basic/jsconfig.json @@ -0,0 +1,17 @@ +{ + "extends": "./.svelte-kit/tsconfig.json", + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "sourceMap": true, + "strict": true + } + // 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/playgrounds/basic/package.json b/playgrounds/basic/package.json new file mode 100644 index 000000000000..b25f98149d8f --- /dev/null +++ b/playgrounds/basic/package.json @@ -0,0 +1,18 @@ +{ + "name": "playground", + "version": "0.0.0", + "private": true, + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview" + }, + "devDependencies": { + "@sveltejs/adapter-auto": "workspace:*", + "@sveltejs/kit": "workspace:*", + "svelte": "^4.0.5", + "typescript": "^5.0.0", + "vite": "^4.4.2" + }, + "type": "module" +} diff --git a/playgrounds/basic/src/app.d.ts b/playgrounds/basic/src/app.d.ts new file mode 100644 index 000000000000..f59b884c51ed --- /dev/null +++ b/playgrounds/basic/src/app.d.ts @@ -0,0 +1,12 @@ +// See https://kit.svelte.dev/docs/types#app +// for information about these interfaces +declare global { + namespace App { + // interface Error {} + // interface Locals {} + // interface PageData {} + // interface Platform {} + } +} + +export {}; diff --git a/playgrounds/basic/src/app.html b/playgrounds/basic/src/app.html new file mode 100644 index 000000000000..effe0d0d266c --- /dev/null +++ b/playgrounds/basic/src/app.html @@ -0,0 +1,12 @@ + + + + + + + %sveltekit.head% + + +
%sveltekit.body%
+ + diff --git a/playgrounds/basic/src/lib/index.js b/playgrounds/basic/src/lib/index.js new file mode 100644 index 000000000000..856f2b6c38ae --- /dev/null +++ b/playgrounds/basic/src/lib/index.js @@ -0,0 +1 @@ +// place files you want to import through the `$lib` alias in this folder. diff --git a/playgrounds/basic/src/routes/+page.svelte b/playgrounds/basic/src/routes/+page.svelte new file mode 100644 index 000000000000..5982b0ae37dd --- /dev/null +++ b/playgrounds/basic/src/routes/+page.svelte @@ -0,0 +1,2 @@ +

Welcome to SvelteKit

+

Visit kit.svelte.dev to read the documentation

diff --git a/playgrounds/basic/static/favicon.png b/playgrounds/basic/static/favicon.png new file mode 100644 index 000000000000..825b9e65af7c Binary files /dev/null and b/playgrounds/basic/static/favicon.png differ diff --git a/playgrounds/basic/svelte.config.js b/playgrounds/basic/svelte.config.js new file mode 100644 index 000000000000..301e785eb88c --- /dev/null +++ b/playgrounds/basic/svelte.config.js @@ -0,0 +1,10 @@ +import adapter from '@sveltejs/adapter-auto'; + +/** @type {import('@sveltejs/kit').Config} */ +const config = { + kit: { + adapter: adapter() + } +}; + +export default config; diff --git a/playgrounds/basic/vite.config.js b/playgrounds/basic/vite.config.js new file mode 100644 index 000000000000..bbf8c7da43f0 --- /dev/null +++ b/playgrounds/basic/vite.config.js @@ -0,0 +1,6 @@ +import { sveltekit } from '@sveltejs/kit/vite'; +import { defineConfig } from 'vite'; + +export default defineConfig({ + plugins: [sveltekit()] +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5618bfc8a9d9..2e2414cfe3d6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -986,6 +986,24 @@ importers: specifier: ^0.5.6 version: 0.5.6 + playgrounds/basic: + devDependencies: + '@sveltejs/adapter-auto': + specifier: workspace:* + version: link:../../packages/adapter-auto + '@sveltejs/kit': + specifier: workspace:* + version: link:../../packages/kit + svelte: + specifier: ^4.0.5 + version: 4.1.2 + typescript: + specifier: ^5.0.0 + version: 5.0.4 + vite: + specifier: ^4.4.2 + version: 4.4.9(@types/node@20.4.9)(lightningcss@1.21.5) + sites/kit.svelte.dev: dependencies: d3-geo: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 7de1bd0a80cc..061febda7d04 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -8,3 +8,4 @@ packages: - 'packages/kit/test/build-errors/apps/*' - 'packages/create-svelte/templates/*' - '!.test-tmp/**' + - 'playgrounds/*'