-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moves ADRs into project and adds ADR's pages
This commit moves the ADR folder into the project, so that the project can dynamically create pages for them. New ADRs still can be added just as they were added before: by creating markdown files inside the ADR folder. The project automatically renders HTML pages for the ADRs and: - The sidebar automatically creates buttons for each ADR; - Mermaid plugin was added to display diagrams inside ADRs; Signed-off-by: Rodrigo Pinto <[email protected]>
- Loading branch information
1 parent
24a800f
commit af15ae5
Showing
36 changed files
with
660 additions
and
28 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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
!examples/*/scripts/ | ||
*.log | ||
*.tsbuildinfo | ||
.DS_Store | ||
.browser_modules/ | ||
/.venv/ | ||
/packages/base/lib/ | ||
|
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
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,4 +1,5 @@ | ||
.DS_Store | ||
adr | ||
node_modules | ||
/build | ||
/.svelte-kit | ||
|
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
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,14 @@ | ||
import remarkMermaid from '@ysuzuki19/remark-mermaid'; | ||
|
||
const config = { | ||
extensions: ['.svelte.md', '.md', '.svx'], | ||
|
||
smartypants: { | ||
dashes: 'oldschool' | ||
}, | ||
|
||
remarkPlugins: [remarkMermaid], | ||
rehypePlugins: [] | ||
}; | ||
|
||
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
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
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 @@ | ||
const allAdrFiles = import.meta.glob('/adr/*.md'); | ||
const iterableAdrFiles = Object.entries(allAdrFiles); | ||
|
||
export const getAdrsContent = async () => { | ||
const allAdrs = await Promise.all( | ||
iterableAdrFiles.map(async ([path, resolver]) => { | ||
const element = await resolver(); | ||
const metadata = element.metadata; | ||
const content = element.default.render(); | ||
const slug = path.slice(0, -3).split('/').pop(); | ||
|
||
return { | ||
metadata, | ||
slug, | ||
path, | ||
content | ||
}; | ||
}) | ||
); | ||
|
||
return allAdrs; | ||
}; | ||
|
||
export const getAdr = async (slug) => { | ||
const adr = iterableAdrFiles?.filter(([path]) => { | ||
const fileSlug = path.slice(0, -3).split('/').pop(); | ||
|
||
return fileSlug === slug; | ||
}); | ||
|
||
if (adr.length > 0) { | ||
const resolver = adr[0][1]; | ||
const element = await resolver(); | ||
console.log('resolver', element); | ||
// const content = element.default.render() | ||
|
||
// return content | ||
} | ||
|
||
return adr; | ||
}; | ||
|
||
export const getOneAdr = async (slug) => { | ||
const allAdrs = await Promise.all( | ||
iterableAdrFiles.map(async ([path, resolver]) => { | ||
const fileSlug = path.slice(0, -3).split('/').pop(); | ||
let content = 'empty'; | ||
if (fileSlug === slug) { | ||
console.log('equal', slug, path, resolver); | ||
const element = await resolver(); | ||
content = element.default.render(); | ||
} | ||
|
||
return { | ||
content | ||
}; | ||
}) | ||
); | ||
|
||
console.log('all adrs', allAdrs); | ||
return allAdrs; | ||
}; |
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,7 @@ | ||
import { getAdrsContent } from '$lib/process-files'; | ||
|
||
export async function load() { | ||
const adrs = await getAdrsContent(); | ||
|
||
return { adrs }; | ||
} |
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
Oops, something went wrong.