mirror of
https://git.sfja.dk/sfja/h6-logicirc.git
synced 2025-05-15 16:58:08 +01:00
add deno web project
This commit is contained in:
parent
bd6c3b7e5c
commit
c1c6e145a0
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
build/
|
||||
|
51
bundle.ts
Normal file
51
bundle.ts
Normal file
@ -0,0 +1,51 @@
|
||||
import * as esbuild from "npm:esbuild@0.20.2";
|
||||
import { denoPlugins } from "jsr:@luca/esbuild-deno-loader@^0.11.0";
|
||||
|
||||
async function buildCode() {
|
||||
await esbuild.build({
|
||||
plugins: [...denoPlugins()],
|
||||
entryPoints: ["./src/main.ts"],
|
||||
outfile: "./build/bundle.js",
|
||||
bundle: true,
|
||||
format: "esm",
|
||||
});
|
||||
|
||||
esbuild.stop();
|
||||
}
|
||||
|
||||
async function copyStatic(path: string[] = []) {
|
||||
const dir = path.join("/");
|
||||
await Deno.mkdir("build/" + dir).catch((_) => _);
|
||||
for await (const file of Deno.readDir(`static/${dir}`)) {
|
||||
if (file.isDirectory) {
|
||||
await copyStatic([...path, file.name]);
|
||||
continue;
|
||||
}
|
||||
await Deno.copyFile(
|
||||
`static/${dir}/${file.name}`,
|
||||
`build/${dir}/${file.name}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
type BundleOptions = {
|
||||
quiet?: boolean;
|
||||
};
|
||||
|
||||
export async function bundle(options?: BundleOptions) {
|
||||
if (!options?.quiet) {
|
||||
console.log("info: copying static files");
|
||||
}
|
||||
await copyStatic();
|
||||
if (!options?.quiet) {
|
||||
console.log("info: building code");
|
||||
}
|
||||
await buildCode();
|
||||
if (!options?.quiet) {
|
||||
console.log("success: output in 'build/'");
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.main) {
|
||||
await bundle();
|
||||
}
|
13
deno.jsonc
Normal file
13
deno.jsonc
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"tasks": {
|
||||
"bundle": "deno run --allow-read --allow-write --allow-env --allow-run bundle.ts",
|
||||
"dev": "deno run --allow-net --allow-read --allow-write --allow-env --allow-run dev.ts"
|
||||
},
|
||||
"compilerOptions": {
|
||||
"lib": ["dom", "dom.iterable", "dom.asynciterable", "deno.ns"]
|
||||
},
|
||||
"fmt": {
|
||||
"indentWidth": 4
|
||||
}
|
||||
}
|
||||
|
128
deno.lock
Normal file
128
deno.lock
Normal file
@ -0,0 +1,128 @@
|
||||
{
|
||||
"version": "4",
|
||||
"specifiers": {
|
||||
"jsr:@luca/esbuild-deno-loader@0.11": "0.11.1",
|
||||
"jsr:@std/bytes@^1.0.2": "1.0.4",
|
||||
"jsr:@std/encoding@^1.0.5": "1.0.5",
|
||||
"jsr:@std/path@^1.0.6": "1.0.8",
|
||||
"npm:esbuild@0.20.2": "0.20.2"
|
||||
},
|
||||
"jsr": {
|
||||
"@luca/esbuild-deno-loader@0.11.1": {
|
||||
"integrity": "dc020d16d75b591f679f6b9288b10f38bdb4f24345edb2f5732affa1d9885267",
|
||||
"dependencies": [
|
||||
"jsr:@std/bytes",
|
||||
"jsr:@std/encoding",
|
||||
"jsr:@std/path"
|
||||
]
|
||||
},
|
||||
"@std/bytes@1.0.4": {
|
||||
"integrity": "11a0debe522707c95c7b7ef89b478c13fb1583a7cfb9a85674cd2cc2e3a28abc"
|
||||
},
|
||||
"@std/encoding@1.0.5": {
|
||||
"integrity": "ecf363d4fc25bd85bd915ff6733a7e79b67e0e7806334af15f4645c569fefc04"
|
||||
},
|
||||
"@std/path@1.0.8": {
|
||||
"integrity": "548fa456bb6a04d3c1a1e7477986b6cffbce95102d0bb447c67c4ee70e0364be"
|
||||
}
|
||||
},
|
||||
"npm": {
|
||||
"@esbuild/aix-ppc64@0.20.2": {
|
||||
"integrity": "sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g=="
|
||||
},
|
||||
"@esbuild/android-arm64@0.20.2": {
|
||||
"integrity": "sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg=="
|
||||
},
|
||||
"@esbuild/android-arm@0.20.2": {
|
||||
"integrity": "sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w=="
|
||||
},
|
||||
"@esbuild/android-x64@0.20.2": {
|
||||
"integrity": "sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg=="
|
||||
},
|
||||
"@esbuild/darwin-arm64@0.20.2": {
|
||||
"integrity": "sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA=="
|
||||
},
|
||||
"@esbuild/darwin-x64@0.20.2": {
|
||||
"integrity": "sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA=="
|
||||
},
|
||||
"@esbuild/freebsd-arm64@0.20.2": {
|
||||
"integrity": "sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw=="
|
||||
},
|
||||
"@esbuild/freebsd-x64@0.20.2": {
|
||||
"integrity": "sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw=="
|
||||
},
|
||||
"@esbuild/linux-arm64@0.20.2": {
|
||||
"integrity": "sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A=="
|
||||
},
|
||||
"@esbuild/linux-arm@0.20.2": {
|
||||
"integrity": "sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg=="
|
||||
},
|
||||
"@esbuild/linux-ia32@0.20.2": {
|
||||
"integrity": "sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig=="
|
||||
},
|
||||
"@esbuild/linux-loong64@0.20.2": {
|
||||
"integrity": "sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ=="
|
||||
},
|
||||
"@esbuild/linux-mips64el@0.20.2": {
|
||||
"integrity": "sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA=="
|
||||
},
|
||||
"@esbuild/linux-ppc64@0.20.2": {
|
||||
"integrity": "sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg=="
|
||||
},
|
||||
"@esbuild/linux-riscv64@0.20.2": {
|
||||
"integrity": "sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg=="
|
||||
},
|
||||
"@esbuild/linux-s390x@0.20.2": {
|
||||
"integrity": "sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ=="
|
||||
},
|
||||
"@esbuild/linux-x64@0.20.2": {
|
||||
"integrity": "sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw=="
|
||||
},
|
||||
"@esbuild/netbsd-x64@0.20.2": {
|
||||
"integrity": "sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ=="
|
||||
},
|
||||
"@esbuild/openbsd-x64@0.20.2": {
|
||||
"integrity": "sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ=="
|
||||
},
|
||||
"@esbuild/sunos-x64@0.20.2": {
|
||||
"integrity": "sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w=="
|
||||
},
|
||||
"@esbuild/win32-arm64@0.20.2": {
|
||||
"integrity": "sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ=="
|
||||
},
|
||||
"@esbuild/win32-ia32@0.20.2": {
|
||||
"integrity": "sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ=="
|
||||
},
|
||||
"@esbuild/win32-x64@0.20.2": {
|
||||
"integrity": "sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ=="
|
||||
},
|
||||
"esbuild@0.20.2": {
|
||||
"integrity": "sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==",
|
||||
"dependencies": [
|
||||
"@esbuild/aix-ppc64",
|
||||
"@esbuild/android-arm",
|
||||
"@esbuild/android-arm64",
|
||||
"@esbuild/android-x64",
|
||||
"@esbuild/darwin-arm64",
|
||||
"@esbuild/darwin-x64",
|
||||
"@esbuild/freebsd-arm64",
|
||||
"@esbuild/freebsd-x64",
|
||||
"@esbuild/linux-arm",
|
||||
"@esbuild/linux-arm64",
|
||||
"@esbuild/linux-ia32",
|
||||
"@esbuild/linux-loong64",
|
||||
"@esbuild/linux-mips64el",
|
||||
"@esbuild/linux-ppc64",
|
||||
"@esbuild/linux-riscv64",
|
||||
"@esbuild/linux-s390x",
|
||||
"@esbuild/linux-x64",
|
||||
"@esbuild/netbsd-x64",
|
||||
"@esbuild/openbsd-x64",
|
||||
"@esbuild/sunos-x64",
|
||||
"@esbuild/win32-arm64",
|
||||
"@esbuild/win32-ia32",
|
||||
"@esbuild/win32-x64"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
9
src/main.ts
Normal file
9
src/main.ts
Normal file
@ -0,0 +1,9 @@
|
||||
const c = document.querySelector<HTMLCanvasElement>("canvas#editor")!;
|
||||
const g = c.getContext("2d")!;
|
||||
|
||||
c.width = document.body.clientWidth;
|
||||
c.height = document.body.clientHeight;
|
||||
c.style.position = "absolute";
|
||||
|
||||
g.fillStyle = "#aa2233";
|
||||
g.fillRect(0, 0, c.width, c.height);
|
BIN
static/favicon.ico
Normal file
BIN
static/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
13
static/index.html
Normal file
13
static/index.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<script src="bundle.js" defer></script>
|
||||
<title>LogiCirc</title>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="editor"></canvas>
|
||||
</body>
|
||||
</html>
|
11
static/style.css
Normal file
11
static/style.css
Normal file
@ -0,0 +1,11 @@
|
||||
:root {
|
||||
color-scheme: light dark;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user