feat: update create challenge and challenge generator

This commit is contained in:
thomas
2024-05-27 21:38:48 +02:00
parent c8ba057fe0
commit 9bef9dbd90
3 changed files with 28 additions and 4 deletions

View File

@@ -28,15 +28,21 @@ Alternatively, you may utilize your IDE's [Nx Console extension](https://nx.dev/
The title must be a maximum of 25 characters. The title must be a maximum of 25 characters.
::: :::
- <b>challengeDifficulty</b>: The difficulty you think your challenge has. There are three difficulty levels : 🟢 easy / 🟠 medium / 🔴 hard - <b>author</b>: Your name
- <b>name</b>: name of the Nx application.
:::note :::note
It must be written in **kebab-case**. Your name should be in kebab-case. (e.g. john-doe)
::: :::
- <b>docRepository</b>: The category of your Challenge is Nx, Angular, Angular Performance, Rxjs, NgRx, Typescript, or Forms. :::note
Don't forget to update your personal information inside the file at your name.
:::
- <b>challengeDifficulty</b>: The difficulty you think your challenge has. There are three difficulty levels : 🟢 easy / 🟠 medium / 🔴 hard
- <b>docRepository</b>: The category of your Challenge is Nx, Angular, Angular Performance, Rxjs, NgRx, Typescript, Forms or Signals.
#### optional parameters #### optional parameters
- <b>challengeNumber</b>: You can specify a challenge number if a challenge is being submitted. (If empty, the number will be the next one).
- <b>directory</b>: If you want your application to be located in a specific folder inside `apps`. - <b>directory</b>: If you want your application to be located in a specific folder inside `apps`.
- <b>addTest</b>: If you want to add test configuration. - <b>addTest</b>: If you want to add test configuration.

View File

@@ -0,0 +1,3 @@
{
"name": "<%= authorName %>"
}

View File

@@ -81,6 +81,21 @@ export async function challengeGenerator(tree: Tree, options: Schema) {
category: options.category, category: options.category,
}); });
const authorFile = tree.read(
`./docs/src/content/authors/${options.author}.json`,
);
if (!authorFile) {
generateFiles(
tree,
join(__dirname, 'files', 'author'),
`./docs/src/content/authors/`,
{
tmpl: '',
authorName: options.author,
},
);
}
generateFiles( generateFiles(
tree, tree,
join(__dirname, 'files', 'docs'), join(__dirname, 'files', 'docs'),