-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
872 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
/node_modules/ | ||
/public/build/ | ||
todo.md | ||
node_modules | ||
|
||
# Output | ||
.output | ||
.vercel | ||
.netlify | ||
.wrangler | ||
/.svelte-kit | ||
/build | ||
|
||
# OS | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# Env | ||
.env | ||
.env.* | ||
!.env.example | ||
!.env.test | ||
|
||
# Vite | ||
vite.config.js.timestamp-* | ||
vite.config.ts.timestamp-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
engine-strict=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,32 @@ | ||
{ | ||
"name": "sql-playground", | ||
"version": "1.0.0", | ||
"private": true, | ||
"version": "0.0.1", | ||
"type": "module", | ||
"scripts": { | ||
"build": "rollup -c", | ||
"dev": "rollup -c -w", | ||
"start": "sirv public --no-clear", | ||
"check": "svelte-check --tsconfig ./tsconfig.json" | ||
"dev": "vite dev", | ||
"build": "vite build", | ||
"preview": "vite preview", | ||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", | ||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^17.0.0", | ||
"@rollup/plugin-node-resolve": "^11.0.0", | ||
"@rollup/plugin-typescript": "^8.0.0", | ||
"@tsconfig/svelte": "^2.0.0", | ||
"@types/js-yaml": "^4.0.5", | ||
"@types/lodash": "^4.14.185", | ||
"@types/sql.js": "^1.4.4", | ||
"rollup": "^2.3.4", | ||
"rollup-plugin-css-only": "^3.1.0", | ||
"rollup-plugin-livereload": "^2.0.0", | ||
"rollup-plugin-svelte": "^7.0.0", | ||
"rollup-plugin-terser": "^7.0.0", | ||
"svelte": "^3.0.0", | ||
"svelte-check": "^2.0.0", | ||
"svelte-preprocess": "^4.0.0", | ||
"tslib": "^2.0.0", | ||
"typescript": "^4.0.0" | ||
"@sveltejs/adapter-auto": "^3.0.0", | ||
"@sveltejs/adapter-static": "^3.0.1", | ||
"@sveltejs/kit": "^2.0.0", | ||
"@sveltejs/vite-plugin-svelte": "^4.0.0", | ||
"svelte": "^5.0.0", | ||
"svelte-check": "^4.0.0", | ||
"typescript": "^5.0.0", | ||
"vite": "^5.4.11" | ||
}, | ||
"dependencies": { | ||
"@monaco-editor/loader": "^1.3.2", | ||
"monaco-editor": "^0.34.0", | ||
"sirv-cli": "^1.0.0", | ||
"sql-formatter": "^11.0.0", | ||
"zod": "^3.19.1" | ||
"@monaco-editor/loader": "^1.4.0", | ||
"monaco-editor": "^0.49.0", | ||
"zod": "^3.23.8", | ||
"sql-formatter": "^11.0.0" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { Database } from "sql.js"; | ||
|
||
declare global { | ||
namespace App { | ||
// interface Error {} | ||
// interface Locals {} | ||
// interface PageData {} | ||
// interface PageState {} | ||
// interface Platform {} | ||
} | ||
|
||
interface Window { | ||
db: Database; | ||
} | ||
} | ||
|
||
export { }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%sveltekit.assets%/favicon.png" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" | ||
integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" | ||
crossorigin="anonymous" referrerpolicy="no-referrer" /> | ||
<script src="js/fork-me-baby.min.js"></script> | ||
|
||
<script src="./sql-wasm.js"></script> | ||
<script type="module"> | ||
const sqlPromise = initSqlJs({ | ||
locateFile: (file) => `./${file}`, | ||
}); | ||
|
||
const dataPromise = fetch("db.sqlite").then((res) => | ||
res.arrayBuffer() | ||
); | ||
|
||
const [SQL, buf] = await Promise.all([sqlPromise, dataPromise]); | ||
window.db = new SQL.Database(new Uint8Array(buf)); | ||
</script> | ||
%sveltekit.head% | ||
</head> | ||
|
||
<body data-sveltekit-preload-data="hover"> | ||
<div style="display: contents">%sveltekit.body%</div> | ||
|
||
<script> | ||
forkMeBaby({ | ||
position: "top-right", | ||
link: "https://github.com/FS-Frost/sql-playground", | ||
sticky: false, | ||
}); | ||
|
||
if ("serviceWorker" in navigator) { | ||
window.addEventListener("load", function () { | ||
navigator.serviceWorker | ||
.register("worker.js") | ||
.then( | ||
function (registration) { | ||
console.log("Worker registration successful", registration.scope); | ||
}, | ||
function (err) { | ||
console.log("Worker registration failed", err); | ||
} | ||
) | ||
.catch(function (err) { | ||
console.log(err); | ||
}); | ||
}); | ||
} else { | ||
console.log("Service Worker is not supported by browser."); | ||
} | ||
</script> | ||
|
||
<style> | ||
.fork-me-baby.top-right:before { | ||
border-right-color: #302a7a !important; | ||
} | ||
</style> | ||
</body> | ||
|
||
</html> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { writable } from 'svelte/store'; | ||
|
||
const pagesKeys = <const>[ | ||
"home", | ||
]; | ||
|
||
export const pages: string[] = pagesKeys.map(page => page.toString()); | ||
|
||
export type ActivePage = typeof pagesKeys[number]; | ||
|
||
export const defaultPage: ActivePage = "home"; | ||
|
||
export const activePage = writable<ActivePage>(); | ||
|
||
export function isPage(keyInput: string): keyInput is ActivePage { | ||
return pages.includes(keyInput); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { z } from "zod"; | ||
|
||
export const BuildInfo = z.object({ | ||
"sha": z.string().default(""), | ||
"ref": z.string().default(""), | ||
"actor": z.string().default(""), | ||
}); | ||
|
||
export type BuildInfo = z.infer<typeof BuildInfo>; | ||
|
||
export async function getBuildInfo(): Promise<BuildInfo> { | ||
const defaultBuildInfo = BuildInfo.parse({}); | ||
const response = await fetch("build-info.json"); | ||
if (!response.ok) { | ||
console.error(`failed to fetch build info, status ${response.status}`); | ||
return defaultBuildInfo; | ||
} | ||
|
||
const maybeBuildInfo = await response.json(); | ||
const parseResult = BuildInfo.safeParse(maybeBuildInfo); | ||
if (!parseResult.success) { | ||
console.error("invalid build info", { | ||
parseResult, | ||
}); | ||
return defaultBuildInfo; | ||
} | ||
|
||
return parseResult.data; | ||
} |
Oops, something went wrong.