1- import type { CreateNodesV2 , NxPlugin } from '@nx/devkit' ;
1+ import type { CreateNodesV2 , NxPlugin , TargetConfiguration } from '@nx/devkit' ;
22import * as path from 'node:path' ;
33
44const ZOD2MD_CONFIG_FILE = 'zod2md.config.ts' ;
@@ -12,7 +12,7 @@ interface DocsTargetConfigParams {
1212function 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
3131const 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