File tree Expand file tree Collapse file tree 4 files changed +55
-10
lines changed
generators/sync-zod2md-setup Expand file tree Collapse file tree 4 files changed +55
-10
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,13 @@ module.exports = tseslint.config(
4444 '@nx/dependency-checks' : 'error' ,
4545 } ,
4646 } ,
47+ // Nx compiles the sync generators on the fly with SWC and there the .js ending is not working
48+ {
49+ files : [ '**/sync-*.ts' ] ,
50+ rules : {
51+ 'n/file-extension-in-import' : 'off' ,
52+ } ,
53+ } ,
4754 {
4855 files : [ '**/package.json' , '**/generators.json' ] ,
4956 rules : {
Original file line number Diff line number Diff line change @@ -87,14 +87,54 @@ This is especially useful when integrating the sync generator into CI or workspa
8787
8888---
8989
90- ## Registering / Testing the generator
90+ ## Register a Global Sync Generator
9191
92- To register the generator in your workspace :
92+ Global sync generators are registered in the _ nx.json _ file like this :
9393
94- ``` bash
95- nx g @tooling/zod2md-jsdocs:sync-zod2md-setup --register
94+ _ nx.json_
95+
96+ ``` json
97+ {
98+ "sync" : {
99+ "globalGenerators" : [" ./tools/zod2md-jsdocs:sync-zod2md-setup" ]
100+ }
101+ }
102+ ```
103+
104+ ## Register a Local Sync Generator
105+
106+ Local sync generators are registered in the project's ` package.json ` or ` project.json ` file under the ` syncGenerators ` property for specific targets:
107+
108+ _ package.json_
109+
110+ ``` json
111+ {
112+ "name" : " my-project" ,
113+ "nx" : {
114+ "targets" : {
115+ "build" : {
116+ "syncGenerators" : [" ./tools/zod2md-jsdocs:sync-zod2md-setup" ]
117+ }
118+ }
119+ }
120+ }
96121```
97122
123+ _ project.json_
124+
125+ ``` json
126+ {
127+ "name" : " my-project" ,
128+ "targets" : {
129+ "build" : {
130+ "syncGenerators" : [" ./tools/zod2md-jsdocs:sync-zod2md-setup" ]
131+ }
132+ }
133+ }
134+ ```
135+
136+ With this configuration, the sync generator will run automatically before the specified target (e.g., ` build ` ).
137+
98138## Notes
99139
100140- This is a ** sync generator** , not a build step
Original file line number Diff line number Diff line change @@ -11,13 +11,13 @@ import * as path from 'node:path';
1111import {
1212 GENERATE_DOCS_TARGET_NAME ,
1313 PATCH_TS_TARGET_NAME ,
14- } from '../../plugin/constants.js ' ;
15- import { DEFAULT_ZOD2MD_CONFIG_FILE_NAME } from '../configuration/constants.js ' ;
14+ } from '../../plugin/constants' ;
15+ import { DEFAULT_ZOD2MD_CONFIG_FILE_NAME } from '../configuration/constants' ;
1616import {
1717 type PluginDefinition ,
1818 addZod2MdTransformToTsConfig ,
1919 getFirstExistingTsConfig ,
20- } from '../configuration/tsconfig.js ' ;
20+ } from '../configuration/tsconfig' ;
2121
2222const missingTsconfig = 'missing-tsconfig' as const ;
2323const missingTarget = 'missing-target' as const ;
Original file line number Diff line number Diff line change @@ -49,9 +49,7 @@ const createNodesV2: CreateNodesV2 = [
4949 projects : 'self' ,
5050 } ,
5151 ] ,
52- syncGenerators : [
53- './tools/zod2md-jsdocs/dist:sync-zod2md-setup' ,
54- ] ,
52+ syncGenerators : [ './tools/zod2md-jsdocs:sync-zod2md-setup' ] ,
5553 } ,
5654 [ GENERATE_DOCS_TARGET_NAME ] : createDocsTargetConfig ( {
5755 config,
You can’t perform that action at this time.
0 commit comments