docs(docs): writting docs

This commit is contained in:
thomas
2023-09-25 17:37:48 +02:00
parent 0d4348c46b
commit fac946ff6a
47 changed files with 89 additions and 77 deletions

View File

@@ -24,7 +24,7 @@ If you would like to propose a challenge, this project is open source, so feel f
## Challenges
Check [all 35 challenges](https://angular-challenges.vercel.app/)
Check [all 36 challenges](https://angular-challenges.vercel.app/)
## Contributors ✨

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #12</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #32</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #34</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #10</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #13</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #16</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #21</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #22</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #3</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #30</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #31</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #33</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #4</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #5</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #6</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #8</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #9</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #2</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #7</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
## Information

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
## Information

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
## Information

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #11</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #14</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #17</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #18</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #19</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #20</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #23</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #24</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #28</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #29</div>

View File

@@ -6,7 +6,7 @@ sidebar:
---
:::note
WIP
WIP: The following documentation will be reviewed and improved. However, you can still take on the challenge. If you don't understand a certain part, please feel free to reach out or create an issue.
:::
<div class="chip">Challenge #15</div>

View File

@@ -6,5 +6,24 @@ sidebar:
---
:::note
WIP:
WIP: doc in writting
:::
You have an idea you want to share, an interesting bug you struggling on in your private organization or in your side project, an Angular trick you discovered,... All those possibilities are a good start to create a challenge and share the solution with others.
But how to start creating that challenges ?
## Boilerplate Setup
To ease the process, I created a Nx generator that will create all the boilerplate for you and get you ready faster. The easiest way to run it is by using the Nx console > generate > @angular-challenges/cli - challenge
### Parameters
title: string;
challengeDifficulty: string;
docRepository: string;
name: string;
directory?: string;
addTest?: boolean;
This generator will create a new application inside the `apps` directory and a Markdown file inside the `docs` folder.

View File

@@ -23,8 +23,8 @@ hero:
import { Card, CardGrid } from '@astrojs/starlight/components';
<CardGrid>
<Card title="35 Challenges">
This repository gathers 35 Challenges related to <b>Angular</b>, <b>Nx</b>, <b>Ngrx</b>, <b>RxJS</b>, and <b>Ngrx</b>.
<Card title="36 Challenges">
This repository gathers 36 Challenges related to <b>Angular</b>, <b>Nx</b>, <b>Ngrx</b>, <b>RxJS</b>, and <b>Ngrx</b>.
These challenges resolve around real-life issues or specific features to elevate your skills.
</Card>

View File

@@ -92,3 +92,7 @@ b {
font-size: var(--sl-text-xs);
}
}
starlight-menu-button svg {
color: #1c1a1d;
}

View File

@@ -1,9 +1,9 @@
{
"generators": {
"app": {
"factory": "./src/generators/app/generator",
"schema": "./src/generators/app/schema.json",
"description": "app generator"
"challenge": {
"factory": "./src/generators/challenge/generator",
"schema": "./src/generators/challenge/schema.json",
"description": "challenge generator"
},
"readme": {
"factory": "./src/generators/readme/generator",

View File

@@ -1,10 +1,12 @@
---
title: <%= difficulty %> <%= title %>
description: Challenge <%= challengeNumber %> is about ...
sidebar:
order: <%= challengeNumber %>
---
:::note
WIP
WIP: The following documentation need to be written.
:::
<div class="chip">Challenge #<%= challengeNumber %></div>

View File

@@ -12,12 +12,12 @@ import {
updateJson,
} from '@nx/devkit';
import { Linter } from '@nx/linter';
import { readFile, writeFile } from 'fs';
import { readFile, writeFile } from 'fs/promises';
import { join } from 'path';
import { getProjectDir } from '../../utils/normalize';
import { Schema } from './schema';
export async function appGenerator(tree: Tree, options: Schema) {
export async function challengeGenerator(tree: Tree, options: Schema) {
const { appDirectory } = getProjectDir(options.name, options.directory);
const challengeNumberPath = 'challenge-number.json';
@@ -70,38 +70,24 @@ export async function appGenerator(tree: Tree, options: Schema) {
});
}
readFile('./README.md', 'utf-8', function (err, contents) {
const regex = new RegExp(`all ${challengeNumber} challenges`);
const replaced = contents.replace(
regex,
`all ${challengeNumber + 1} challenges`
);
const readme = await readFile('./README.md', { encoding: 'utf-8' });
writeFile('./README.md', replaced, 'utf-8', function (err) {
console.log(err);
});
const readmeRegex = new RegExp(`all ${challengeNumber} challenges`);
const readmeReplace = readme.replace(
readmeRegex,
`all ${challengeNumber + 1} challenges`
);
await writeFile('./README.md', readmeReplace, 'utf-8');
const docs = await readFile('./docs/src/content/docs/index.mdx', {
encoding: 'utf-8',
});
readFile(
'./docs/src/content/docs/index.mdx',
'utf-8',
function (err, contents) {
const regex = new RegExp(`${challengeNumber} Challenges`, 'gi');
const replaced = contents.replace(
regex,
`${challengeNumber + 1} Challenges`
);
const regex = new RegExp(`${challengeNumber} Challenges`, 'gi');
const replaced = docs.replace(regex, `${challengeNumber + 1} Challenges`);
writeFile(
'./docs/src/content/docs/index.mdx',
replaced,
'utf-8',
function (err) {
console.log(err);
}
);
}
);
await writeFile('./docs/src/content/docs/index.mdx', replaced, 'utf-8');
updateJson(tree, challengeNumberPath, (json) => {
json.total = json.total + 1;
@@ -111,4 +97,4 @@ export async function appGenerator(tree: Tree, options: Schema) {
await formatFiles(tree);
}
export default appGenerator;
export default challengeGenerator;

View File

@@ -1,13 +1,13 @@
{
"$schema": "http://json-schema.org/schema",
"$id": "GeneratorNxApp",
"title": "Creates an Angular application.",
"description": "Creates an Angular application.",
"$id": "GeneratorNxChallenge",
"title": "Creates the setup for a new Angular Challenge.",
"description": "Creates the boilerplate for an Angular Challenge.",
"type": "object",
"cli": "nx",
"properties": {
"name": {
"description": "The name of the application. (should be in camel case)",
"description": "The name of the application. (should be in kebab case)",
"type": "string",
"$default": {
"$source": "argv",
@@ -19,6 +19,7 @@
"title": {
"description": "Title of your challenge. (use quote to add spaces)",
"type": "string",
"maxLength": "25",
"$default": {
"$source": "argv",
"index": 1