-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
19 changed files
with
6,010 additions
and
10,442 deletions.
There are no files selected for viewing
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,21 +1,60 @@ | ||
name: Build and deploy | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'Checkout the source code from GitHub' | ||
uses: actions/checkout@master | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Build | ||
run: npm run-script docs:build | ||
- name: Deploy | ||
if: ${{ github.ref == 'refs/heads/master' }} | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
cname: wiki.gruppe-adler.de | ||
publish_dir: ./dist | ||
name: Deploy to GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: pages | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# Build job | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Not needed if lastUpdated is not enabled | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: npm | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build | ||
run: npm run docs:build | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: docs/.vuepress/dist | ||
|
||
# Deployment job | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
needs: build | ||
runs-on: ubuntu-latest | ||
name: Deploy | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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,5 +1,5 @@ | ||
node_modules/ | ||
.vscode | ||
dist/ | ||
.temp | ||
.cache | ||
docs/.vuepress/dist/ | ||
docs/.vuepress/.temp | ||
docs/.vuepress/.cache |
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,11 @@ | ||
import { defineClientConfig } from '@vuepress/client'; | ||
|
||
export default defineClientConfig({ | ||
enhance: ({ app, router, siteData }) => { | ||
router.addRoute('/', { | ||
path: '/de/:pathMatch(.*)*', | ||
redirect: to => to.fullPath.substring('/de'.length), | ||
name: 'redirect-from-de' | ||
}); | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
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,7 +1,9 @@ | ||
import { PluginObject } from "vuepress"; | ||
import { path } from '@vuepress/utils'; | ||
import type { PluginObject } from 'vuepress'; | ||
import { path, getDirname } from '@vuepress/utils'; | ||
|
||
export default <PluginObject>{ | ||
const __dirname = getDirname(import.meta.url); | ||
|
||
export default { | ||
name: '@gruppe-adler/vuepress-plugin-redirect-from-de', | ||
clientAppEnhanceFiles: path.resolve(__dirname, './clientAppEnhance.ts'), | ||
}; | ||
clientConfigFile: path.resolve(__dirname, './client.ts') | ||
} satisfies PluginObject; |
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,35 @@ | ||
# `@gruppe-adler/vuepress-plugin-resolve-images-aliases` | ||
|
||
This plugin ensures that the `alias` options from the user config is applied to images in markdown. | ||
|
||
From the [Vuepress docs](https://v2.vuepress.vuejs.org/guide/assets.html#packages-and-path-aliases): | ||
|
||
> Although it is not a common usage, you can reference images from dependent packages: | ||
> | ||
> ```bash | ||
> npm install -D package-name | ||
> ``` | ||
> | ||
> Since markdown image syntax regards image links as relative paths by default, you need to use `<img>` tag: | ||
> | ||
> ```md | ||
> <img src="package-name/image.png" alt="Image from dependency"> | ||
> ``` | ||
> | ||
> The path aliases that set in config file are also supported: | ||
> | ||
> ```ts | ||
> import { getDirname, path } from 'vuepress/utils'; | ||
> | ||
> const __dirname = getDirname(import.meta.url); | ||
> | ||
> export default { | ||
> alias: { | ||
> '@alias': path.resolve(__dirname, './path/to/some/dir') | ||
> } | ||
> }; | ||
> ``` | ||
> | ||
> ```md | ||
> <img src="@alias/image.png" alt="Image from path alias"> | ||
> ``` |
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,36 @@ | ||
import type { PluginObject } from 'vuepress'; | ||
import { path, getDirname } from '@vuepress/utils'; | ||
import * as MarkdownIt from 'markdown-it'; | ||
|
||
const __dirname = getDirname(import.meta.url); | ||
|
||
export default { | ||
name: '@gruppe-adler/vuepress-plugin-resolve-images-aliases', | ||
extendsMarkdown: async (md: MarkdownIt, app) => { | ||
const userConfig = | ||
app.pluginApi.plugins.find(plugin => plugin.name === 'user-config') ?? | ||
({ name: 'user-config', alias: {} } as PluginObject); | ||
|
||
const aliasConfig = Object.entries( | ||
typeof userConfig.alias === 'function' ? await userConfig.alias(app, true) : userConfig.alias | ||
) as [string, string][]; | ||
|
||
md.use(instance => { | ||
const original = instance.renderer.rules.image; | ||
|
||
instance.renderer.rules.image = (tokens, idx, options, env, self) => { | ||
const token = tokens[idx]; | ||
const src = token.attrGet('src'); | ||
|
||
const aliasEntry = aliasConfig.find(([prefix]) => src.startsWith(prefix)); | ||
|
||
if (aliasEntry) { | ||
const [prefix, absPath] = aliasEntry; | ||
token.attrSet('src', src.replace(prefix, absPath)); | ||
} | ||
|
||
return original(tokens, idx, options, env, self); | ||
}; | ||
}); | ||
} | ||
} satisfies PluginObject; |
Oops, something went wrong.