Compare commits

...

8 Commits

Author SHA1 Message Date
Daniël Groothuis
f605a0e732 chore(config): Fixed linting errors for CI
All checks were successful
/ deploy (push) Successful in 3s
/ build (push) Successful in 29s
/ docker-build (push) Successful in 1m11s
2025-10-31 16:45:56 +01:00
Daniël Groothuis
3900ad391d chore(config): Fixed linting errors for CI
Some checks failed
/ deploy (push) Has been skipped
/ build (push) Successful in 33s
/ docker-build (push) Failing after 1m6s
2025-10-31 16:36:30 +01:00
Daniël Groothuis
ea12b6dec6 chore(config): Fixed linting errors for CI
Some checks failed
/ build (push) Successful in 35s
/ deploy (push) Has been skipped
/ docker-build (push) Failing after 1m10s
2025-10-31 16:33:32 +01:00
Daniël Groothuis
812a836a92 chore(config): Fixed linting errors for CI
All checks were successful
/ build (push) Successful in 38s
2025-10-31 16:24:51 +01:00
Daniël Groothuis
2a9a4f980a chore(config): Fixed linting errors for CI
Some checks failed
/ build (push) Failing after 27s
2025-10-31 16:21:06 +01:00
Daniël Groothuis
9179caf200 chore(config): Fixed linting errors for CI
Some checks failed
/ build (push) Failing after 24s
2025-10-31 16:19:36 +01:00
Daniël Groothuis
05ae698cd7 chore(config): First draft CI
Some checks failed
/ build (push) Failing after 1m27s
2025-10-31 16:08:29 +01:00
Daniël Groothuis
8bb0667b18 chore(config): Added base layout definitions
Some checks failed
/ build (push) Failing after 26s
2025-10-31 16:07:19 +01:00
5 changed files with 90 additions and 93 deletions

72
.gitea/workflows/ci.yaml Normal file
View File

@@ -0,0 +1,72 @@
---
on:
push:
branches:
- main
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"
check-latest: true
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Run checks
run: npm run check
- name: Run tests
run: npm test
- name: Ensure build and bundle info
run: npx quartz build --bundleInfo
docker-build:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Login to registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: git.dgse.cloud/dgroothuis/garden:${{ gitea.sha }},git.dgse.cloud/dgroothuis/garden:latest
deploy:
needs: docker-build
runs-on: ubuntu-latest
steps:
- name: Fake Deploy
run: echo "Deploying"

View File

@@ -1,3 +1,4 @@
public public
node_modules node_modules
.quartz-cache .quartz-cache
content

View File

@@ -41,14 +41,13 @@ export const defaultContentPageLayout: PageLayout = {
title: "Browse", title: "Browse",
folderDefaultState: "collapsed", folderDefaultState: "collapsed",
mapFn: (node) => { mapFn: (node) => {
if (node.isFolder) { if (node.isFolder) {
node.displayName = "🗄️ " + node.displayName node.displayName = "🗄️ " + node.displayName
} else { } else {
node.displayName = "📄 " + node.displayName node.displayName = "📄 " + node.displayName
} }
}, },
} }),
),
], ],
right: [ right: [
Component.Graph(), Component.Graph(),
@@ -76,12 +75,12 @@ export const defaultListPageLayout: PageLayout = {
title: "Browse", title: "Browse",
folderDefaultState: "collapsed", folderDefaultState: "collapsed",
mapFn: (node) => { mapFn: (node) => {
if (node.isFolder) { if (node.isFolder) {
node.displayName = "🗄️ " + node.displayName node.displayName = "🗄️ " + node.displayName
} else { } else {
node.displayName = "📄 " + node.displayName node.displayName = "📄 " + node.displayName
} }
}, },
}), }),
], ],
right: [], right: [],

View File

@@ -1,34 +1,16 @@
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "../types" import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "../types"
import style from "../styles/listPage.scss" import style from "../styles/listPage.scss"
import { PageList, SortFn } from "../PageList" import { PageList } from "../PageList"
import { Root } from "hast" import { Root } from "hast"
import { htmlToJsx } from "../../util/jsx" import { htmlToJsx } from "../../util/jsx"
import { i18n } from "../../i18n"
import { QuartzPluginData } from "../../plugins/vfile"
import { ComponentChildren } from "preact" import { ComponentChildren } from "preact"
import { concatenateResources } from "../../util/resources" import { concatenateResources } from "../../util/resources"
import { trieFromAllFiles } from "../../util/ctx" import { trieFromAllFiles } from "../../util/ctx"
interface FolderContentOptions { export default (() => {
/**
* Whether to display number of folders
*/
showFolderCount: boolean
showSubfolders: boolean
sort?: SortFn
}
const defaultOptions: FolderContentOptions = {
showFolderCount: true,
showSubfolders: true,
}
export default ((opts?: Partial<FolderContentOptions>) => {
const options: FolderContentOptions = { ...defaultOptions, ...opts }
const FolderContent: QuartzComponent = (props: QuartzComponentProps) => { const FolderContent: QuartzComponent = (props: QuartzComponentProps) => {
const { tree, fileData, allFiles, cfg } = props const { tree, fileData, allFiles } = props
const trie = (props.ctx.trie ??= trieFromAllFiles(allFiles)) const trie = (props.ctx.trie ??= trieFromAllFiles(allFiles))
const folder = trie.findNode(fileData.slug!.split("/")) const folder = trie.findNode(fileData.slug!.split("/"))
@@ -36,65 +18,8 @@ export default ((opts?: Partial<FolderContentOptions>) => {
return null return null
} }
const allPagesInFolder: QuartzPluginData[] =
folder.children
.map((node) => {
// regular file, proceed
if (node.data) {
return node.data
}
if (node.isFolder && options.showSubfolders) {
// folders that dont have data need synthetic files
const getMostRecentDates = (): QuartzPluginData["dates"] => {
let maybeDates: QuartzPluginData["dates"] | undefined = undefined
for (const child of node.children) {
if (child.data?.dates) {
// compare all dates and assign to maybeDates if its more recent or its not set
if (!maybeDates) {
maybeDates = { ...child.data.dates }
} else {
if (child.data.dates.created > maybeDates.created) {
maybeDates.created = child.data.dates.created
}
if (child.data.dates.modified > maybeDates.modified) {
maybeDates.modified = child.data.dates.modified
}
if (child.data.dates.published > maybeDates.published) {
maybeDates.published = child.data.dates.published
}
}
}
}
return (
maybeDates ?? {
created: new Date(),
modified: new Date(),
published: new Date(),
}
)
}
return {
slug: node.slug,
dates: getMostRecentDates(),
frontmatter: {
title: node.displayName,
tags: [],
},
}
}
})
.filter((page) => page !== undefined) ?? []
const cssClasses: string[] = fileData.frontmatter?.cssclasses ?? [] const cssClasses: string[] = fileData.frontmatter?.cssclasses ?? []
const classes = cssClasses.join(" ") const classes = cssClasses.join(" ")
const listProps = {
...props,
sort: options.sort,
allFiles: allPagesInFolder,
}
const content = ( const content = (
(tree as Root).children.length === 0 (tree as Root).children.length === 0

View File

@@ -104,7 +104,7 @@ export const FolderPage: QuartzEmitterPlugin<Partial<FolderPageOptions>> = (user
const opts: FullPageLayout = { const opts: FullPageLayout = {
...sharedPageComponents, ...sharedPageComponents,
...defaultListPageLayout, ...defaultListPageLayout,
pageBody: FolderContent({ sort: userOpts?.sort }), pageBody: FolderContent(),
...userOpts, ...userOpts,
} }