interface Json { [ key ] : any ; } class AdaptPackageJson { private static readonly fs = require ( 'fs' ) ; private static readonly path = require ( 'path' ) ; static perform ( ) { const filePath = AdaptPackageJson . path . join ( 'dist' , 'oblique' , 'package.json' ) ; let distPackage = AdaptPackageJson . getDistPackage ( filePath ) ; let adaptedDistPackage = AdaptPackageJson . removeExports ( distPackage ) ; adaptedDistPackage = AdaptPackageJson . addProperties ( adaptedDistPackage ) ; AdaptPackageJson . fs . writeFileSync ( filePath , JSON . stringify ( adaptedDistPackage , null , 2 ) ) ; } private static getDistPackage ( filePath ) { return JSON . parse ( AdaptPackageJson . fs . readFileSync ( filePath ) ) ; } private static removeExports ( distPackage ) { delete distPackage . exports ; return distPackage ; } private static addProperties ( distPackage ) { const rootPackage = JSON . parse ( AdaptPackageJson . fs . readFileSync ( 'package.json' ) ) ; [ 'version' , 'description' , 'keywords' , 'author' , 'contributors' , 'homepage' , 'repository' , 'license' , 'bugs' , 'publishConfig' ] . forEach ( field => ( distPackage [ field ] = rootPackage [ field ] ) ) ; return distPackage ; } } AdaptPackageJson . perform ( ) ;