license import * as fs from 'fs' ; import * as path from 'path' ; import { existsSync } from './fs' ; returns export function mergedBowerConfigsFromRepos ( repos ) { const merged = { name : 'generated-bower-config-for-workspace' , dependencies : { } , resolutions : { } , } ; for ( const repo of repos ) { const bowerJsonPath = path . join ( repo . dir , 'bower.json' ) ; if ( ! existsSync ( bowerJsonPath ) ) { continue ; } const bowerJson = fs . readFileSync ( bowerJsonPath ) . toString ( ) ; const bowerConfig = JSON . parse ( bowerJson ) ; if ( bowerConfig . devDependencies ) { for ( const name in bowerConfig . devDependencies ) { merged . dependencies [ name ] = bowerConfig . devDependencies [ name ] ; } } if ( bowerConfig . dependencies ) { for ( const name in bowerConfig . dependencies ) { merged . dependencies [ name ] = bowerConfig . dependencies [ name ] ; } } if ( bowerConfig . resolutions ) { for ( const name in bowerConfig . resolutions ) { merged . resolutions [ name ] = bowerConfig . resolutions [ name ] ; } } if ( bowerConfig . version ) { merged . resolutions [ repo . dir ] = bowerConfig . version ; } } return merged ; }