From a396cbaf8873ae53e15e9f99b78e5d3e09a89755 Mon Sep 17 00:00:00 2001 From: Prozilla Date: Thu, 13 Jun 2024 22:01:01 +0200 Subject: [PATCH] Fixed custom domain deployment bug --- package.json | 4 ++-- scripts/deploy.ts | 1 - scripts/stage.ts | 8 +++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index b50ebcb..2e11aaa 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,9 @@ "repository": "https://github.com/Prozilla/ProzillaOS", "type": "module", "scripts": { - "start": "vite --port 3000 --host", + "start": "vite", "build": "tsc && vite build", - "serve": "vite preview --port 8080 --host", + "serve": "vite preview --port 8080", "stage": "tsx scripts/stage", "predeploy": "npm run build && npm run stage", "deploy": "tsx scripts/deploy", diff --git a/scripts/deploy.ts b/scripts/deploy.ts index f177f69..819b54f 100644 --- a/scripts/deploy.ts +++ b/scripts/deploy.ts @@ -10,7 +10,6 @@ function deploy() { void ghpages.publish(BUILD_DIR, { repo: REPO_URL, - cname: DOMAIN, message: COMMIT_MESSAGE }, (error) => { if (error == null) diff --git a/scripts/stage.ts b/scripts/stage.ts index 3156a32..28d297c 100644 --- a/scripts/stage.ts +++ b/scripts/stage.ts @@ -3,12 +3,13 @@ import { APP_DESCRIPTIONS, APP_NAMES, APPS } from "../src/config/apps.config"; import { ANSI } from "../src/config/apps/terminal.config"; import { NAME, TAG_LINE } from "../src/config/branding.config"; import { WALLPAPERS } from "../src/config/desktop.config"; -import { BASE_URL, BUILD_DIR } from "../src/config/deploy.config"; +import { BASE_URL, BUILD_DIR, DOMAIN } from "../src/config/deploy.config"; const PATHS = { sitemapXml: BUILD_DIR + "/sitemap.xml", robotsTxt: BUILD_DIR + "/robots.txt", indexHtml: BUILD_DIR + "/index.html", + cname: BUILD_DIR + "/CNAME", }; function generateSitemapXml() { @@ -53,6 +54,10 @@ Disallow: Sitemap: ${sitemapUrl}`; } +function generateCname() { + return DOMAIN; +} + function generateTemplate(html: string) { const baseUrlRegex = /(?<=")https?:\/\/[a-z0-9-]+(\.)([a-zA-Z0-9-]+(\.))*[a-z]{2,3}\/(?=.*")/gi; html = html.replaceAll(baseUrlRegex, BASE_URL); @@ -121,6 +126,7 @@ function stage() { const files: [string, () => string][] = [ [PATHS.sitemapXml, generateSitemapXml], [PATHS.robotsTxt, generateRobotsTxt], + [PATHS.cname, generateCname], ]; files.forEach(([path, generateContent]) => {