Skip to content

Commit 0878f16

Browse files
committed
feat: generate lexicons on postinstall & log out marshalling to standard site
1 parent c5fcd2b commit 0878f16

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

modules/standard-site-sync.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { defineNuxtModule, useNuxt } from 'nuxt/kit'
2+
import * as site from '../shared/types/lexicons/site'
3+
4+
const PUBLICATION_SITE = 'https://npmx.dev'
5+
6+
export default defineNuxtModule({
7+
meta: {
8+
name: 'standard-site-sync',
9+
},
10+
setup() {
11+
const nuxt = useNuxt()
12+
if (nuxt.options._prepare) {
13+
return
14+
}
15+
nuxt.hook('content:file:afterParse', ctx => {
16+
const { content } = ctx
17+
18+
// Marshal content into site.standard.document using generated $build
19+
const document = site.standard.document.$build({
20+
site: PUBLICATION_SITE,
21+
path: content.path as string,
22+
title: content.title as string,
23+
description: (content.excerpt || content.description) as string | undefined,
24+
tags: content.tags as string[] | undefined,
25+
publishedAt: new Date(content.date as string).toISOString(),
26+
})
27+
28+
// Mock PDS push
29+
console.log('[standard-site-sync] Would push:', JSON.stringify(document, null, 2))
30+
})
31+
},
32+
})

0 commit comments

Comments
 (0)