Skip to content

Commit 9bef9db

Browse files
committed
feat: update create challenge and challenge generator
1 parent c8ba057 commit 9bef9db

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

docs/src/content/docs/guides/create-challenge.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,21 @@ Alternatively, you may utilize your IDE's [Nx Console extension](https://nx.dev/
2828
The title must be a maximum of 25 characters.
2929
:::
3030

31-
- <b>challengeDifficulty</b>: The difficulty you think your challenge has. There are three difficulty levels : 🟢 easy / 🟠 medium / 🔴 hard
32-
- <b>name</b>: name of the Nx application.
31+
- <b>author</b>: Your name
32+
:::note
33+
Your name should be in kebab-case. (e.g. john-doe)
34+
:::
3335
:::note
34-
It must be written in **kebab-case**.
36+
Don't forget to update your personal information inside the file at your name.
3537
:::
36-
- <b>docRepository</b>: The category of your Challenge is Nx, Angular, Angular Performance, Rxjs, NgRx, Typescript, or Forms.
38+
39+
- <b>challengeDifficulty</b>: The difficulty you think your challenge has. There are three difficulty levels : 🟢 easy / 🟠 medium / 🔴 hard
40+
41+
- <b>docRepository</b>: The category of your Challenge is Nx, Angular, Angular Performance, Rxjs, NgRx, Typescript, Forms or Signals.
3742

3843
#### optional parameters
3944

45+
- <b>challengeNumber</b>: You can specify a challenge number if a challenge is being submitted. (If empty, the number will be the next one).
4046
- <b>directory</b>: If you want your application to be located in a specific folder inside `apps`.
4147
- <b>addTest</b>: If you want to add test configuration.
4248

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "<%= authorName %>"
3+
}

libs/cli/src/generators/challenge/generator.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,21 @@ export async function challengeGenerator(tree: Tree, options: Schema) {
8181
category: options.category,
8282
});
8383

84+
const authorFile = tree.read(
85+
`./docs/src/content/authors/${options.author}.json`,
86+
);
87+
if (!authorFile) {
88+
generateFiles(
89+
tree,
90+
join(__dirname, 'files', 'author'),
91+
`./docs/src/content/authors/`,
92+
{
93+
tmpl: '',
94+
authorName: options.author,
95+
},
96+
);
97+
}
98+
8499
generateFiles(
85100
tree,
86101
join(__dirname, 'files', 'docs'),

0 commit comments

Comments
 (0)