Archived
3
0

Create build system (#1)

This commit is contained in:
Matěj Žucha
2025-03-09 18:22:14 +00:00
committed by Ondřej Mekina
parent 5bb655b7de
commit 77c8deabc8
36 changed files with 1860 additions and 478 deletions

2
client/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
node_modules/
dst/

BIN
client/bun.lockb Executable file

Binary file not shown.

33
client/client.mk Normal file
View File

@@ -0,0 +1,33 @@
client/node_modules:
bun install --cwd client
client/dst:
mkdir client/dst
client/dst/%.html: \
client/src/%.html \
client/node_modules \
client/dst \
$(SEARCH_REPLACE)
cat $< | bun run --cwd client html-minifier \
--collapse-inline-tag-whitespace \
--collapse-boolean-attributes \
--collapse-whitespace \
--remove-attribute-quotes \
--remove-comments \
--remove-redundant-attributes | \
$(SEARCH_REPLACE) \
'##LT##' '<' \
'##GT##' '>' \
> $@
client/dst/%.js: client/src/%.ts client/node_modules client/dst
bun build $< --minify --outfile $@
client/dst/%.css: client/src/%.scss client/node_modules client/dst
cat $< | bun run --cwd client sass --stdin --style compressed > $@
.PHONY: client_clean
client_clean:
rm -rf client/dst
rm -rf client/node_modules

13
client/package.json Normal file
View File

@@ -0,0 +1,13 @@
{
"type": "module",
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"dependencies": {
"html-minifier": "^4.0.0",
"sass": "^1.85.1"
}
}

31
client/src/index.html Normal file
View File

@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Test page</title>
<link href="style.css" rel="stylesheet">
</head>
<body>
<h1>This is a test page</h1>
<p>zmp24 rizzin 2b tru σ pookie fr gooner skibidi</p>
<p>This page was visited {{ visit_count }} times before you showed up.</p>
<p>
Here is {{ visit_count }} dot{% if visit_count != 1 %}s{% endif %}:
<!--
Tohle je skibidi sigma můj úžasný build systém.
Ať neděláme gulášek v syntax highlightingu.
Ty replacementy jsou v `client/client.mk`.
-->
{% if visit_count ##LT## 100 %}
{% for _ in 0..visit_count %}
.
{% endfor %}
{% else %}
That's too much dots to display. So f u.
{% endif %}
</p>
<script src="script.js"></script>
</body>
</html>

16
client/src/script.ts Normal file
View File

@@ -0,0 +1,16 @@
type Sigma = string;
type ToMew = "Σ" | Sigma;
async function skibidi(): Promise<ToMew> {
return "fr fr";
}
async function boomer(): Promise<never> {
return new Promise(() => {});
}
async function alpha(): Promise<void> {
console.log(await Promise.any([skibidi(), boomer()]) + " nocap");
}
alpha();

10
client/src/style.scss Normal file
View File

@@ -0,0 +1,10 @@
:root {
color-scheme: light dark;
}
$color-me-daddy: light-dark(black, white);
body {
font-family: Arial, Helvetica, sans-serif;
color: $color-me-daddy;
}

23
client/tsconfig.json Normal file
View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"lib": ["ESNext", "DOM"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": false,
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
}