Skip to content

Commit 9aa77fb

Browse files
committed
fix(generator): fix generator
1 parent c479fd0 commit 9aa77fb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

libs/cli/src/generators/challenge/generator.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
formatFiles,
88
generateFiles,
99
names,
10-
readJsonFile,
1110
Tree,
1211
updateJson,
1312
} from '@nx/devkit';
@@ -48,11 +47,6 @@ export async function challengeGenerator(tree: Tree, options: Schema) {
4847

4948
const difficulty = options.challengeDifficulty;
5049

51-
const challengeNumberPath = 'challenge-number.json';
52-
const challangeNumberJson = readJsonFile(challengeNumberPath);
53-
const challengeNumber = challangeNumberJson.total + 1;
54-
const order = challangeNumberJson[difficulty] + 1;
55-
5650
await applicationGenerator(tree, {
5751
...options,
5852
directory: `apps/${options.category}`,
@@ -69,6 +63,13 @@ export async function challengeGenerator(tree: Tree, options: Schema) {
6963
skipTests: true,
7064
});
7165

66+
const challengeNumberPath = 'challenge-number.json';
67+
const challangeNumberJson = JSON.parse(
68+
tree.read(challengeNumberPath).toString()
69+
);
70+
const challengeNumber = challangeNumberJson.total + 1;
71+
const order = challangeNumberJson[difficulty] + 1;
72+
7273
generateFiles(tree, join(__dirname, 'files', 'app'), appDirectory, {
7374
tmpl: '',
7475
});

0 commit comments

Comments
 (0)