Scaffold project structure

Setup vcs, editor, language, and package configs for a basic site
generator using TSX to build an html website.
This commit is contained in:
Hornwitser 2025-01-21 07:56:15 +01:00
commit 51b458103b
9 changed files with 121 additions and 0 deletions

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
* text=auto eol=lf

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
node_modules
build

16
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,16 @@
{
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"tsconfig.json": "tsconfig.*.json",
"package.json": "package-lock.json, bun.lockb, pnpm*, .yarnrc*, yarn*, .eslint*, eslint*, .prettier*, prettier*, .editorconfig",
},
"editor.detectIndentation": false,
"editor.insertSpaces": false,
"files.eol": "\n",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"[yaml]": {
"editor.indentSize": 2,
"editor.insertSpaces": true,
},
}

3
Readme.md Normal file
View file

@ -0,0 +1,3 @@
# hornwitser.no
The code behind hornwitser.no

9
cli.js Normal file
View file

@ -0,0 +1,9 @@
import { index } from "./build/node/index.js"
import * as fs from "node:fs"
if (!fs.existsSync("build/web")) {
fs.mkdirSync("build/web");
}
console.log("writing build/web/index.html");
fs.writeFileSync("build/web/index.html", index);

15
index.tsx Normal file
View file

@ -0,0 +1,15 @@
import { htmlDocument, prettify } from "antihtml";
export const index = htmlDocument(
prettify(
<html>
<head>
<title>My Website</title>
</head>
<body>
<h1>My Website</h1>
<p>Hello world!</p>
</body>
</html>
)
);

19
package.json Normal file
View file

@ -0,0 +1,19 @@
{
"name": "website",
"private": true,
"packageManager": "pnpm@8.6.12",
"type": "module",
"main": "build/node/index.js",
"scripts": {
"prepare": "tsc",
"build": "node cli.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"antihtml": "^0.3.0"
},
"devDependencies": {
"@types/node": "^22.10.7",
"typescript": "^5.7.3"
}
}

40
pnpm-lock.yaml generated Normal file
View file

@ -0,0 +1,40 @@
lockfileVersion: '6.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
dependencies:
antihtml:
specifier: ^0.3.0
version: 0.3.0
devDependencies:
'@types/node':
specifier: ^22.10.7
version: 22.10.7
typescript:
specifier: ^5.7.3
version: 5.7.3
packages:
/@types/node@22.10.7:
resolution: {integrity: sha512-V09KvXxFiutGp6B7XkpaDXlNadZxrzajcY50EuoLIpQ6WWYCSvf19lVIazzfIzQvhUN2HjX12spLojTnhuKlGg==}
dependencies:
undici-types: 6.20.0
dev: true
/antihtml@0.3.0:
resolution: {integrity: sha512-8a2MUiR8laKIhzFAHmCn5mPQbx5yJf7B9lO7Uqa5QGqkca64JNwExnSyM2GVra98Mqhsu9G4M3oZ9dVyg2EDzg==}
dev: false
/typescript@5.7.3:
resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==}
engines: {node: '>=14.17'}
hasBin: true
dev: true
/undici-types@6.20.0:
resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==}
dev: true

16
tsconfig.json Normal file
View file

@ -0,0 +1,16 @@
{
"files": ["index.tsx"],
"compilerOptions": {
"outDir": "build/node",
"jsx": "react-jsx",
"jsxImportSource": "antihtml",
"lib": ["es2023"],
"target": "es2023",
"module": "node16",
"moduleResolution": "node16",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
}
}