Skip to content

Commit

Permalink
switch all terminology from guide over to doc
Browse files Browse the repository at this point in the history
  • Loading branch information
NWylynko committed Mar 6, 2025
1 parent 118d686 commit 39673a2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions scripts/build-docs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ Authentication login documentation.`,
)

await expect(promise).rejects.toThrow(
'Guide "Login" is attempting to use ["react","python"] But its being filtered down to ["react"] in the manifest.json',
'Doc "Login" is attempting to use ["react","python"] But its being filtered down to ["react"] in the manifest.json',
)
})

Expand Down Expand Up @@ -385,7 +385,7 @@ title: Simple Test
}),
)

expect(output).toContain(`warning Guide /docs/non-existent-page not found`)
expect(output).toContain(`warning Doc /docs/non-existent-page not found`)
})

test('Validate link between two pages is valid', async () => {
Expand Down Expand Up @@ -424,7 +424,7 @@ title: Core Page
}),
)

expect(output).not.toContain(`warning Guide /docs/core-page not found`)
expect(output).not.toContain(`warning Doc /docs/core-page not found`)
})

test('Warn if link is to existent page but with invalid hash', async () => {
Expand Down Expand Up @@ -507,13 +507,13 @@ describe('Path and File Handling', () => {
{
path: './docs/manifest.json',
content: JSON.stringify({
navigation: [[{ title: 'React Guide', href: '/docs/react/conflict' }]],
navigation: [[{ title: 'React Doc', href: '/docs/react/conflict' }]],
}),
},
{
path: './docs/react/conflict.mdx',
content: `---
title: React Guide
title: React Doc
---
# This will cause a conflict because it's in a path that starts with "react"`,
Expand Down Expand Up @@ -756,7 +756,7 @@ title: Document with Warnings
)

// Check that warnings were reported
expect(output).toContain('warning Guide /docs/non-existent-document not found')
expect(output).toContain('warning Doc /docs/non-existent-document not found')
expect(output).toContain('warning sdk "invalid-sdk" in <If /> is not a valid SDK')
})
})
Expand Down
14 changes: 7 additions & 7 deletions scripts/build-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ const parseInMarkdownFile =
.use(() => (tree, vfile) => {
if (inManifest === false) {
vfile.message(
'This guide is not in the manifest.json, but will still be publicly accessible and other guides can link to it',
'This doc is not in the manifest.json, but will still be publicly accessible and other docs can link to it',
)
}

Expand Down Expand Up @@ -703,7 +703,7 @@ export const build = async (config: BuildConfig) => {
const coreVFiles = await Promise.all(
docsArray.map(async (doc) => {
const vfile = await markdownProcessor()
// Validate links between guides are valid
// Validate links between docs are valid
.use(() => (tree: Node, vfile: VFile) => {
return mdastVisit(tree, (node) => {
if (node.type !== 'link') return
Expand All @@ -717,15 +717,15 @@ export const build = async (config: BuildConfig) => {
const ignore = config.ignorePaths.some((ignoreItem) => url.startsWith(ignoreItem))
if (ignore === true) return

const guide = docsMap.get(url)
const doc = docsMap.get(url)

if (guide === undefined) {
vfile.message(`Guide ${url} not found`, node.position)
if (doc === undefined) {
vfile.message(`Doc ${url} not found`, node.position)
return
}

if (hash !== undefined) {
const hasHash = guide.headingsHashs.includes(hash)
const hasHash = doc.headingsHashs.includes(hash)

if (hasHash === false) {
vfile.message(`Hash "${hash}" not found in ${url}`, node.position)
Expand Down Expand Up @@ -759,7 +759,7 @@ export const build = async (config: BuildConfig) => {

if (available === false) {
vfile.fail(
`<If /> component is attempting to filter to sdk "${sdk}" but it is not available in the guides frontmatter ["${doc.sdk.join('", "')}"], if this is a mistake please remove it from the <If /> otherwise update the frontmatter to include "${sdk}"`,
`<If /> component is attempting to filter to sdk "${sdk}" but it is not available in the docs frontmatter ["${doc.sdk.join('", "')}"], if this is a mistake please remove it from the <If /> otherwise update the frontmatter to include "${sdk}"`,
node.position,
)
}
Expand Down

0 comments on commit 39673a2

Please sign in to comment.