Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"permissions": {
"allow": [
"Bash(npx tsc --noEmit)",
"Bash(npx vitest run*)",
"Bash(npx vitest typecheck *)",
"Bash(npx vitepress *)",
"Bash(npx prettier *)",
"Bash(pnpm test)"
]
}
}
57 changes: 54 additions & 3 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,22 @@
['meta', { name: 'twitter:image', content: ogImage }],
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
],
transformPageData(pageData) {
const utility = utilities.find(
(u) => `${u.category}/${u.slug}.md` === pageData.relativePath,
)
if (utility) {
pageData.lastUpdated = utility.lastModified.getTime()
pageData.filePath = utility.docsUrl

Check warning on line 44 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (24.x)

Insert `.replace(`

Check warning on line 44 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (22.x)

Insert `.replace(`

Check warning on line 44 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (22.x)

Insert `.replace(`

Check warning on line 44 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (20.x)

Insert `.replace(`

Check warning on line 44 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (20.x)

Insert `.replace(`

Check warning on line 44 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (24.x)

Insert `.replace(`
.replace(`https://github.com/${repository}/blob/${mainBranch}/`, '')

Check warning on line 45 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (24.x)

Replace `.replace(`https://github.com/${repository}/blob/${mainBranch}/`,·''` with ``https://github.com/${repository}/blob/${mainBranch}/`,⏎········'',⏎······`

Check warning on line 45 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (22.x)

Replace `.replace(`https://github.com/${repository}/blob/${mainBranch}/`,·''` with ``https://github.com/${repository}/blob/${mainBranch}/`,⏎········'',⏎······`

Check warning on line 45 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (22.x)

Replace `.replace(`https://github.com/${repository}/blob/${mainBranch}/`,·''` with ``https://github.com/${repository}/blob/${mainBranch}/`,⏎········'',⏎······`

Check warning on line 45 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (20.x)

Replace `.replace(`https://github.com/${repository}/blob/${mainBranch}/`,·''` with ``https://github.com/${repository}/blob/${mainBranch}/`,⏎········'',⏎······`

Check warning on line 45 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (20.x)

Replace `.replace(`https://github.com/${repository}/blob/${mainBranch}/`,·''` with ``https://github.com/${repository}/blob/${mainBranch}/`,⏎········'',⏎······`

Check warning on line 45 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (24.x)

Replace `.replace(`https://github.com/${repository}/blob/${mainBranch}/`,·''` with ``https://github.com/${repository}/blob/${mainBranch}/`,⏎········'',⏎······`
} else {
pageData.filePath = `docs/${pageData.relativePath}`
}
},
themeConfig: {
siteTitle: name,
editLink: {
pattern: `https://github.com/${repository}/edit/${mainBranch}/docs/:path`,
pattern: `https://github.com/${repository}/edit/${mainBranch}/:path`,
},
lastUpdatedText: 'Last Updated',
socialLinks: [
Expand All @@ -55,13 +67,21 @@
sidebar: [
{ text: 'Overview', link: '/overview' },
{ text: 'Why moving from feathers-hooks-common', link: '/why' },
{ text: 'Migrating', link: '/migrating-from-feathers-hooks-common' },
{
text: 'Migrating',
collapsed: false,
items: [
{ text: 'from feathers-hooks-common', link: '/migrating-from-feathers-hooks-common' },

Check warning on line 74 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (24.x)

Replace `·text:·'from·feathers-hooks-common',·link:·'/migrating-from-feathers-hooks-common'` with `⏎············text:·'from·feathers-hooks-common',⏎············link:·'/migrating-from-feathers-hooks-common',⏎·········`

Check warning on line 74 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (22.x)

Replace `·text:·'from·feathers-hooks-common',·link:·'/migrating-from-feathers-hooks-common'` with `⏎············text:·'from·feathers-hooks-common',⏎············link:·'/migrating-from-feathers-hooks-common',⏎·········`

Check warning on line 74 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (22.x)

Replace `·text:·'from·feathers-hooks-common',·link:·'/migrating-from-feathers-hooks-common'` with `⏎············text:·'from·feathers-hooks-common',⏎············link:·'/migrating-from-feathers-hooks-common',⏎·········`

Check warning on line 74 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (20.x)

Replace `·text:·'from·feathers-hooks-common',·link:·'/migrating-from-feathers-hooks-common'` with `⏎············text:·'from·feathers-hooks-common',⏎············link:·'/migrating-from-feathers-hooks-common',⏎·········`

Check warning on line 74 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (20.x)

Replace `·text:·'from·feathers-hooks-common',·link:·'/migrating-from-feathers-hooks-common'` with `⏎············text:·'from·feathers-hooks-common',⏎············link:·'/migrating-from-feathers-hooks-common',⏎·········`

Check warning on line 74 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (24.x)

Replace `·text:·'from·feathers-hooks-common',·link:·'/migrating-from-feathers-hooks-common'` with `⏎············text:·'from·feathers-hooks-common',⏎············link:·'/migrating-from-feathers-hooks-common',⏎·········`
{ text: 'from @feathersjs/schema', link: '/migrating-from-feathers-schema' },

Check warning on line 75 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (24.x)

Replace `·text:·'from·@feathersjs/schema',·link:·'/migrating-from-feathers-schema'` with `⏎············text:·'from·@feathersjs/schema',⏎············link:·'/migrating-from-feathers-schema',⏎·········`

Check warning on line 75 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (22.x)

Replace `·text:·'from·@feathersjs/schema',·link:·'/migrating-from-feathers-schema'` with `⏎············text:·'from·@feathersjs/schema',⏎············link:·'/migrating-from-feathers-schema',⏎·········`

Check warning on line 75 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (22.x)

Replace `·text:·'from·@feathersjs/schema',·link:·'/migrating-from-feathers-schema'` with `⏎············text:·'from·@feathersjs/schema',⏎············link:·'/migrating-from-feathers-schema',⏎·········`

Check warning on line 75 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (20.x)

Replace `·text:·'from·@feathersjs/schema',·link:·'/migrating-from-feathers-schema'` with `⏎············text:·'from·@feathersjs/schema',⏎············link:·'/migrating-from-feathers-schema',⏎·········`

Check warning on line 75 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (20.x)

Replace `·text:·'from·@feathersjs/schema',·link:·'/migrating-from-feathers-schema'` with `⏎············text:·'from·@feathersjs/schema',⏎············link:·'/migrating-from-feathers-schema',⏎·········`

Check warning on line 75 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (24.x)

Replace `·text:·'from·@feathersjs/schema',·link:·'/migrating-from-feathers-schema'` with `⏎············text:·'from·@feathersjs/schema',⏎············link:·'/migrating-from-feathers-schema',⏎·········`
{ text: 'from feathers-fletching', link: '/migrating-from-feathers-fletching' },

Check warning on line 76 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (24.x)

Replace `·text:·'from·feathers-fletching',·link:·'/migrating-from-feathers-fletching'` with `⏎············text:·'from·feathers-fletching',⏎············link:·'/migrating-from-feathers-fletching',⏎·········`

Check warning on line 76 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (22.x)

Replace `·text:·'from·feathers-fletching',·link:·'/migrating-from-feathers-fletching'` with `⏎············text:·'from·feathers-fletching',⏎············link:·'/migrating-from-feathers-fletching',⏎·········`

Check warning on line 76 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (22.x)

Replace `·text:·'from·feathers-fletching',·link:·'/migrating-from-feathers-fletching'` with `⏎············text:·'from·feathers-fletching',⏎············link:·'/migrating-from-feathers-fletching',⏎·········`

Check warning on line 76 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (20.x)

Replace `·text:·'from·feathers-fletching',·link:·'/migrating-from-feathers-fletching'` with `⏎············text:·'from·feathers-fletching',⏎············link:·'/migrating-from-feathers-fletching',⏎·········`

Check warning on line 76 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (20.x)

Replace `·text:·'from·feathers-fletching',·link:·'/migrating-from-feathers-fletching'` with `⏎············text:·'from·feathers-fletching',⏎············link:·'/migrating-from-feathers-fletching',⏎·········`

Check warning on line 76 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (24.x)

Replace `·text:·'from·feathers-fletching',·link:·'/migrating-from-feathers-fletching'` with `⏎············text:·'from·feathers-fletching',⏎············link:·'/migrating-from-feathers-fletching',⏎·········`
],
},
{
text: 'Hooks',
link: '/hooks',
collapsed: false,
items: utilities
.filter((x) => x.category === 'hooks')
.filter((x) => x.category === 'hooks' || x.hook)
.map((x) => ({
text: x.title,
link: x.path,
Expand All @@ -78,6 +98,36 @@
link: x.path,
})),
},
{
text: 'Resolvers',
link: '/resolvers',
collapsed: false,
items: [
...utilities
.filter(
(x) =>
x.category === 'resolvers' && x.frontmatter.kind !== 'helper',
)
.map((x) => ({
text: x.title,
link: x.path,
})),
{
text: 'Helpers',
collapsed: false,
items: utilities
.filter(
(x) =>
x.category === 'resolvers' &&

Check warning on line 121 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (24.x)

Delete `⏎·················`

Check warning on line 121 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (22.x)

Delete `⏎·················`

Check warning on line 121 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (22.x)

Delete `⏎·················`

Check warning on line 121 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (20.x)

Delete `⏎·················`

Check warning on line 121 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (20.x)

Delete `⏎·················`

Check warning on line 121 in docs/.vitepress/config.mts

View workflow job for this annotation

GitHub Actions / test (24.x)

Delete `⏎·················`
x.frontmatter.kind === 'helper',
)
.map((x) => ({
text: x.title,
link: x.path,
})),
},
],
},
{
text: 'Predicates',
link: '/predicates',
Expand Down Expand Up @@ -119,6 +169,7 @@
items: [
{ text: 'Hooks', link: '/hooks' },
{ text: 'Utilities', link: '/utils' },
{ text: 'Resolvers', link: '/resolvers' },
{ text: 'Predicates', link: '/predicates' },
{ text: 'Transformers', link: '/transformers' },
{ text: 'Type Guards', link: '/guards' },
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/plugins/markdownTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function MarkdownTransform(options: MarkdownTransformOptions): Plugin {
return null
}

const result = md(utility)
const result = md(utility, utilitiesList)

return result
},
Expand Down
8 changes: 6 additions & 2 deletions docs/.vitepress/plugins/utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const arr = (value: any[]) => {
return `[${val}]`
}

export default (utility: Utility) => {
export default (utility: Utility, utilities: Utility[]) => {
const code = [
`# ${utility.title}`,
`<Chip label="${utility.category}" class="mt-2 mr-2" /> [Source Code](${utility.sourceUrl}) | [Documentation](${utility.docsUrl})`,
Expand All @@ -26,7 +26,11 @@ export default (utility: Utility) => {

if (see.length > 0) {
const seeAlso = `_See also_: ${see
.map((x) => {
.map((x: string) => {
const found = utilities.find((u) => u.name === x)
if (found) {
return `[\`${x}\`](${found.path})`
}
const parts = x.split('/')
return `[\`${x}\`](/${parts.map(kebabCase).join('/')}${parts.length === 1 ? '/' : '.html'})`
})
Expand Down
1 change: 1 addition & 0 deletions docs/.vitepress/theme/components/Chip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
'bg-emerald-600 text-white': label === 'predicates',
'bg-amber-600 text-white': label === 'guards',
'bg-pink-600 text-white': label === 'transformers',
'bg-violet-600 text-white': label === 'resolvers',
}"
>
{{ label }}
Expand Down
50 changes: 50 additions & 0 deletions docs/.vitepress/theme/components/ConditionsTable.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<template>
<table class="conditions-table">
<thead>
<tr>
<th class="text-left">Condition</th>
<th class="text-left">Description</th>
</tr>
</thead>
<tbody>
<tr v-for="condition in conditions" :ref="condition.name">
<td>
<a :href="condition.path">
<code>{{ condition.name }}</code>
</a>
</td>
<td v-html="md.render(condition.description)"></td>
</tr>
</tbody>
</table>
</template>

<script setup lang="ts">
import Markdown from "markdown-it";
import { data as resolvers } from "../resolvers.data";
import { computed } from "vue";

const conditions = computed(() => {
return resolvers.filter((r) => r.frontmatter.kind === 'condition');
});

const md = new Markdown();
</script>

<style lang="scss">
table.conditions-table {
p {
margin-top: 0;
margin-bottom: 0;
}

ul {
margin-top: 8px;
margin-bottom: 8px;
}

li + li {
margin-top: 0;
}
}
</style>
63 changes: 63 additions & 0 deletions docs/.vitepress/theme/components/ResolversTable.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<template>
<table class="resolvers-table">
<thead>
<tr>
<th class="text-left">Resolver</th>
<th class="text-left">Description</th>
</tr>
</thead>
<tbody>
<tr v-for="resolver in filteredResolvers" :ref="resolver.name">
<td>
<a :href="resolver.path">
<code>{{ resolver.name }}</code>
</a>
</td>
<td v-html="md.render(resolver.description)"></td>
</tr>
</tbody>
</table>
</template>

<script setup lang="ts">
import Markdown from "markdown-it";
import { data as resolvers } from "../resolvers.data";
import { computed } from "vue";

const props = withDefaults(
defineProps<{
filter: (resolver: (typeof resolvers)[number]) => boolean;
}>(),
{
filter: undefined,
},
);

const filteredResolvers = computed(() => {
if (!props.filter) {
return resolvers;
}

return resolvers.filter(props.filter);
});

const md = new Markdown();
</script>

<style lang="scss">
table.resolvers-table {
p {
margin-top: 0;
margin-bottom: 0;
}

ul {
margin-top: 8px;
margin-bottom: 8px;
}

li + li {
margin-top: 0;
}
}
</style>
4 changes: 2 additions & 2 deletions docs/.vitepress/theme/hooks.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { discoverUtilities } from '../utilities'
export default defineLoader({
async load() {
return (await discoverUtilities()).filter(
(utility) => utility.category === 'hooks',
(utility) => utility.category === 'hooks' || utility.hook,
)
},
watch: ['src/hooks/**/*.md'],
watch: ['src/hooks/**/*.md', 'src/resolvers/**/*.md'],
})
4 changes: 4 additions & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import TransformersTable from './components/TransformersTable.vue'
import GuardsTable from './components/GuardsTable.vue'
import HooksTable from './components/HooksTable.vue'
import UtilsTable from './components/UtilsTable.vue'
import ResolversTable from './components/ResolversTable.vue'
import ConditionsTable from './components/ConditionsTable.vue'
import Chip from './components/Chip.vue'

import '../style/main.css'
Expand All @@ -27,6 +29,8 @@ export default {
app.component('GuardsTable', GuardsTable)
app.component('HooksTable', HooksTable)
app.component('UtilsTable', UtilsTable)
app.component('ResolversTable', ResolversTable)
app.component('ConditionsTable', ConditionsTable)

app.component('Chip', Chip)
},
Expand Down
11 changes: 11 additions & 0 deletions docs/.vitepress/theme/resolvers.data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineLoader } from 'vitepress'
import { discoverUtilities } from '../utilities'

export default defineLoader({
async load() {
return (await discoverUtilities()).filter(
(utility) => utility.category === 'resolvers',
)
},
watch: ['src/resolvers/**/*.md'],
})
Loading