From f80ba026b534f0ef83510b2e4a4998702d83d7d2 Mon Sep 17 00:00:00 2001 From: Bauke Date: Wed, 19 Jul 2023 17:43:46 +0200 Subject: [PATCH] Add miscellaneous project files. --- .gitignore | 8 ++++++++ Makefile.toml | 20 ++++++++++++++++++++ astro.config.ts | 30 ++++++++++++++++++++++++++++++ package.json | 29 +++++++++++++++++++++++++++++ tsconfig.json | 19 +++++++++++++++++++ 5 files changed, 106 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile.toml create mode 100644 astro.config.ts create mode 100644 package.json create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eb82460 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.netlify/ +.vscode/ +node_modules/ +public/ +target/ + +Cargo.lock +pnpm-lock.yaml diff --git a/Makefile.toml b/Makefile.toml new file mode 100644 index 0000000..168dcdc --- /dev/null +++ b/Makefile.toml @@ -0,0 +1,20 @@ +[tasks.build] +clear = true +command = "pnpm" +args = ["astro", "build"] + +[tasks.clean] +clear = true +command = "pnpm" +args = ["trash", "public/"] + +[tasks.dev] +clear = true +command = "pnpm" +args = ["astro", "dev"] + +[tasks.publish] +clear = true +dependencies = ["clean", "build"] +command = "pnpm" +args = ["netlify", "deploy", "-p", "-d", "public/", "-s", "tildes.community"] diff --git a/astro.config.ts b/astro.config.ts new file mode 100644 index 0000000..22d770e --- /dev/null +++ b/astro.config.ts @@ -0,0 +1,30 @@ +import path from "node:path"; +// eslint-disable-next-line n/file-extension-in-import +import {defineConfig} from "astro/config"; +import mdxIntegration from "@astrojs/mdx"; +import preactIntegration from "@astrojs/preact"; + +/** + * Create an absolute path from a given relative one, using the directory + * this file is located in as the base. + * + * @param relative The relative path to make absolute. + * @returns The absolute path. + */ +function toAbsolutePath(relative: string): string { + return new URL(relative, import.meta.url).pathname; +} + +// Create absolute paths to various directories. +const buildDir = toAbsolutePath("./public"); +const sourceDir = toAbsolutePath("./source"); + +export default defineConfig({ + // eslint-disable-next-line @typescript-eslint/naming-convention + compressHTML: true, + integrations: [mdxIntegration(), preactIntegration()], + outDir: buildDir, + publicDir: path.join(sourceDir, "assets/"), + site: "https://tildes.community", + srcDir: sourceDir, +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..db827a8 --- /dev/null +++ b/package.json @@ -0,0 +1,29 @@ +{ + "private": "true", + "dependencies": { + "@astrojs/mdx": "^0.19.7", + "@astrojs/preact": "^2.2.1", + "@bauke/eslint-config": "^0.1.4", + "@bauke/prettier-config": "^0.1.4", + "@bauke/stylelint-config": "^0.1.4", + "@types/node": "^20.4.2", + "astro": "^2.8.3", + "modern-normalize": "^2.0.0", + "netlify-cli": "^15.9.0", + "preact": "^10.16.0", + "sass": "^1.63.6", + "stylelint": "^15.10.1", + "trash-cli": "^5.0.0", + "typescript": "^5.1.6", + "xo": "^0.55.0" + }, + "prettier": "@bauke/prettier-config", + "stylelint": { + "extends": "@bauke/stylelint-config" + }, + "xo": { + "extends": "@bauke/eslint-config", + "prettier": true, + "space": true + } +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..0f4cf3f --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "esModuleInterop": true, + "jsx": "react-jsx", + "jsxImportSource": "preact", + "lib": [ + "DOM", + "ES2022" + ], + "module": "ES2022", + "moduleResolution": "Node", + "resolveJsonModule": true, + "strict": true, + "target": "ES2022" + }, + "include": [ + "source" + ] +}