diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 55c8bb9ff..e1301359c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -11,6 +11,7 @@ "TACHI_EMAIL_SECURE": "false" }, "postAttachCommand": "./dev/bootstrap.sh", + "forwardPorts": [3001, 3002], "updateRemoteUserUID": true, "containerUser": "tachi", "customizations": { diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a956cf363..406c41d25 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -66,4 +66,4 @@ jobs: - name: Deploy docs env: TACHI_HOST: ${{ secrets.TACHI_HOST }} - run: rsync --recursive --compress --delete --progress ./site/. "ci@${TACHI_HOST}:tachi-docs" + run: rsync --recursive --compress --delete --progress ./site/. "ci@${TACHI_HOST}:/srv/tachi-docs/" diff --git a/.github/workflows/homepage.yml b/.github/workflows/homepage.yml index 82ae22a46..86861ab62 100644 --- a/.github/workflows/homepage.yml +++ b/.github/workflows/homepage.yml @@ -5,7 +5,7 @@ on: branches: - "main" paths: - - "homepage/**" + - "typescript/homepage/**" - ".github/workflows/homepage.yml" workflow_dispatch: @@ -44,4 +44,4 @@ jobs: - name: Deploy env: TACHI_HOST: ${{ secrets.TACHI_HOST }} - run: rsync --recursive --compress --delete --progress ./homepage/dist/. "ci@${TACHI_HOST}:tachi" + run: rsync --recursive --compress --delete --progress ./typescript/homepage/dist/. "ci@${TACHI_HOST}:/srv/tachi-static/homepage/" diff --git a/Justfile-apps b/Justfile-apps index 081487205..f7ab070bc 100644 --- a/Justfile-apps +++ b/Justfile-apps @@ -43,3 +43,6 @@ client: seeds-webui: cd typescript/seeds-webui && bun vite + +homepage: + cd typescript/homepage && bun vite diff --git a/bun.lock b/bun.lock index bc8a79ca5..52950dd7a 100644 --- a/bun.lock +++ b/bun.lock @@ -268,6 +268,15 @@ "typescript": "catalog:", }, }, + "typescript/homepage": { + "name": "tachi-homepage", + "version": "0.1.0", + "devDependencies": { + "eslint-config-tachi": "workspace:*", + "prettier": "catalog:", + "vite": "catalog:", + }, + }, "typescript/rg-stats": { "name": "rg-stats", "version": "1.2.1", @@ -2726,6 +2735,8 @@ "tachi-github-bot": ["tachi-github-bot@workspace:typescript/github-bot"], + "tachi-homepage": ["tachi-homepage@workspace:typescript/homepage"], + "tachi-seeds-scripts": ["tachi-seeds-scripts@workspace:typescript/seeds-scripts"], "tachi-seeds-webui": ["tachi-seeds-webui@workspace:typescript/seeds-webui"], diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 26d697881..166c34f76 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -138,6 +138,7 @@ services: - "8080:8080" # server - "3000:3000" # client - "3001:3001" # docs + - "3002:3002" # homepage - "3100:3100" # seeds - "9779:9779" # metrics volumes: diff --git a/homepage/build.mjs b/homepage/build.mjs deleted file mode 100644 index 0fcd1435d..000000000 --- a/homepage/build.mjs +++ /dev/null @@ -1,47 +0,0 @@ -import { copyFileSync, existsSync, mkdirSync, watch, writeFileSync } from "node:fs"; -import { resolve } from "node:path"; -import sass from "node-sass"; - -const sourceDirectory = resolve(".", "src"); -const outDirectory = resolve(".", "dist"); - -const styleSheetInput = resolve(sourceDirectory, "style.scss"); -const htmlInput = resolve(sourceDirectory, "index.html"); - -const styleSheetOutput = resolve(outDirectory, "style.css"); -const htmlOutput = resolve(outDirectory, "index.html"); - -const compile = () => { - console.time("Compiled site"); - if (!existsSync(outDirectory)) { - mkdirSync(outDirectory); - } - - const result = sass.renderSync({ - file: styleSheetInput, - }); - writeFileSync(styleSheetOutput, result.css); - - copyFileSync(htmlInput, htmlOutput); - - console.timeEnd("Compiled site"); -}; - -const debounce = 100; // Watch debounce time in MS -let lastCompileTime = Date.now(); -(() => { - if (process.argv.includes("--watch")) { - console.info("Enabling Watcher..."); - - watch(sourceDirectory, (event, filename) => { - if (event === "change" && Date.now() - lastCompileTime > debounce) { - console.info(`${filename} ${event}`); - - compile(); - lastCompileTime = Date.now(); - } - }); - } - - compile(); -})(); diff --git a/homepage/.gitignore b/typescript/homepage/.gitignore similarity index 58% rename from homepage/.gitignore rename to typescript/homepage/.gitignore index 00fb7299b..a1bc2d339 100644 --- a/homepage/.gitignore +++ b/typescript/homepage/.gitignore @@ -5,6 +5,5 @@ # Node Specific node_modules -# Built file -dist/index.html -dist/style.css \ No newline at end of file +# Vite build output +dist/ diff --git a/homepage/README.md b/typescript/homepage/README.md similarity index 100% rename from homepage/README.md rename to typescript/homepage/README.md diff --git a/homepage/eslint.config.mjs b/typescript/homepage/eslint.config.mjs similarity index 100% rename from homepage/eslint.config.mjs rename to typescript/homepage/eslint.config.mjs diff --git a/homepage/package.json b/typescript/homepage/package.json similarity index 64% rename from homepage/package.json rename to typescript/homepage/package.json index 4351b9084..238d191c9 100644 --- a/homepage/package.json +++ b/typescript/homepage/package.json @@ -3,18 +3,17 @@ "version": "0.1.0", "description": "", "scripts": { - "build": "node build.mjs", + "build": "vite build", + "typecheck": "tsgo --noEmit", "lint": "eslint .", - "lint-fix": "eslint . --fix", - "watch": "node build.mjs --watch" + "lint-fix": "eslint . --fix" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { "eslint-config-tachi": "workspace:*", - "node-sass": "catalog:", - "prettier": "catalog:" + "vite": "catalog:" }, "engines": { "bun": ">=1.2.0" diff --git a/homepage/src/index.html b/typescript/homepage/src/index.html similarity index 100% rename from homepage/src/index.html rename to typescript/homepage/src/index.html diff --git a/homepage/dist/android-chrome-192x192.png b/typescript/homepage/src/public/android-chrome-192x192.png similarity index 100% rename from homepage/dist/android-chrome-192x192.png rename to typescript/homepage/src/public/android-chrome-192x192.png diff --git a/homepage/dist/android-chrome-512x512.png b/typescript/homepage/src/public/android-chrome-512x512.png similarity index 100% rename from homepage/dist/android-chrome-512x512.png rename to typescript/homepage/src/public/android-chrome-512x512.png diff --git a/homepage/dist/apple-touch-icon.png b/typescript/homepage/src/public/apple-touch-icon.png similarity index 100% rename from homepage/dist/apple-touch-icon.png rename to typescript/homepage/src/public/apple-touch-icon.png diff --git a/homepage/dist/favicon-16x16.png b/typescript/homepage/src/public/favicon-16x16.png similarity index 100% rename from homepage/dist/favicon-16x16.png rename to typescript/homepage/src/public/favicon-16x16.png diff --git a/homepage/dist/favicon-32x32.png b/typescript/homepage/src/public/favicon-32x32.png similarity index 100% rename from homepage/dist/favicon-32x32.png rename to typescript/homepage/src/public/favicon-32x32.png diff --git a/homepage/dist/favicon.ico b/typescript/homepage/src/public/favicon.ico similarity index 100% rename from homepage/dist/favicon.ico rename to typescript/homepage/src/public/favicon.ico diff --git a/homepage/dist/logo.png b/typescript/homepage/src/public/logo.png similarity index 100% rename from homepage/dist/logo.png rename to typescript/homepage/src/public/logo.png diff --git a/homepage/dist/site.webmanifest b/typescript/homepage/src/public/site.webmanifest similarity index 100% rename from homepage/dist/site.webmanifest rename to typescript/homepage/src/public/site.webmanifest diff --git a/homepage/src/style.scss b/typescript/homepage/src/style.css similarity index 81% rename from homepage/src/style.scss rename to typescript/homepage/src/style.css index d968e5889..991839c8d 100644 --- a/homepage/src/style.scss +++ b/typescript/homepage/src/style.css @@ -1,8 +1,8 @@ @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap"); * { - // This makes sizing make so much more sense to me - // The only downside I see is margins dont "collapse" into each-other + /* This makes sizing make so much more sense to me */ + /* The only downside I see is margins dont "collapse" into each-other */ box-sizing: border-box; } @@ -10,22 +10,22 @@ h1, h2, p, ul { - // Funky behaviour relating to box-sizing: border-box. - // Remove margin-top from elements to prevent them from "double spacing" each-other + /* Funky behaviour relating to box-sizing: border-box. */ + /* Remove margin-top from elements to prevent them from "double spacing" each-other */ margin-top: unset; } html { - // We could do theme switching but ¯\_(ツ)_/¯ - // We'd need to do an filter: invert() on the main logo png in light mode (or have a black-logo.png) + /* We could do theme switching but ¯\_(ツ)_/¯ */ + /* We'd need to do an filter: invert() on the main logo png in light mode (or have a black-logo.png) */ --background-colour: #131313; --body-colour: #f7f7f7; --bokutachi-colour: #527acc; --kamaitachi-colour: #e61c6e; - // This really only exists to stop me from making uneven spacing - // Crazy how consistent spacing makes a site feel 100x more professional - // There are smarter ways to do this but this works great for this set size + /* This really only exists to stop me from making uneven spacing */ + /* Crazy how consistent spacing makes a site feel 100x more professional */ + /* There are smarter ways to do this but this works great for this set size */ --curviness: 4px; --sm-padding: calc(var(--curviness) * 2) calc(var(--curviness) * 3); --md-padding: calc(var(--curviness) * 4) calc(var(--curviness) * 6); diff --git a/typescript/homepage/vite.config.mjs b/typescript/homepage/vite.config.mjs new file mode 100644 index 000000000..f24f13f5f --- /dev/null +++ b/typescript/homepage/vite.config.mjs @@ -0,0 +1,12 @@ +import { defineConfig } from "vite"; + +export default defineConfig({ + build: { + emptyOutDir: true, + outDir: "../dist", + }, + root: "src", + server: { + port: 3002, + }, +});