Skip to content

Commit

Permalink
Use custom loader for markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
max-lt committed Feb 19, 2024
1 parent 91ea3d7 commit 204a323
Show file tree
Hide file tree
Showing 35 changed files with 2,978 additions and 3,692 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ jobs:

# Copy index.html to 404.html to make sure that GitHub Pages will serve the app when a route is not found
- name: Copy index.html to 404.html
run: cp dist/app/browser/index.html dist/app/browser/404.html
run: cp dist/browser/index.html dist/browser/404.html

- name: Upload pages artifact
uses: actions/upload-pages-artifact@v1
with:
path: dist/app/browser
path: dist/browser

deploy:
name: Deploy
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.formatOnSave": true,
"cSpell.words": ["Microtask", "Rehype", "roadmap"],
"cSpell.words": ["Microtask", "postbuild", "Rehype", "roadmap"],
"files.associations": {
"styles.scss": "tailwindcss"
},
Expand Down
95 changes: 19 additions & 76 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,17 @@
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"outputPath": "dist/app/browser",
"customWebpackConfig": {
"path": "./webpack/webpack.extra.config.js"
},
"outputPath": "dist/browser",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets",
{
"glob": "**/*",
"input": "docs",
"output": "./static/docs"
}
],
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.css", "node_modules/highlight.js/styles/github.css"],
"scripts": []
},
Expand Down Expand Up @@ -92,7 +87,7 @@
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"builder": "@angular-builders/custom-webpack:dev-server",
"configurations": {
"production": {
"buildTarget": "app:build:production"
Expand All @@ -104,78 +99,26 @@
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"builder": "@angular-builders/custom-webpack:extract-i18n",
"options": {
"buildTarget": "app:build"
}
},
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/app/server",
"main": "server.ts",
"tsConfig": "tsconfig.server.json"
},
"configurations": {
"production": {
"outputHashing": "media",
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
},
"development": {
"optimization": false,
"sourceMap": true,
"extractLicenses": false,
"vendorChunk": true,
"buildOptimizer": false
}
},
"defaultConfiguration": "production"
},
"serve-ssr": {
"builder": "@angular-devkit/build-angular:ssr-dev-server",
"configurations": {
"development": {
"browserTarget": "app:build:development",
"serverTarget": "app:server:development"
},
"production": {
"browserTarget": "app:build:production",
"serverTarget": "app:server:production"
}
},
"defaultConfiguration": "development"
},
"prerender": {
"builder": "@angular-devkit/build-angular:prerender",
"builder": "@angular-builders/custom-webpack:server",
"options": {
"routes": [
"/",
"/docs",
"/docs/roadmap",
"/docs/runtime",
"/docs/examples/poll",
"/docs/examples/telegram",
"/docs/examples/qr-code",
"/docs/packages/redis-fetch",
"/docs/packages/redis-fetch-server"
]
},
"configurations": {
"production": {
"browserTarget": "app:build:production",
"serverTarget": "app:server:production"
"customWebpackConfig": {
"path": "./webpack/webpack.extra.config.js"
},
"development": {
"browserTarget": "app:build:development",
"serverTarget": "app:server:development"
"sourceMap": true,
"outputPath": "dist/server",
"tsConfig": "tsconfig.prerender.json",
"main": "prerender.ts",
"optimization": {
"styles": false,
"scripts": true
}
},
"defaultConfiguration": "production"
}
}
}
}
Expand Down
62 changes: 0 additions & 62 deletions docs/meta.json

This file was deleted.

91 changes: 91 additions & 0 deletions docs/meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/**
* Wrapper for markdown modules to decode base64 content.
*/
function md(loader: () => Promise<IMarkdownModule>): () => Promise<IMarkdownModule> {
return () =>
loader().then((module) => {
const { toc, metadata, parsed: base64 } = module;

const parsed = atob(base64);

return {
metadata,
parsed,
toc
};
});
}

export const docsConfig: IMarkdownMeta[] = [
{
name: 'Introduction',
path: 'index',
load: md(() => import('./index.md'))
},
{
name: 'Roadmap',
path: 'roadmap',
load: md(() => import('./roadmap.md'))
},
{
name: 'Runtime',
path: 'runtime',
load: md(() => import('./runtime.md'))
},
{
name: 'ChatGPT example prompt',
path: 'chat-gpt-prompt',
load: md(() => import('./chat-gpt-prompt.md'))
},
{
name: 'Examples',
path: 'examples',
children: [
{
name: 'Poll App',
path: 'poll',
load: md(() => import('./examples/poll.md'))
},
{
name: 'Telegram Bot',
path: 'telegram',
load: md(() => import('./examples/telegram.md'))
},
{
name: 'QR Code Generator',
path: 'qr-code',
load: md(() => import('./examples/qr-code.md'))
},
{
name: 'S3 Proxy',
path: 's3-proxy',
load: md(() => import('./examples/s3-proxy.md'))
},
{
name: 'S3 Proxy with AWSv4',
path: 's3-proxy-aws-v4',
load: md(() => import('./examples/s3-proxy-aws-v4.md'))
}
]
},
{
name: 'Packages',
path: 'packages',
children: [
{
external: true,
name: 'redis-fetch',
path: 'redis-fetch',
ghSource: 'https://github.com/openworkers/redis-fetch/blob/main/README.md',
load: md(() => import('https://raw.githubusercontent.com/openworkers/redis-fetch/main/README.md'))
},
{
external: true,
name: 'redis-fetch-server',
path: 'redis-fetch-server',
ghSource: 'https://github.com/openworkers/redis-fetch-server/blob/main/README.md',
load: md(() => import('https://raw.githubusercontent.com/openworkers/redis-fetch-server/main/README.md'))
}
]
}
];
Loading

0 comments on commit 204a323

Please sign in to comment.