Skip to content

Commit 35df593

Browse files
author
John Doe
committed
refactor: fix typing
1 parent a5e0547 commit 35df593

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

tools/zod2md-jsdocs/src/nx-plugin.ts

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CreateNodesV2, NxPlugin } from '@nx/devkit';
1+
import type { CreateNodesV2, NxPlugin, TargetConfiguration } from '@nx/devkit';
22
import * as path from 'node:path';
33

44
const ZOD2MD_CONFIG_FILE = 'zod2md.config.ts';
@@ -12,7 +12,7 @@ interface DocsTargetConfigParams {
1212
function createDocsTargetConfig({
1313
config,
1414
output,
15-
}: DocsTargetConfigParams): Record<string, unknown> {
15+
}: DocsTargetConfigParams): TargetConfiguration {
1616
return {
1717
executor: 'nx:run-commands',
1818
options: {
@@ -30,29 +30,31 @@ function createDocsTargetConfig({
3030

3131
const createNodesV2: CreateNodesV2 = [
3232
`**/${ZOD2MD_CONFIG_FILE}`,
33-
configFilePaths => {
34-
return configFilePaths.map(configFilePath => {
35-
const projectRoot = path.dirname(configFilePath);
36-
const normalizedProjectRoot = projectRoot === '.' ? '' : projectRoot;
37-
const output = '{projectRoot}/docs/{projectName}-reference.md';
38-
const config = `{projectRoot}/${ZOD2MD_CONFIG_FILE}`;
33+
async configFilePaths => {
34+
return Promise.all(
35+
configFilePaths.map(async configFilePath => {
36+
const projectRoot = path.dirname(configFilePath);
37+
const normalizedProjectRoot = projectRoot === '.' ? '' : projectRoot;
38+
const output = '{projectRoot}/docs/{projectName}-reference.md';
39+
const config = `{projectRoot}/${ZOD2MD_CONFIG_FILE}`;
3940

40-
return [
41-
configFilePath,
42-
{
43-
projects: {
44-
[normalizedProjectRoot]: {
45-
targets: {
46-
[GENERATE_DOCS_TARGET_NAME]: createDocsTargetConfig({
47-
config,
48-
output,
49-
}),
41+
return [
42+
configFilePath,
43+
{
44+
projects: {
45+
[normalizedProjectRoot]: {
46+
targets: {
47+
[GENERATE_DOCS_TARGET_NAME]: createDocsTargetConfig({
48+
config,
49+
output,
50+
}),
51+
},
5052
},
5153
},
5254
},
53-
},
54-
];
55-
});
55+
] as const;
56+
}),
57+
);
5658
},
5759
];
5860

0 commit comments

Comments
 (0)