commit 51b458103bcd7697c8b452ac5048006bcce70879 Author: Hornwitser Date: Tue Jan 21 07:56:15 2025 +0100 Scaffold project structure Setup vcs, editor, language, and package configs for a basic site generator using TSX to build an html website. diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dd87e2d --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +build diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..1402fb2 --- /dev/null +++ b/.vscode/settings.json @@ -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, + }, +} diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..11660c2 --- /dev/null +++ b/Readme.md @@ -0,0 +1,3 @@ +# hornwitser.no + +The code behind hornwitser.no diff --git a/cli.js b/cli.js new file mode 100644 index 0000000..f54821c --- /dev/null +++ b/cli.js @@ -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); diff --git a/index.tsx b/index.tsx new file mode 100644 index 0000000..617144c --- /dev/null +++ b/index.tsx @@ -0,0 +1,15 @@ +import { htmlDocument, prettify } from "antihtml"; + +export const index = htmlDocument( + prettify( + + + My Website + + +

My Website

+

Hello world!

+ + + ) +); diff --git a/package.json b/package.json new file mode 100644 index 0000000..811089f --- /dev/null +++ b/package.json @@ -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" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..7d61742 --- /dev/null +++ b/pnpm-lock.yaml @@ -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 diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..7a63bc6 --- /dev/null +++ b/tsconfig.json @@ -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 + } +}