-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathplugin.js
More file actions
53 lines (48 loc) · 1.62 KB
/
plugin.js
File metadata and controls
53 lines (48 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import path from 'node:path';
export const createNodesV2 = [
`**/zod2md.config.ts`,
async (zod2MdConfigurationFiles, createNodesOptions) => {
const options = createNodesOptions ?? {};
const targetName = options.targetName ?? 'generate-docs';
return Promise.all(
zod2MdConfigurationFiles.map(async zod2MdConfigurationFile => {
const projectRoot = path.dirname(zod2MdConfigurationFile);
const normalizedProjectRoot = projectRoot === '.' ? '' : projectRoot;
const result = {
projects: {
[normalizedProjectRoot]: {
targets: {
[targetName]: {
executor: 'nx:run-commands',
options: {
commands: [
'zod2md --config {args.config} --output {args.output}',
'prettier --write {args.output}',
],
parallel: false,
config: '{projectRoot}/zod2md.config.ts',
output: '{projectRoot}/docs/{projectName}-reference.md',
},
cache: true,
inputs: [
'production',
'^production',
'{projectRoot}/zod2md.config.ts',
],
outputs: ['{projectRoot}/docs/{projectName}-reference.md'],
},
},
},
},
};
return [zod2MdConfigurationFile, result];
}),
);
},
];
// default export for nx.json#plugins
const plugin = {
name: 'zod2md-nx-plugin',
createNodesV2,
};
export default plugin;