Skip to content

chore: update playgrounds/demo #9666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions playgrounds/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@
"version": "0.0.1",
"type": "module",
"scripts": {
"prepare": "node scripts/create-app-svelte.js",
"dev": "vite --host",
"ssr": "node ./server.js",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"svelte": "workspace:*"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^2.5.1",
"express": "^4.18.2",
"nodemon": "^3.0.1",
"svelte": "workspace:*",
"vite": "^4.4.9"
}
}
8 changes: 8 additions & 0 deletions playgrounds/demo/scripts/App.template.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<script lang="ts">
function openInEditor() {
fetch('./__open-in-editor?file=src/App.svelte');
}
</script>

<h1>Demo App</h1>
<button class="open-in-editor" on:click={openInEditor}>edit App.svelte</button>
6 changes: 6 additions & 0 deletions playgrounds/demo/scripts/create-app-svelte.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import fs from 'node:fs';
const destination = new URL('../src/App.svelte', import.meta.url);
if (!fs.existsSync(destination)) {
const template = new URL('./App.template.svelte', import.meta.url);
fs.writeFileSync(destination, fs.readFileSync(template, 'utf-8'), 'utf-8');
}
6 changes: 5 additions & 1 deletion playgrounds/demo/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';

export default defineConfig({
plugins: [svelte()]
plugins: [svelte()],
optimizeDeps: {
// svelte is a local workspace package, optimizing it would require dev server restarts with --force for every change
exclude: ['svelte']
}
});
41 changes: 34 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.