Skip to content

Commit

Permalink
Create subdirectory if needed
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Büchse <[email protected]>
  • Loading branch information
mbuechse committed Dec 7, 2023
1 parent a4ad6f2 commit 25db85a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions populateStds.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ lines.push('| Standard | Track | Description | Active Versions |')
lines.push('| --------- | ------ | ------------ | ---------------- |')
Object.entries(tracks).forEach((trackEntry) => {
var track = trackEntry[0]
var trackPath = `standards/${track.toLowerCase()}`
fs.mkdirSync(trackPath, { recursive: true })
var trackItem = {
type: 'category',
label: track,
Expand Down Expand Up @@ -129,10 +131,10 @@ ${trackIntros[track]}
slines.push(`| [${icon} scs-${adrId}-${obj.version}](/standards/${obj.id}) | ${obj.type} | ${obj.status || obj.state} | ${obj.stabilized_at || '-'} | ${obj.obsoleted_at || '-'} |`)
})
slines.push('') // file should end with a single newline character
fs.writeFileSync(`standards/${track.toLowerCase()}/scs-${adrId}.md`, slines.join('\n'), 'utf8')
fs.writeFileSync(`${trackPath}/scs-${adrId}.md`, slines.join('\n'), 'utf8')
})
tlines.push('') // file should end with a single newline character
fs.writeFileSync(`standards/${track.toLowerCase()}/index.md`, tlines.join('\n'), 'utf8')
fs.writeFileSync(`${trackPath}/index.md`, tlines.join('\n'), 'utf8')
})
lines.push('') // file should end with a single newline character
fs.writeFileSync(`standards/standards/overview.md`, lines.join('\n'), 'utf8')
Expand Down

0 comments on commit 25db85a

Please sign in to comment.