mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-10 04:43:03 -05:00
fix(generator): fix to add latest challenge
This commit is contained in:
@@ -119,14 +119,21 @@ export async function challengeGenerator(tree: Tree, options: Schema) {
|
|||||||
const regex = new RegExp(`${challengeNumber - 1} Challenges`, 'gi');
|
const regex = new RegExp(`${challengeNumber - 1} Challenges`, 'gi');
|
||||||
const replaced = docs.replace(regex, `${challengeNumber} Challenges`);
|
const replaced = docs.replace(regex, `${challengeNumber} Challenges`);
|
||||||
|
|
||||||
tree.write('./docs/src/content/docs/index.mdx', replaced);
|
const linkRegex = new RegExp(`link: \\/challenges\\/(.*?)\n`, 'gi');
|
||||||
|
const replacedLink = replaced.replace(
|
||||||
|
linkRegex,
|
||||||
|
`link: /challenges/${options.docRepository}/${challengeNumber}-${
|
||||||
|
names(options.name).name
|
||||||
|
}/\n`
|
||||||
|
);
|
||||||
|
|
||||||
|
tree.write('./docs/src/content/docs/index.mdx', replacedLink);
|
||||||
|
|
||||||
const previousChallengeFilePath = findPreviousChallengeFilePath(
|
const previousChallengeFilePath = findPreviousChallengeFilePath(
|
||||||
tree,
|
tree,
|
||||||
`./docs/src/content/docs/challenges`,
|
`./docs/src/content/docs/challenges`,
|
||||||
String(challengeNumber - 1)
|
String(challengeNumber - 1)
|
||||||
);
|
);
|
||||||
console.log(`restul`, previousChallengeFilePath);
|
|
||||||
|
|
||||||
const previousChallenge = tree.read(previousChallengeFilePath).toString();
|
const previousChallenge = tree.read(previousChallengeFilePath).toString();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user