feat: update generator

This commit is contained in:
thomas
2024-05-11 21:49:21 +02:00
parent 4eb6f64f16
commit ee928b8549
2 changed files with 9 additions and 13 deletions

View File

@@ -3,13 +3,7 @@ import {
E2eTestRunner, E2eTestRunner,
UnitTestRunner, UnitTestRunner,
} from '@nx/angular/generators'; } from '@nx/angular/generators';
import { import { formatFiles, generateFiles, Tree, updateJson } from '@nx/devkit';
formatFiles,
generateFiles,
names,
Tree,
updateJson,
} from '@nx/devkit';
import { Linter } from '@nx/eslint'; import { Linter } from '@nx/eslint';
import { join } from 'path'; import { join } from 'path';
import { getProjectDir } from '../../utils/normalize'; import { getProjectDir } from '../../utils/normalize';
@@ -81,7 +75,7 @@ export async function challengeGenerator(tree: Tree, options: Schema) {
generateFiles(tree, join(__dirname, 'files', 'readme'), appDirectory, { generateFiles(tree, join(__dirname, 'files', 'readme'), appDirectory, {
tmpl: '', tmpl: '',
projectName: names(name).name, projectName: name,
appProjectName, appProjectName,
title: options.title, title: options.title,
challengeNumber, challengeNumber,
@@ -94,7 +88,7 @@ export async function challengeGenerator(tree: Tree, options: Schema) {
`./docs/src/content/docs/challenges/${options.category}`, `./docs/src/content/docs/challenges/${options.category}`,
{ {
tmpl: '', tmpl: '',
projectName: names(name).name, projectName: name,
appProjectName, appProjectName,
author: options.author, author: options.author,
title: options.title, title: options.title,
@@ -142,9 +136,7 @@ export async function challengeGenerator(tree: Tree, options: Schema) {
); );
const replacedLink = replaced.replace( const replacedLink = replaced.replace(
linkRegex, linkRegex,
`link: /${lang}/challenges/${options.category}/${challengeNumber}-${ `link: /${lang}/challenges/${options.category}/${challengeNumber}-${name}/\n`,
names(name).name
}/\n`,
); );
tree.write( tree.write(

View File

@@ -87,6 +87,10 @@
{ {
"value": "forms", "value": "forms",
"label": "Forms" "label": "Forms"
},
{
"value": "signal",
"label": "Signal"
} }
] ]
} }
@@ -112,5 +116,5 @@
} }
}, },
"additionalProperties": false, "additionalProperties": false,
"required": ["name", "title", "author", "challengeDifficulty", "category"] "required": ["title", "author", "challengeDifficulty", "category"]
} }