@@ -32,6 +32,7 @@ import type {
3232 PluginCodegenResult ,
3333 PluginSetupBinding ,
3434 ScopedPluginResult ,
35+ Tree ,
3536 WriteContext ,
3637} from './types.js' ;
3738import { createTree } from './virtual-fs.js' ;
@@ -57,6 +58,8 @@ export async function runSetupWizard(
5758 const format = await promptConfigFormat ( targetDir , cliArgs ) ;
5859 const ciProvider = await promptCiProvider ( cliArgs ) ;
5960
61+ const tree = createTree ( await getGitRoot ( ) ) ;
62+
6063 const resolved : ScopedPluginResult [ ] = await asyncSequential (
6164 selectedBindings ,
6265 async binding => ( {
@@ -65,11 +68,11 @@ export async function runSetupWizard(
6568 } ) ,
6669 ) ;
6770
71+ await applyAdjustments ( tree , resolved ) ;
72+
6873 const packageJson = await readPackageJson ( targetDir ) ;
6974 const isEsm = packageJson . type === 'module' ;
7075 const configFilename = resolveFilename ( 'code-pushup.config' , format , isEsm ) ;
71-
72- const tree = createTree ( await getGitRoot ( ) ) ;
7376 const writeContext : WriteContext = { tree, format, configFilename, isEsm } ;
7477
7578 await ( context . mode === 'monorepo' && context . tool != null
@@ -112,6 +115,21 @@ async function resolveBinding(
112115 return binding . generateConfig ( answers ) ;
113116}
114117
118+ async function applyAdjustments (
119+ tree : Pick < Tree , 'read' | 'write' > ,
120+ resolved : ScopedPluginResult [ ] ,
121+ ) : Promise < void > {
122+ await asyncSequential (
123+ resolved . flatMap ( ( { result } ) => result . adjustments ?? [ ] ) ,
124+ async ( { path : filePath , transform } ) => {
125+ const content = await tree . read ( filePath ) ;
126+ if ( content != null ) {
127+ await tree . write ( filePath , transform ( content ) ) ;
128+ }
129+ } ,
130+ ) ;
131+ }
132+
115133async function writeStandaloneConfig (
116134 { tree, format, configFilename } : WriteContext ,
117135 results : PluginCodegenResult [ ] ,
0 commit comments