generated from netsnek/jaen-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afa7f3a
commit 9263c13
Showing
333 changed files
with
60,788 additions
and
6,208 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
GATSBY_SQ_DEBUG=true | ||
GATSBY_LENS_API_URL=https://api.lens.walther.exp.univie.ac.at:8080/graphql | ||
GATSBY_ORIGIN_API_URL=https://services.photonq.org/graphql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Workflow that receives a migrationUrl via a dispatch event | ||
|
||
name: Publish | ||
|
||
# https://help.github.com/en/articles/workflow-syntax-for-github-actions#on | ||
on: | ||
# https://help.github.com/en/articles/workflow-syntax-for-github-actions | ||
repository_dispatch: | ||
types: [UPDATE_JAEN_RESOURCE] | ||
|
||
jobs: | ||
migrate: | ||
# https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idruns-on | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions# | ||
working-directory: ${{github.event.client_payload.cwd}} | ||
|
||
steps: | ||
# https://github.com/actions/checkout | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v3 | ||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepswith | ||
with: | ||
# Relative path under $GITHUB_WORKSPACE to place the repository | ||
path: '.' | ||
|
||
# https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstepsid | ||
- name: Configure GitHub Authentication 🔧 | ||
# https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstepsrun | ||
run: | | ||
# Git: set identity | ||
git config user.name "snekmin" | ||
git config user.email "[email protected]" | ||
# Git: set remote | ||
# https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/#http-based-git-access-by-an-installation | ||
git remote set-url origin "https://x-access-token:${{secrets.GITHUB_TOKEN}}@github.com/${GITHUB_REPOSITORY}.git" | ||
- name: Migrate Jaen Data 📝 | ||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions# | ||
working-directory: ${{github.event.client_payload.cwd}} | ||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsif | ||
if: ${{github.event.client_payload.migrationURL}} | ||
# https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstepsrun | ||
run: | | ||
# Create gh-pages branch without history | ||
#git checkout --orphan gh-pages | ||
git checkout main | ||
echo "${{github.event.client_payload.migrationURL}}" >> ./jaen-data/patches.txt | ||
# Git: add, commit, and push changes | ||
git add . | ||
git commit -m "jaen-publish: migrate jaen-data" || echo "Nothing to commit, working tree clean." | ||
GIT_TRACE=1 git push -f --verbose origin main | ||
build: | ||
needs: migrate | ||
uses: ./.github/workflows/deploy.yaml | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: publish | ||
|
||
on: [push] | ||
env: | ||
IMAGE_NAME: photonq-gatsby | ||
|
||
jobs: | ||
# Push image to GitHub Packages. | ||
# See also https://docs.docker.com/docker-hub/builds/ | ||
publish-container: | ||
runs-on: ubuntu-latest | ||
environment: photonq-internal | ||
env: | ||
GATSBY_ORIGIN_API_URL: ${{ vars.GATSBY_ORIGIN_API_URL }} | ||
permissions: | ||
packages: write | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Build image | ||
run: docker build . --file Dockerfile --tag $IMAGE_NAME | ||
|
||
- name: Log into registry | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Push image | ||
run: | | ||
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | ||
# Change all uppercase to lowercase | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
# Strip git ref prefix from version | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
# Strip "v" prefix from tag name | ||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | ||
# Use Docker `latest` tag convention | ||
[ "$VERSION" == "main" ] && VERSION=latest | ||
echo IMAGE_ID=$IMAGE_ID | ||
echo VERSION=$VERSION | ||
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | ||
docker push $IMAGE_ID:$VERSION | ||
# SPDX-License-Identifier: (EUPL-1.2) | ||
# Copyright © 2019-2022 snek.at |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,7 @@ node_modules | |
|
||
**/dist | ||
|
||
**/tsconfig.tsbuildinfo | ||
**/tsconfig.tsbuildinfo | ||
src/.DS_Store | ||
|
||
.vscode/tasks.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"editor.codeActionsOnSave": { | ||
// For ESLint | ||
"source.fixAll.eslint": true, | ||
// For TSLint | ||
"source.fixAll.tslint": true, | ||
// For Stylelint | ||
"source.fixAll.stylelint": true | ||
"source.fixAll.eslint": "explicit", | ||
"source.fixAll.tslint": "explicit", | ||
"source.fixAll.stylelint": "explicit" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Use a specific version of Node as the base image | ||
FROM node:18-bullseye-slim | ||
|
||
# Set the working directory in the container | ||
WORKDIR /app | ||
|
||
# Copy package.json and yarn.lock first to leverage Docker caching for dependencies | ||
COPY package.json yarn.lock ./ | ||
|
||
# Install dependencies only if package.json or yarn.lock changes | ||
RUN yarn install --frozen-lockfile | ||
|
||
# Copy the rest of the application code (e) | ||
COPY . . | ||
|
||
# Build the application | ||
RUN yarn build | ||
|
||
# Expose the port that the app will run on | ||
EXPOSE 9000 | ||
|
||
# Set the entry point for the container | ||
ENTRYPOINT ["yarn", "gatsby", "serve", "-H", "0.0.0.0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# jaen-template | ||
# jaen-template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './src/styles/global.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,56 @@ | ||
import type {GatsbyConfig} from 'gatsby' | ||
import type { GatsbyConfig } from 'gatsby'; | ||
|
||
require('dotenv').config({ | ||
path: `.env.public` | ||
}); | ||
|
||
const config: GatsbyConfig = { | ||
siteMetadata: { | ||
siteUrl: `https://www.yourdomain.tld` | ||
}, | ||
// More easily incorporate content into your pages through automatic TypeScript type generation and better GraphQL IntelliSense. | ||
// If you use VSCode you can also use the GraphQL plugin | ||
// Learn more at: https://gatsby.dev/graphql-typegen | ||
graphqlTypegen: true, | ||
flags: { | ||
DEV_SSR: true | ||
DEV_SSR: false | ||
}, | ||
jsxRuntime: 'automatic', | ||
plugins: [ | ||
`gatsby-plugin-cloudflare-pages`, | ||
{ | ||
resolve: `gatsby-plugin-jaen`, | ||
options: { | ||
snekResourceId: `0ee5d9f5-7580-4787-855f-4fc8bd89d3bf` | ||
pylonUrl: 'https://pylons.photonq.org/jaen-agent/graphql', | ||
remote: { | ||
repository: 'netsnek/fhkit.at' | ||
}, | ||
zitadel: { | ||
organizationId: '263581005107959413', | ||
clientId: '263491440007517793@services', | ||
authority: 'https://accounts.photonq.org', | ||
redirectUri: | ||
process.env.NODE_ENV === 'production' | ||
? 'https://fhkit.com' | ||
: 'https://opulent-carnival-pg7v6wp7prhr556-8000.app.github.dev', | ||
projectIds: ['263491274097563233'] | ||
}, | ||
// sentry: { | ||
// org: 'photonq', | ||
// project: 'website', | ||
// dsn: 'https://[email protected]/10' | ||
// }, | ||
googleAnalytics: { | ||
trackingIds: ['G-M58K75M9PG'] | ||
} | ||
} | ||
}, | ||
{ | ||
resolve: `gatsby-jaen-mailpress`, | ||
options: { | ||
pylonUrl: 'https://pylons.photonq.org/mailpress/graphql' | ||
} | ||
} | ||
] | ||
} | ||
}; | ||
|
||
export default config | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import { PageConfig } from '@atsnek/jaen'; | ||
import { GatsbyNode } from 'gatsby'; | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
import { buildSearchIndex } from './src/utils/search/build-search-index'; | ||
|
||
export const onCreateWebpackConfig: GatsbyNode['onCreateWebpackConfig'] = ({ | ||
actions | ||
}) => { | ||
actions.setWebpackConfig({ | ||
resolve: { | ||
alias: { | ||
'@/clients': path.resolve(__dirname, 'src/clients') | ||
} | ||
} | ||
}); | ||
}; | ||
|
||
export const onPostBuild: GatsbyNode['onPostBuild'] = async ({ | ||
graphql, | ||
reporter | ||
}) => { | ||
const result = await graphql<{ | ||
allJaenPage: { | ||
nodes: Array<{ | ||
id: string; | ||
slug: string; | ||
parentPage: { | ||
id: string; | ||
} | null; | ||
template: string | null; | ||
jaenPageMetadata: { | ||
title: string; | ||
}; | ||
jaenFields: Record<string, any> | null; | ||
pageConfig: PageConfig | null; | ||
buildPath: string; | ||
}>; | ||
}; | ||
}>(` | ||
query { | ||
allJaenPage { | ||
nodes { | ||
id | ||
slug | ||
parentPage { | ||
id | ||
} | ||
template | ||
jaenPageMetadata { | ||
title | ||
} | ||
jaenFields | ||
pageConfig | ||
buildPath | ||
} | ||
} | ||
} | ||
`); | ||
|
||
if (result.errors || !result.data) { | ||
reporter.panicOnBuild( | ||
`Error while running GraphQL query. ${result.errors}` | ||
); | ||
|
||
return; | ||
} | ||
|
||
const { allJaenPage } = result.data; | ||
|
||
await preparePagesAndBuildSearch(allJaenPage); | ||
}; | ||
|
||
async function preparePagesAndBuildSearch(allJaenPage: { | ||
nodes: Array<{ | ||
id: string; | ||
slug: string; | ||
parentPage: { | ||
id: string; | ||
} | null; | ||
template: string | null; | ||
jaenPageMetadata: { | ||
title: string; | ||
}; | ||
jaenFields: Record<string, any> | null; | ||
pageConfig: PageConfig | null; | ||
buildPath: string; | ||
}>; | ||
}) { | ||
const nodesForSearchIndex = allJaenPage.nodes.map(node => { | ||
const originPath = node.buildPath; | ||
|
||
let type = node.template; | ||
|
||
if (type && path.extname(type)) { | ||
type = path.basename(type, path.extname(type)); | ||
} | ||
|
||
return { | ||
id: node.id, | ||
path: originPath, | ||
jaenPageMetadata: node.jaenPageMetadata, | ||
jaenFields: node.jaenFields, | ||
type | ||
}; | ||
}); | ||
|
||
const searchIndex = await buildSearchIndex(nodesForSearchIndex as any); | ||
|
||
await fs.promises.writeFile( | ||
path.join('public', 'search-index.json'), | ||
JSON.stringify(searchIndex) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './src/styles/global.css'; |
Oops, something went wrong.