Skip to content

Commit 1f69a01

Browse files
committed
fix: run only on existing guides
1 parent 08d504c commit 1f69a01

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

scripts/guides/generate.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import { callGenerator, exists, run, setupAndGen, toAbsolutePath } from '../common.js';
1+
import { existsSync } from 'node:fs';
2+
3+
import { callGenerator, run, setupAndGen, toAbsolutePath } from '../common.js';
24
import { getTestOutputFolder } from '../config.js';
35
import { formatter } from '../formatter.js';
46
import type { Generator } from '../types.js';
57

68
export async function guidesGenerateMany(generators: Generator[]): Promise<void> {
9+
generators = generators.filter((gen) => existsSync(toAbsolutePath(`templates/${gen.language}/guides/${gen.client}`)));
10+
711
await setupAndGen(generators, 'guides', async (gen) => {
812
if (getTestOutputFolder(gen.language)) {
913
await callGenerator(gen);
@@ -12,6 +16,7 @@ export async function guidesGenerateMany(generators: Generator[]): Promise<void>
1216

1317
const langs = [...new Set(generators.map((gen) => gen.language))];
1418
for (const lang of langs) {
19+
const guidesPath = `guides/${lang}`;
1520
if (!getTestOutputFolder(lang)) {
1621
continue;
1722
}
@@ -29,9 +34,6 @@ export async function guidesGenerateMany(generators: Generator[]): Promise<void>
2934
});
3035
}
3136

32-
const guidesPath = `guides/${lang}`;
33-
if (await exists(toAbsolutePath(guidesPath))) {
34-
await formatter(lang, guidesPath);
35-
}
37+
await formatter(lang, guidesPath);
3638
}
3739
}

0 commit comments

Comments
 (0)