Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Commit 49ba99c

Browse files
committed
chore: migrate to block renderization approach
1 parent ade8647 commit 49ba99c

File tree

2 files changed

+26
-17
lines changed

2 files changed

+26
-17
lines changed

scripts/populate-details.js

+15-8
Original file line numberDiff line numberDiff line change
@@ -54,27 +54,34 @@ const renderDetails = (check) => {
5454

5555
// Prepare the markdown files
5656
checks.forEach((check, index) => {
57-
const fileContent = `---
57+
const metadata = `---
5858
sidebar_position: ${index + 1}
5959
id: ${check.id}
6060
title: ${check.title}
6161
slug: /details/${check.code_name}
62-
---
63-
64-
## Use Case
65-
<!-- LEVELS:START -->
62+
---`.trim()
63+
const levelsContent = `
6664
- Incubating: ${check.level_incubating_status}
6765
- Active: ${check.level_active_status}
6866
- Retiring: ${check.level_retiring_status}
67+
`.trim()
68+
const descriptionContent = `## Description
69+
${check.description}`.trim()
70+
const detailsContent = renderDetails(check)
71+
72+
const fileContent = `${metadata}
73+
74+
## Use Case
75+
<!-- LEVELS:START -->
76+
${levelsContent}
6977
<!-- LEVELS:END -->
7078
7179
<!-- DESCRIPTION:START -->
72-
## Description
73-
${check.description}
80+
${descriptionContent}
7481
<!-- DESCRIPTION:END -->
7582
7683
<!-- DETAILS:START -->
77-
${renderDetails(check)}
84+
${detailsContent}
7885
<!-- DETAILS:END -->
7986
`
8087
const detination = path.join(process.cwd(), `docs/details/${check.code_name}.mdx`)

scripts/populate-implementations.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,29 @@ const addRow = (item) => `| ${item.section_number}. ${capitalizeWords(item.secti
3939

4040
// Prepare the markdown files
4141
projectStatus.forEach((status, index) => {
42-
let fileContent = `---
42+
const metadata = `---
4343
sidebar_position: ${index + 1}
4444
id: ${status}
4545
title: ${status.charAt(0).toUpperCase() + status.slice(1)}
4646
slug: /implementations/${status}
47-
---
48-
49-
<!-- LIST:START -->
50-
`
51-
52-
fileContent += implementationPriority.map(priority => {
47+
---`.trim()
48+
const listContent = implementationPriority.map(priority => {
5349
if (data[status][priority].length === 0) return ''
5450

5551
return `
5652
## ${priority.charAt(0).toUpperCase() + priority.slice(1)}
5753
${addHeader()}
5854
${data[status][priority].map(addRow).join('\n')}
59-
`
55+
`
6056
}).join('\n')
6157

62-
fileContent += '\n<!-- LIST:END -->'
58+
const fileContent = `${metadata}
59+
<!-- LIST:START -->
60+
61+
<!-- LIST:END -->
62+
${listContent}
63+
<!-- LIST:END -->
64+
`
6365

6466
const destination = path.join(process.cwd(), `docs/implementation/${status}.mdx`)
6567
writeFileSync(destination, fileContent)

0 commit comments

Comments
 (0)