From fa71d542b96045d89509fa6519970c6cd32632e4 Mon Sep 17 00:00:00 2001 From: Lars Hampe Date: Sat, 28 Sep 2024 14:28:51 +0200 Subject: [PATCH] feat(website): add website placeholder and ci --- .gitea/workflows/main.yaml | 5 ++- apps/.gitkeep | 0 apps/website/.gitignore | 21 +++++++++++++ apps/website/.vscode/extensions.json | 4 +++ apps/website/.vscode/launch.json | 11 +++++++ apps/website/README.md | 1 + apps/website/astro.config.mjs | 27 ++++++++++++++++ apps/website/package.json | 19 ++++++++++++ apps/website/public/favicon.svg | 3 ++ apps/website/src/assets/boring.tools.svg | 3 ++ apps/website/src/content/config.ts | 6 ++++ .../content/docs/guides/getting-started.md | 9 ++++++ apps/website/src/content/docs/index.mdx | 13 ++++++++ apps/website/src/env.d.ts | 2 ++ apps/website/tsconfig.json | 3 ++ ci/docker/website/Dockerfile | 4 +++ ci/docker/website/nginx.conf | 31 +++++++++++++++++++ package.json | 5 ++- 18 files changed, 165 insertions(+), 2 deletions(-) delete mode 100644 apps/.gitkeep create mode 100644 apps/website/.gitignore create mode 100644 apps/website/.vscode/extensions.json create mode 100644 apps/website/.vscode/launch.json create mode 100644 apps/website/README.md create mode 100644 apps/website/astro.config.mjs create mode 100644 apps/website/package.json create mode 100644 apps/website/public/favicon.svg create mode 100644 apps/website/src/assets/boring.tools.svg create mode 100644 apps/website/src/content/config.ts create mode 100644 apps/website/src/content/docs/guides/getting-started.md create mode 100644 apps/website/src/content/docs/index.mdx create mode 100644 apps/website/src/env.d.ts create mode 100644 apps/website/tsconfig.json create mode 100644 ci/docker/website/Dockerfile create mode 100644 ci/docker/website/nginx.conf diff --git a/.gitea/workflows/main.yaml b/.gitea/workflows/main.yaml index c02243c..fb467e8 100644 --- a/.gitea/workflows/main.yaml +++ b/.gitea/workflows/main.yaml @@ -33,4 +33,7 @@ jobs: with: registry: git.hashdot.co username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASSWORD }} \ No newline at end of file + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and Push Website + uses: bun docker:website \ No newline at end of file diff --git a/apps/.gitkeep b/apps/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/apps/website/.gitignore b/apps/website/.gitignore new file mode 100644 index 0000000..6240da8 --- /dev/null +++ b/apps/website/.gitignore @@ -0,0 +1,21 @@ +# build output +dist/ +# generated types +.astro/ + +# dependencies +node_modules/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store diff --git a/apps/website/.vscode/extensions.json b/apps/website/.vscode/extensions.json new file mode 100644 index 0000000..22a1505 --- /dev/null +++ b/apps/website/.vscode/extensions.json @@ -0,0 +1,4 @@ +{ + "recommendations": ["astro-build.astro-vscode"], + "unwantedRecommendations": [] +} diff --git a/apps/website/.vscode/launch.json b/apps/website/.vscode/launch.json new file mode 100644 index 0000000..d642209 --- /dev/null +++ b/apps/website/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "command": "./node_modules/.bin/astro dev", + "name": "Development server", + "request": "launch", + "type": "node-terminal" + } + ] +} diff --git a/apps/website/README.md b/apps/website/README.md new file mode 100644 index 0000000..ad9d066 --- /dev/null +++ b/apps/website/README.md @@ -0,0 +1 @@ +# boring.tools - Website \ No newline at end of file diff --git a/apps/website/astro.config.mjs b/apps/website/astro.config.mjs new file mode 100644 index 0000000..a841613 --- /dev/null +++ b/apps/website/astro.config.mjs @@ -0,0 +1,27 @@ +import starlight from '@astrojs/starlight' +// @ts-check +import { defineConfig } from 'astro/config' + +// https://astro.build/config +export default defineConfig({ + outDir: '../../build/website', + integrations: [ + starlight({ + title: 'boring.tools', + social: { + github: 'https://github.com/boring-tools/boring.tools', + }, + favicon: '/public/favicon.svg', + sidebar: [ + { + label: 'Guides', + items: [{ label: 'Getting started', slug: 'guides/getting-started' }], + }, + // { + // label: 'Reference', + // autogenerate: { directory: 'reference' }, + // }, + ], + }), + ], +}) diff --git a/apps/website/package.json b/apps/website/package.json new file mode 100644 index 0000000..60a689b --- /dev/null +++ b/apps/website/package.json @@ -0,0 +1,19 @@ +{ + "name": "website", + "type": "module", + "version": "0.0.1", + "scripts": { + "dev": "astro dev", + "start": "astro dev", + "build": "astro check && astro build", + "preview": "astro preview", + "astro": "astro" + }, + "dependencies": { + "@astrojs/starlight": "^0.28.2", + "astro": "^4.15.3", + "sharp": "^0.32.5", + "@astrojs/check": "^0.9.3", + "typescript": "^5.6.2" + } +} diff --git a/apps/website/public/favicon.svg b/apps/website/public/favicon.svg new file mode 100644 index 0000000..e1ffddf --- /dev/null +++ b/apps/website/public/favicon.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/website/src/assets/boring.tools.svg b/apps/website/src/assets/boring.tools.svg new file mode 100644 index 0000000..9149480 --- /dev/null +++ b/apps/website/src/assets/boring.tools.svg @@ -0,0 +1,3 @@ + + + diff --git a/apps/website/src/content/config.ts b/apps/website/src/content/config.ts new file mode 100644 index 0000000..90ad769 --- /dev/null +++ b/apps/website/src/content/config.ts @@ -0,0 +1,6 @@ +import { defineCollection } from 'astro:content' +import { docsSchema } from '@astrojs/starlight/schema' + +export const collections = { + docs: defineCollection({ schema: docsSchema() }), +} diff --git a/apps/website/src/content/docs/guides/getting-started.md b/apps/website/src/content/docs/guides/getting-started.md new file mode 100644 index 0000000..dbb8aab --- /dev/null +++ b/apps/website/src/content/docs/guides/getting-started.md @@ -0,0 +1,9 @@ +--- +title: Getting started +description: A guide to start with boring tools +--- + +Thanks for stopping by. Unfortunately there's not much going on here at the moment. But the first tool is already in the starting blocks and will be here soon. There will also be more information about the whole project here. + +So check back soon. + diff --git a/apps/website/src/content/docs/index.mdx b/apps/website/src/content/docs/index.mdx new file mode 100644 index 0000000..852deed --- /dev/null +++ b/apps/website/src/content/docs/index.mdx @@ -0,0 +1,13 @@ +--- +title: boring.tools +description: Your tools for the boring stuff +template: splash +hero: + tagline: Your tools for the boring stuff +# image: +# file: ../../assets/boring.tools.svg + actions: + - text: Getting started + link: /guides/getting-started/ + icon: right-arrow +--- diff --git a/apps/website/src/env.d.ts b/apps/website/src/env.d.ts new file mode 100644 index 0000000..acef35f --- /dev/null +++ b/apps/website/src/env.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/apps/website/tsconfig.json b/apps/website/tsconfig.json new file mode 100644 index 0000000..77da9dd --- /dev/null +++ b/apps/website/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "astro/tsconfigs/strict" +} \ No newline at end of file diff --git a/ci/docker/website/Dockerfile b/ci/docker/website/Dockerfile new file mode 100644 index 0000000..4f0d58f --- /dev/null +++ b/ci/docker/website/Dockerfile @@ -0,0 +1,4 @@ +FROM nginx:alpine AS runtime +COPY ./ci/docker/website/nginx.conf /etc/nginx/nginx.conf +COPY ./build/website /usr/share/nginx/html +EXPOSE 80 \ No newline at end of file diff --git a/ci/docker/website/nginx.conf b/ci/docker/website/nginx.conf new file mode 100644 index 0000000..7eb11e5 --- /dev/null +++ b/ci/docker/website/nginx.conf @@ -0,0 +1,31 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + server { + listen 80; + server_name _; + + root /usr/share/nginx/html; + index index.html index.htm; + include /etc/nginx/mime.types; + + gzip on; + gzip_min_length 1000; + gzip_proxied expired no-cache no-store private auth; + gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; + + error_page 404 /404.html; + location = /404.html { + root /usr/share/nginx/html; + internal; + } + + location / { + try_files $uri $uri/index.html =404; + } + } +} \ No newline at end of file diff --git a/package.json b/package.json index dee45fc..365a74c 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,10 @@ "check:apps": "bunx biome check --write --config-path ./biome.json ./apps", "check:packages": "bunx biome check --write --config-path ./biome.json ./packages", "dev": "bun --filter '*' dev", - "build": "bun --filter '*' build" + "build": "bun --filter '*' build", + "docker:website:build": "docker build -t git.hashdot.co/boring.tools/boring.tools/website -f ci/docker/website/Dockerfile .", + "docker:website:push": "docker push git.hashdot.co/boring.tools/boring.tools/website", + "docker:website": "bun docker:website:build && bun docker:website:push" }, "packageManager": "bun@1.1.29", "workspaces": [