import * as jsonfile from 'jsonfile' ; import { factory } from './execute' ; const execute = factory ( { displayErrors : true } ) ; export const publishPackage = ( pathToPackage ) => { const fullPath = process . cwd ( ) + pathToPackage ; const pack = jsonfile . readFileSync ( fullPath + '/package.json' ) ; let version = pack . version ; const buildMatch = version . match ( /\+.+/ ) ; version = buildMatch ? version . replace ( buildMatch [ 0 ] , '' ) : version ; execute ( `(cd ${ fullPath } && yarn publish --access=public --new-version=${ version })` ) ; } ;