Compare commits

..

No commits in common. "b8e77b2a5413042b31c92904f01e4c51c55d06b0" and "87184c431d38b80969ae5fbfcbfb52977bb8dac3" have entirely different histories.

27 changed files with 688 additions and 1804 deletions

View File

@ -1,5 +0,0 @@
.astro
.gitea
.DS_Store
node_modules
dist

5
.env
View File

@ -1,3 +1,2 @@
DOMAIN="martials.no"
GIT_URL=https://git.$DOMAIN
STATUS_URL="https://status.$DOMAIN/status/home"
GIT_URL="https://git.martials.no"
STATUS_URL="https://status.martials.no/status/home"

View File

@ -0,0 +1,40 @@
name: Build and deploy website
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install dependencies
run: echo y | npm exec -- pnpm install
- name: Build
run: npm exec -- pnpm build
- name: Upload artifacts
uses: actions/upload-artifact@v3 # Deprecated and v4+ is not supported for GHES
with:
name: dist
path: dist
deploy:
runs-on: host
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Move files to server
run: |
rm -rf /var/www/beta.martials.no/*
cp -r dist/* /var/www/beta.martials.no

View File

@ -1,19 +0,0 @@
name: Build and deploy website
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: host
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Run docker-compose
run: docker compose up -d --build

View File

@ -1,26 +0,0 @@
FROM node:lts-alpine AS base
WORKDIR /app
# By copying only the package.json and package-lock.json here, we ensure that the following `-deps` steps are independent of the source code.
# Therefore, the `-deps` steps will be skipped if only the source code changes.
COPY package.json pnpm-lock.yaml ./
COPY project.inlang ./project.inlang
FROM base AS prod-deps
RUN echo y | npm exec -- pnpm install --prod
FROM base AS build-deps
RUN npm exec -- pnpm install
FROM build-deps AS build
COPY . .
RUN npm exec -- pnpm run build
FROM base AS runtime
COPY --from=prod-deps /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
ENV HOST=0.0.0.0
ENV PORT=4321
EXPOSE 4321
CMD node ./dist/server/entry.mjs

View File

@ -1,14 +1,12 @@
// @ts-check
import paraglide from "@inlang/paraglide-astro"
import { defineConfig } from "astro/config"
import tailwind from "@astrojs/tailwind"
import sitemap from "@astrojs/sitemap"
import svelte from "@astrojs/svelte"
import node from "@astrojs/node"
import mdx from "@astrojs/mdx"
import icon from "astro-icon"
import { defineConfig } from "astro/config"
import { loadEnv } from "vite"
import mdx from "@astrojs/mdx"
import svelte from "@astrojs/svelte"
import icon from "astro-icon"
const { url } = process.env.URL
? loadEnv(process.env.URL, process.cwd(), "")
@ -17,24 +15,10 @@ const { url } = process.env.URL
// https://astro.build/config
export default defineConfig({
site: url,
output: "server",
// output: "server", TODO server | also required for i18n
i18n: {
defaultLocale: "nb",
locales: ["nb", "en"]
},
integrations: [
tailwind(),
sitemap(),
mdx(),
svelte(),
icon(),
paraglide({
// recommended settings
project: "./project.inlang",
outdir: "./src/paraglide" //where your files should be
})
],
adapter: node({
mode: "standalone"
})
integrations: [tailwind(), sitemap(), mdx(), svelte(), icon()]
})

View File

@ -1,8 +0,0 @@
services:
web:
restart: always
build:
context: .
dockerfile: Dockerfile
ports:
- "4321:4321"

View File

@ -18,8 +18,5 @@
"subject": "Subject",
"email": "Email",
"message": "Message",
"send": "Send",
"auto": "Auto",
"norwegian": "Norwegian",
"english": "English"
"send": "Send"
}

View File

@ -18,8 +18,5 @@
"subject": "Emne",
"email": "E-post",
"message": "Melding",
"send": "Send",
"auto": "Auto",
"norwegian": "Norsk",
"english": "Engelsk"
"send": "Send"
}

View File

@ -10,28 +10,26 @@
"astro": "astro",
"postinstall": "paraglide-js compile --project ./project.inlang --outdir ./src/paraglide",
"format": "prettier --write \"./src/**/*.{js,mjs,ts,astro,svelte,css,md,json}\"",
"watch-messages": "paraglide-js compile --watch --project ./project.inlang --outdir ./src/paraglide"
"watch-translations": "paraglide-js compile --watch --project ./project.inlang --outdir ./src/paraglide"
},
"dependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/mdx": "^3.1.8",
"@astrojs/node": "^8.3.4",
"@astrojs/sitemap": "^3.2.0",
"@astrojs/svelte": "^5.7.2",
"@astrojs/tailwind": "^5.1.2",
"@iconify-json/pajamas": "^1.2.3",
"@inlang/paraglide-astro": "^0.2.2",
"@inlang/paraglide-js": "1.11.2",
"@astrojs/check": "^0.9.3",
"@astrojs/mdx": "^3.1.7",
"@astrojs/sitemap": "^3.1.6",
"@astrojs/svelte": "^5.7.1",
"@astrojs/tailwind": "^5.1.1",
"@iconify-json/pajamas": "^1.2.2",
"@tailwindcss/typography": "^0.5.15",
"astro": "^4.16.2",
"astro": "^4.15.9",
"astro-icon": "^1.1.1",
"sharp": "^0.33.5",
"svelte": "^4.2.19",
"tailwindcss": "^3.4.13",
"typescript": "^5.6.3"
"typescript": "^5.6.2"
},
"devDependencies": {
"daisyui": "^4.12.13",
"@inlang/paraglide-js": "1.11.2",
"daisyui": "^4.12.10",
"prettier": "^3.3.3",
"prettier-plugin-astro": "^0.14.1",
"prettier-plugin-svelte": "^3.2.7",

2165
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +0,0 @@
Contact: mailto:security@martials.no
Expires: 2029-12-31T23:00:00.000Z
Preferred-Languages: no,en
Canonical: https://martials.no/.well-known/security.txt

View File

@ -1,21 +1,18 @@
---
import GiteaLink from "./links/GiteaLink.astro"
import PajamasIcon from "./icons/PajamasIcon.astro"
import ExternalLink from "./links/ExternalLink.astro"
import LanguageButtonGroup from "./LanguageButtonGroup.astro"
import PajamasIcon from "./icons/PajamasIcon.astro"
import * as m from "@/paraglide/messages"
const { GIT_URL, STATUS_URL } = import.meta.env
const gitUrl = import.meta.env.GIT_URL
const statusUrl = import.meta.env.STATUS_URL
---
<div class="divider" />
<div class="py-5 flex flex-row gap-1 justify-around w-full items-center">
<div>
<GiteaLink href={`${GIT_URL}/martials/martials.no`} />
<ExternalLink href={STATUS_URL} class="flex items-center" title="Status">
<PajamasIcon name="pajamas:status-health" class="w-6 h-6 mr-2" />
{m.status()}
</ExternalLink>
</div>
<LanguageButtonGroup />
<div class="divider"></div>
<div class="mx-auto py-5 flex flex-col gap-1 items-center">
<GiteaLink href={`${gitUrl}/martials/martials.no`} />
<ExternalLink href={statusUrl} class="flex items-center" title="Status">
<PajamasIcon name="pajamas:status-health" class="w-6 h-6 mr-2" />
{m.status()}
</ExternalLink>
</div>

View File

@ -1,11 +0,0 @@
---
import LocaleLink from "./links/LocaleLink.astro"
import { type NavLink, resolvePathname } from "@/utils/linking"
const currentPath = resolvePathname(Astro.url.pathname)
---
<div class="join">
<LocaleLink to={currentPath as NavLink} lang="nb" class="btn join-item">Norsk</LocaleLink>
<LocaleLink to={currentPath as NavLink} lang="en" class="btn join-item">English</LocaleLink>
</div>

View File

@ -1,14 +1,13 @@
---
import LocaleLink from "./links/LocaleLink.astro"
import Links from "@/links"
import Links from "../links"
---
<div class="flex justify-end">
{
Links.map(({ to, label }) => (
<LocaleLink to={to} class="m-2 hover:underline">
{label()}
</LocaleLink>
<a href={to} class="m-2 hover:underline">
{label}
</a>
))
}
</div>

View File

@ -1,16 +0,0 @@
---
import { languageTag, type AvailableLanguageTag } from "@/paraglide/runtime"
import { localizePathname, type NavLink } from "@/utils/linking"
import type { ComponentProps } from "@/types/props"
interface Props extends ComponentProps {
to: NavLink
lang?: AvailableLanguageTag
}
const { to, class: clazz, lang = languageTag() } = Astro.props
---
<a href={localizePathname(to, lang)} class={clazz}>
<slot />
</a>

1
src/env.d.ts vendored
View File

@ -2,7 +2,6 @@
/// <reference types="astro/client" />
interface ImportMetaEnv {
readonly DOMAIN: string
readonly URL: string
readonly GIT_URL: string
readonly STATUS_URL: string

View File

@ -1,32 +1,23 @@
import * as m from "@/paraglide/messages.js"
import type { NavLink } from "@/utils/linking.ts"
import * as m from "./paraglide/messages.js"
interface Link {
label: () => string
to: NavLink
label: string
to: string
}
const Links: Link[] = [
{
label: m.home,
to: "/"
label: m.home(),
to: "/",
},
{
label: m.myProjects,
to: "/projects"
label: m.myProjects(),
to: "/project",
},
{
label: m.myLinks,
to: "/links"
label: m.contactMe(),
to: "/contact-me",
},
{
label: m.hardware,
to: "/hardware"
},
{
label: m.contactMe,
to: "/contact"
}
]
export default Links

View File

@ -1,15 +0,0 @@
import type { APIRoute } from "astro"
function getSecurityTxt(site?: URL) {
const canonical = new URL("/.well-known/security.txt", site)
return `
Contact: mailto:security@martials.no
Expires: 2029-12-31T23:00:00.000Z
Preferred-Languages: no,en
Canonical: ${canonical.href}
`
}
export const GET: APIRoute = ({ site }) => {
return new Response(getSecurityTxt(site))
}

View File

@ -2,8 +2,6 @@
import ProjectPage from "../../../components/projects/ProjectPage.astro"
import { type GetStaticPathsResult } from "astro"
export const prerender = true
export function getStaticPaths(): GetStaticPathsResult {
return [
{ params: { project: "hotelservice" } },

View File

@ -2,8 +2,6 @@
import ProjectPage from "../../components/projects/ProjectPage.astro"
import { type GetStaticPathsResult } from "astro"
export const prerender = true
export function getStaticPaths(): GetStaticPathsResult {
return [
{ params: { project: "hotelservice" } },

View File

@ -1 +0,0 @@
export type AbsolutePathname = `/${string}`

View File

@ -1,49 +0,0 @@
import type { AvailableLanguageTag } from "@/paraglide/runtime.js"
import type { AbsolutePathname } from "@/types/types.ts"
interface TranslatedPathnames {
nb: AbsolutePathname
en: `/en${string}`
}
export type NavLink = "/" | "/contact" | "/projects" | "/links" | "/hardware"
const paths: NavLink[] = [
"/",
"/contact",
"/projects",
"/links",
"/hardware"
]
/**
* Defines the localized pathnames for the site.
* The key must be used to navigate to the correct path.
* The value is the path that will be used for the given locale.
*
* @see https://inlang.com/m/iljlwzfs/paraglide-astro-i18n
*/
const pathnames: Record<AbsolutePathname, TranslatedPathnames> = {}
for (const path of paths) {
pathnames[path] = {
nb: path,
en: `/en${path}`
}
}
export function localizePathname(
pathname: NavLink,
locale: AvailableLanguageTag
) {
if (pathnames[pathname]) {
return pathnames[pathname][locale]
}
return pathname
}
export function resolvePathname(pathname: string): AbsolutePathname {
if (pathname.startsWith("/en")) {
return pathname.slice(3) as AbsolutePathname
}
return pathname as AbsolutePathname
}