mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-10 04:43:03 -05:00
fix(generator): fix generator
This commit is contained in:
@@ -10,4 +10,4 @@ npx nx serve <%= appProjectName %>
|
||||
|
||||
### Documentation and Instruction
|
||||
|
||||
Challenge documentation is [here](https://angular-challenges.vercel.app/challenges/<%= docRepository %>/<%= challengeNumber %>-<%= projectName %>/).
|
||||
Challenge documentation is [here](https://angular-challenges.vercel.app/challenges/<%= category %>/<%= challengeNumber %>-<%= projectName %>/).
|
||||
|
||||
@@ -43,12 +43,11 @@ function findPreviousChallengeFilePath(tree, path, number) {
|
||||
export async function challengeGenerator(tree: Tree, options: Schema) {
|
||||
const { appProjectName, appDirectory } = getProjectDir(
|
||||
options.name,
|
||||
options.directory
|
||||
`apps/${options.category}`
|
||||
);
|
||||
|
||||
const difficulty = options.challengeDifficulty;
|
||||
|
||||
// read json file with the total challanges and display order
|
||||
const challengeNumberPath = 'challenge-number.json';
|
||||
const challangeNumberJson = readJsonFile(challengeNumberPath);
|
||||
const challengeNumber = challangeNumberJson.total + 1;
|
||||
@@ -56,6 +55,7 @@ export async function challengeGenerator(tree: Tree, options: Schema) {
|
||||
|
||||
await applicationGenerator(tree, {
|
||||
...options,
|
||||
directory: `apps/${options.category}`,
|
||||
style: 'scss',
|
||||
routing: false,
|
||||
inlineStyle: true,
|
||||
@@ -80,13 +80,13 @@ export async function challengeGenerator(tree: Tree, options: Schema) {
|
||||
appProjectName,
|
||||
title: options.title,
|
||||
challengeNumber,
|
||||
docRepository: options.docRepository,
|
||||
category: options.category,
|
||||
});
|
||||
|
||||
generateFiles(
|
||||
tree,
|
||||
join(__dirname, 'files', 'docs'),
|
||||
`./docs/src/content/docs/challenges/${options.docRepository}`,
|
||||
`./docs/src/content/docs/challenges/${options.category}`,
|
||||
{
|
||||
tmpl: '',
|
||||
projectName: names(options.name).name,
|
||||
@@ -123,7 +123,7 @@ export async function challengeGenerator(tree: Tree, options: Schema) {
|
||||
const linkRegex = new RegExp(`link: \\/challenges\\/(.*?)\n`, 'gi');
|
||||
const replacedLink = replaced.replace(
|
||||
linkRegex,
|
||||
`link: /challenges/${options.docRepository}/${challengeNumber}-${
|
||||
`link: /challenges/${options.category}/${challengeNumber}-${
|
||||
names(options.name).name
|
||||
}/\n`
|
||||
);
|
||||
|
||||
@@ -2,9 +2,8 @@ export interface Schema {
|
||||
title: string;
|
||||
author: string;
|
||||
challengeDifficulty: string;
|
||||
docRepository: string;
|
||||
category: string;
|
||||
name: string;
|
||||
directory?: string;
|
||||
addTest?: boolean;
|
||||
skipPackageJson?: boolean;
|
||||
rootProject?: boolean;
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"docRepository": {
|
||||
"category": {
|
||||
"type": "string",
|
||||
"description": "The category of your challenge.",
|
||||
"x-priority": "important",
|
||||
@@ -94,11 +94,6 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"directory": {
|
||||
"description": "The directory of the new application.",
|
||||
"type": "string",
|
||||
"x-priority": "important"
|
||||
},
|
||||
"addTest": {
|
||||
"description": "add spec files.",
|
||||
"type": "boolean",
|
||||
@@ -120,11 +115,5 @@
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"name",
|
||||
"title",
|
||||
"author",
|
||||
"challengeDifficulty",
|
||||
"docRepository"
|
||||
]
|
||||
"required": ["name", "title", "author", "challengeDifficulty", "category"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user