@@ -3,10 +3,7 @@ import {
33 formatFiles ,
44 logger ,
55 readProjectConfiguration ,
6- updateProjectConfiguration ,
76} from '@nx/devkit' ;
8- import type { ProjectConfiguration } from 'nx/src/config/workspace-json-project-json' ;
9- import { DEFAULT_TARGET_NAME , PACKAGE_NAME } from '../../internal/constants.js' ;
107import { generateCodePushupConfig } from './code-pushup-config.js' ;
118import type { ConfigurationGeneratorOptions } from './schema.js' ;
129
@@ -16,46 +13,19 @@ export async function configurationGenerator(
1613) {
1714 const projectConfiguration = readProjectConfiguration ( tree , options . project ) ;
1815
19- const { skipConfig, skipTarget , skipFormat } = options ;
16+ const { skipConfig, skipFormat } = options ;
2017
2118 if ( skipConfig === true ) {
2219 logger . info ( 'Skip config file creation' ) ;
2320 } else {
2421 generateCodePushupConfig ( tree , projectConfiguration . root ) ;
2522 }
2623
27- if ( skipTarget === true ) {
28- logger . info ( 'Skip adding target to project' ) ;
29- } else {
30- addTargetToProject ( tree , projectConfiguration , options ) ;
31- }
32-
3324 if ( skipFormat === true ) {
3425 logger . info ( 'Skip formatting files' ) ;
3526 } else {
3627 await formatFiles ( tree ) ;
3728 }
3829}
3930
40- export function addTargetToProject (
41- tree : Tree ,
42- projectConfiguration : ProjectConfiguration ,
43- options : ConfigurationGeneratorOptions ,
44- ) {
45- const { targets } = projectConfiguration ;
46- const { targetName, project } = options ;
47-
48- const codePushupTargetConfig = {
49- executor : `${ PACKAGE_NAME } :cli` ,
50- } ;
51-
52- updateProjectConfiguration ( tree , project , {
53- ...projectConfiguration ,
54- targets : {
55- ...targets ,
56- [ targetName ?? DEFAULT_TARGET_NAME ] : codePushupTargetConfig ,
57- } ,
58- } ) ;
59- }
60-
6131export default configurationGenerator ;
0 commit comments