1- import type {
1+ import {
22 CreateNodes ,
33 CreateNodesContext ,
44 CreateNodesResult ,
5+ CreateNodesV2 ,
6+ createNodesFromFiles ,
57} from '@nx/devkit' ;
6- import { PROJECT_JSON_FILE_NAME } from '../internal/constants.js ' ;
7- import { createTargets } from './target/targets.js ' ;
8- import type { CreateNodesOptions } from './types.js ' ;
9- import { normalizedCreateNodesContext } from './utils.js ' ;
8+ import { PROJECT_JSON_FILE_NAME } from '../internal/constants' ;
9+ import { createTargets } from './target/targets' ;
10+ import type { CreateNodesOptions } from './types' ;
11+ import { normalizedCreateNodesContext } from './utils' ;
1012
1113// name has to be "createNodes" to get picked up by Nx
14+
1215export const createNodes : CreateNodes = [
1316 `**/${ PROJECT_JSON_FILE_NAME } ` ,
1417 async (
@@ -32,3 +35,31 @@ export const createNodes: CreateNodes = [
3235 } ;
3336 } ,
3437] ;
38+
39+ export const createNodesV2 : CreateNodesV2 < any > = [
40+ `**/${ PROJECT_JSON_FILE_NAME } ` ,
41+
42+ async ( configFiles , options , context ) => {
43+ return await createNodesFromFiles (
44+ async ( globMatchingFile , internalOptions ) => {
45+ const parsedCreateNodesOptions = internalOptions as CreateNodesOptions ;
46+
47+ const normalizedContext = await normalizedCreateNodesContext (
48+ context ,
49+ globMatchingFile ,
50+ parsedCreateNodesOptions ,
51+ ) ;
52+ return {
53+ projects : {
54+ [ normalizedContext . projectRoot ] : {
55+ targets : await createTargets ( normalizedContext ) ,
56+ } ,
57+ } ,
58+ } ;
59+ } ,
60+ configFiles ,
61+ options ,
62+ context ,
63+ ) ;
64+ } ,
65+ ] ;
0 commit comments