mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-12 22:03:03 -05:00
feat(generator): modify generator to create application
This commit is contained in:
@@ -0,0 +1,39 @@
|
|||||||
|
---
|
||||||
|
title: <%= difficulty %> <%= title %>
|
||||||
|
description: Challenge <%= challengeNumber %> is about ...
|
||||||
|
---
|
||||||
|
|
||||||
|
:::note
|
||||||
|
WIP
|
||||||
|
:::
|
||||||
|
|
||||||
|
<div class="chip">Challenge #<%= challengeNumber %></div>
|
||||||
|
|
||||||
|
## Information
|
||||||
|
|
||||||
|
## Statement
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
:::note
|
||||||
|
Start the project by running: `npx nx serve <%= projectName %>`.
|
||||||
|
:::
|
||||||
|
|
||||||
|
:::tip[Reminder]
|
||||||
|
Your PR title must start with <b>Answer:<%= challengeNumber %></b>.
|
||||||
|
:::
|
||||||
|
|
||||||
|
<div class="article-footer">
|
||||||
|
<a
|
||||||
|
href="https://github.com/tomalaforge/angular-challenges/pulls?q=label%3A<%= challengeNumber %>+label%3Aanswer"
|
||||||
|
alt="<%= title %> community solutions">
|
||||||
|
❖ Community Answers
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
href='https://github.com/tomalaforge/angular-challenges/pulls?q=label%3A<%= challengeNumber %>+label%3A"answer+author"'
|
||||||
|
alt="<%= title %> solution author">
|
||||||
|
▶︎ Author Answer
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
@@ -1,32 +1,13 @@
|
|||||||
<h1><%= title %></h1>
|
# <%= title %>
|
||||||
|
|
||||||
> Author: Thomas Laforge
|
> Author: Thomas Laforge
|
||||||
|
|
||||||
<!-- TODO: add Information/Statement/Rules/Constraint/Steps -->
|
### Run Application
|
||||||
|
|
||||||
### Information
|
```bash
|
||||||
|
npx nx serve <%= projectName %>
|
||||||
|
```
|
||||||
|
|
||||||
### Statement
|
### Documentation and Instruction
|
||||||
|
|
||||||
### Step 1
|
Challenge documentation is [here](https://angular-challenges.vercel.app/challenges/<%= docRepository %>/<%= challengeNumber %>-<%= projectName %>/).
|
||||||
|
|
||||||
### Step 2
|
|
||||||
|
|
||||||
### Constraints:
|
|
||||||
|
|
||||||
### Submitting your work
|
|
||||||
|
|
||||||
1. Fork the project
|
|
||||||
2. clone it
|
|
||||||
3. npm ci
|
|
||||||
4. `npx nx serve <%= projectName %>`
|
|
||||||
5. _...work on it_
|
|
||||||
6. Commit your work
|
|
||||||
7. Submit a PR with a title beginning with **Answer:<%= challengeNumber %>** that I will review and other dev can review.
|
|
||||||
|
|
||||||
<a href="https://github.com/tomalaforge/angular-challenges/pulls?q=label%3A<%= challengeNumber %>+label%3Aanswer"><img src="https://img.shields.io/badge/-Solutions-green" alt="<%= projectName %>"/></a>
|
|
||||||
<a href='https://github.com/tomalaforge/angular-challenges/pulls?q=label%3A<%= challengeNumber %>+label%3A"answer+author"'><img src="https://img.shields.io/badge/-Author solution-important" alt="<%= projectName %> solution author"/></a>
|
|
||||||
|
|
||||||
<!-- <a href="{Blog post url}" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/badge/-Blog post explanation-blue" alt="<%= projectName %> blog article"/></a> -->
|
|
||||||
|
|
||||||
_You can ask any question on_ <a href="https://twitter.com/laforge_toma" target="_blank" rel="noopener noreferrer"><img src="./../../logo/twitter.svg" height=20px alt="twitter"/></a>
|
|
||||||
|
|||||||
@@ -37,8 +37,22 @@ export async function appGenerator(tree: Tree, options: Schema) {
|
|||||||
projectName: names(options.name).name,
|
projectName: names(options.name).name,
|
||||||
title: options.title,
|
title: options.title,
|
||||||
challengeNumber: options.challengeNumber,
|
challengeNumber: options.challengeNumber,
|
||||||
|
docRepository: options.docRepository,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
generateFiles(
|
||||||
|
tree,
|
||||||
|
join(__dirname, 'files', 'docs'),
|
||||||
|
`./docs/src/content/docs/challenges/${options.docRepository}`,
|
||||||
|
{
|
||||||
|
tmpl: '',
|
||||||
|
projectName: names(options.name).name,
|
||||||
|
title: options.title,
|
||||||
|
challengeNumber: options.challengeNumber,
|
||||||
|
difficulty: options.challengeDifficulty,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (options.addTest) {
|
if (options.addTest) {
|
||||||
generateFiles(tree, join(__dirname, 'files', 'test'), appDirectory, {
|
generateFiles(tree, join(__dirname, 'files', 'test'), appDirectory, {
|
||||||
tmpl: '',
|
tmpl: '',
|
||||||
|
|||||||
2
libs/cli/src/generators/app/schema.d.ts
vendored
2
libs/cli/src/generators/app/schema.d.ts
vendored
@@ -1,6 +1,8 @@
|
|||||||
export interface Schema {
|
export interface Schema {
|
||||||
title: string;
|
title: string;
|
||||||
challengeNumber: number;
|
challengeNumber: number;
|
||||||
|
challengeDifficulty: string;
|
||||||
|
docRepository: string;
|
||||||
name: string;
|
name: string;
|
||||||
directory?: string;
|
directory?: string;
|
||||||
addTest?: boolean;
|
addTest?: boolean;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"cli": "nx",
|
"cli": "nx",
|
||||||
"properties": {
|
"properties": {
|
||||||
"name": {
|
"name": {
|
||||||
"description": "The name of the application.",
|
"description": "The name of the application. (should be in camel case)",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"$default": {
|
"$default": {
|
||||||
"$source": "argv",
|
"$source": "argv",
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
"pattern": "^[a-zA-Z].*$"
|
"pattern": "^[a-zA-Z].*$"
|
||||||
},
|
},
|
||||||
"title": {
|
"title": {
|
||||||
"description": "Title of your challenge.",
|
"description": "Title of your challenge. (use quote to add spaces)",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"$default": {
|
"$default": {
|
||||||
"$source": "argv",
|
"$source": "argv",
|
||||||
@@ -34,6 +34,68 @@
|
|||||||
},
|
},
|
||||||
"x-priority": "important"
|
"x-priority": "important"
|
||||||
},
|
},
|
||||||
|
"challengeDifficulty": {
|
||||||
|
"description": "The difficulty of the challenge.",
|
||||||
|
"type": "string",
|
||||||
|
"x-priority": "important",
|
||||||
|
"x-prompt": {
|
||||||
|
"message": "Which category would you like?",
|
||||||
|
"type": "list",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"value": "🟢",
|
||||||
|
"label": "Easy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "🟠",
|
||||||
|
"label": "Medium"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "🔴",
|
||||||
|
"label": "Hard"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"docRepository": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The category of your challenge.",
|
||||||
|
"x-priority": "important",
|
||||||
|
"x-prompt": {
|
||||||
|
"message": "Which category would you like?",
|
||||||
|
"type": "list",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"value": "angular",
|
||||||
|
"label": "Angular"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "angular-performance",
|
||||||
|
"label": "Angular Performance"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "ngrx",
|
||||||
|
"label": "NgRx"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "rxjs",
|
||||||
|
"label": "RxJs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "nx",
|
||||||
|
"label": "Nx"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "testing",
|
||||||
|
"label": "Testing"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value": "typescript",
|
||||||
|
"label": "Typescript"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"directory": {
|
"directory": {
|
||||||
"description": "The directory of the new application.",
|
"description": "The directory of the new application.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|||||||
Reference in New Issue
Block a user