mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-10 12:53:03 -05:00
feat: add challenge number to generator
This commit is contained in:
@@ -38,7 +38,8 @@ export async function challengeGenerator(tree: Tree, options: Schema) {
|
|||||||
const challengeNumberJson = JSON.parse(
|
const challengeNumberJson = JSON.parse(
|
||||||
tree.read(challengeNumberPath).toString(),
|
tree.read(challengeNumberPath).toString(),
|
||||||
);
|
);
|
||||||
const challengeNumber = challengeNumberJson.total + 1;
|
const challengeNumber =
|
||||||
|
options.challengeNumber ?? challengeNumberJson.total + 1;
|
||||||
const difficulty = options.challengeDifficulty;
|
const difficulty = options.challengeDifficulty;
|
||||||
|
|
||||||
const name = options.title.toLowerCase().split(' ').join('-');
|
const name = options.title.toLowerCase().split(' ').join('-');
|
||||||
|
|||||||
@@ -6,4 +6,5 @@ export interface Schema {
|
|||||||
addTest?: boolean;
|
addTest?: boolean;
|
||||||
skipPackageJson?: boolean;
|
skipPackageJson?: boolean;
|
||||||
rootProject?: boolean;
|
rootProject?: boolean;
|
||||||
|
challengeNumber?: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,6 +95,10 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"challengeNumber": {
|
||||||
|
"description": "Specify a challenge number (If you don't, the challenge number will be set automatically)",
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
"addTest": {
|
"addTest": {
|
||||||
"description": "add spec files.",
|
"description": "add spec files.",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
|
|||||||
Reference in New Issue
Block a user