Skip to content

Commit

Permalink
chore: unify sandbox (#13012)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris authored Aug 26, 2024
1 parent bc1624f commit e366c49
Show file tree
Hide file tree
Showing 19 changed files with 65 additions and 152 deletions.
22 changes: 0 additions & 22 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Playground: Browser",
"url": "http://localhost:10001"
},
{
"type": "node",
"request": "launch",
"runtimeArgs": ["--watch"],
"name": "Playground: Server",
"outputCapture": "std",
"program": "start.js",
"cwd": "${workspaceFolder}/playgrounds/demo",
"cascadeTerminateToConfigurations": ["Playground: Browser"]
},
{
"type": "node",
"request": "launch",
Expand All @@ -26,11 +10,5 @@
"NODE_OPTIONS": "--stack-trace-limit=10000"
}
}
],
"compounds": [
{
"name": "Playground: Full",
"configurations": ["Playground: Server", "Playground: Browser"]
}
]
}
5 changes: 0 additions & 5 deletions playgrounds/demo/.gitignore

This file was deleted.

22 changes: 0 additions & 22 deletions playgrounds/demo/package.json

This file was deleted.

17 changes: 0 additions & 17 deletions playgrounds/demo/tsconfig.json

This file was deleted.

7 changes: 4 additions & 3 deletions playgrounds/sandbox/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
input/*
output/*
!.gitkeep
/dist/client/*
/dist/server/*
/output
/src/*
2 changes: 0 additions & 2 deletions playgrounds/sandbox/.prettierignore

This file was deleted.

File renamed without changes.
File renamed without changes
File renamed without changes.
Empty file removed playgrounds/sandbox/input/.gitkeep
Empty file.
24 changes: 16 additions & 8 deletions playgrounds/sandbox/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
{
"name": "svelte-playgrounds-sandbox",
"name": "svelte-playgrounds-demo",
"private": true,
"type": "module",
"license": "MIT",
"version": "0.0.1",
"type": "module",
"scripts": {
"format": "prettier --check --write .",
"lint": "prettier --check . && eslint"
"prepare": "node scripts/create-app-svelte.js",
"dev": "vite --host",
"ssr": "node ./ssr-dev.js",
"build": "vite build --outDir dist/client && vite build --outDir dist/server --ssr ssr-prod.js",
"prod": "npm run build && node dist/server/ssr-prod",
"preview": "vite preview"
},
"dependencies": {
"svelte": "workspace:^",
"tiny-glob": "^0.2.9"
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^4.0.0-next.3",
"nodemon": "^3.0.3",
"polka": "^1.0.0-next.25",
"svelte": "workspace:*",
"tiny-glob": "^0.2.9",
"vite": "^5.0.13",
"vite-plugin-inspect": "^0.8.4"
}
}
8 changes: 4 additions & 4 deletions playgrounds/sandbox/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ function mkdirp(dir) {
} catch {}
}

const svelte_modules = glob('**/*.svelte', { cwd: `${cwd}/input` });
const js_modules = glob('**/*.js', { cwd: `${cwd}/input` });
const svelte_modules = glob('**/*.svelte', { cwd: `${cwd}/src` });
const js_modules = glob('**/*.js', { cwd: `${cwd}/src` });

for (const generate of /** @type {const} */ (['client', 'server'])) {
console.error(`\n--- generating ${generate} ---\n`);
for (const file of svelte_modules) {
const input = `${cwd}/input/${file}`;
const input = `${cwd}/src/${file}`;
const source = fs.readFileSync(input, 'utf-8');

const output_js = `${cwd}/output/${generate}/${file}.js`;
Expand Down Expand Up @@ -81,7 +81,7 @@ for (const generate of /** @type {const} */ (['client', 'server'])) {
}

for (const file of js_modules) {
const input = `${cwd}/input/${file}`;
const input = `${cwd}/src/${file}`;
const source = fs.readFileSync(input, 'utf-8');

const compiled = compileModule(source, {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion playgrounds/sandbox/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"allowJs": true,
"checkJs": true
},
"include": ["./run.js", "./input"]
"include": ["./src", "ssr-dev.js", "ssr-prod.js"]
}
File renamed without changes.
Loading

0 comments on commit e366c49

Please sign in to comment.