()
| 204 | } |
| 205 | |
| 206 | const updateStepTitles = (): void => { |
| 207 | const meta = getMetaData(); |
| 208 | |
| 209 | const fileNames: string[] = []; |
| 210 | fs.readdirSync(getProjectPath()).forEach(fileName => { |
| 211 | if (path.extname(fileName).toLowerCase() === '.md') { |
| 212 | fileNames.push(fileName); |
| 213 | } |
| 214 | }); |
| 215 | |
| 216 | fileNames.forEach(fileName => { |
| 217 | const filePath = `${getProjectPath()}${fileName}`; |
| 218 | const frontMatter = matter.read(filePath); |
| 219 | const newStepNum = |
| 220 | meta.challengeOrder.findIndex(({ id }) => id === frontMatter.data.id) + 1; |
| 221 | const title = `Step ${newStepNum}`; |
| 222 | const dashedName = `step-${newStepNum}`; |
| 223 | const newData = { |
| 224 | ...frontMatter.data, |
| 225 | title, |
| 226 | dashedName |
| 227 | }; |
| 228 | fs.writeFileSync(filePath, matter.stringify(frontMatter.content, newData)); |
| 229 | }); |
| 230 | }; |
| 231 | |
| 232 | const updateTaskMarkdownFiles = (): void => { |
| 233 | const meta = getMetaData(); |
no test coverage detected