-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathplugin.ts
34 lines (32 loc) · 1014 Bytes
/
plugin.ts
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
import type {
CreateNodes,
CreateNodesContext,
CreateNodesResult,
} from '@nx/devkit';
import { PROJECT_JSON_FILE_NAME } from '../internal/constants.js';
import { createTargets } from './target/targets.js';
import type { CreateNodesOptions } from './types.js';
import { normalizedCreateNodesContext } from './utils.js';
// name has to be "createNodes" to get picked up by Nx <v20
export const createNodes: CreateNodes = [
`**/${PROJECT_JSON_FILE_NAME}`,
async (
projectConfigurationFile: string,
createNodesOptions: unknown,
context: CreateNodesContext,
): Promise<CreateNodesResult> => {
const parsedCreateNodesOptions = createNodesOptions as CreateNodesOptions;
const normalizedContext = await normalizedCreateNodesContext(
context,
projectConfigurationFile,
parsedCreateNodesOptions,
);
return {
projects: {
[normalizedContext.projectRoot]: {
targets: await createTargets(normalizedContext),
},
},
};
},
];