11import process from 'node:process'
2- import { execSync } from 'node:child_process'
2+ import { execFileSync } from 'node:child_process'
33import { $fetch } from 'ofetch'
44import { inc } from 'semver'
55import { generateMarkDown , getCurrentGitBranch , loadChangelogConfig } from 'changelogen'
@@ -18,7 +18,7 @@ async function main () {
1818 // TODO: revert after release of v4.2.0
1919 // Get the date of the latest tag to filter out merged history commits
2020 const latestTagName = await getLatestTag ( )
21- const tagDate = execSync ( ` git log -1 --format=%ai ${ latestTagName } ` , { encoding : 'utf-8' } )
21+ const tagDate = execFileSync ( ' git' , [ ' log' , '-1' , ' --format=%ai' , latestTagName ] , { encoding : 'utf-8' } )
2222 const sinceDate = tagDate . trim ( )
2323
2424 const commits = await getLatestCommits ( sinceDate ) . then ( commits => commits . filter (
@@ -30,19 +30,19 @@ async function main () {
3030 const changelog = await generateMarkDown ( commits , config )
3131
3232 // Create and push a branch with bumped versions if it has not already been created
33- const branchExists = execSync ( ` git ls-remote --heads origin v${ newVersion } `) . toString ( ) . trim ( ) . length > 0
33+ const branchExists = execFileSync ( ' git' , [ ' ls-remote' , ' --heads' , ' origin' , ` v${ newVersion } `] , { encoding : 'utf-8' } ) . trim ( ) . length > 0
3434 if ( ! branchExists ) {
35- execSync ( 'git config --global user.email " daniel@roe.dev"' )
36- execSync ( 'git config --global user.name " Daniel Roe"' )
37- execSync ( ` git checkout -b v${ newVersion } `)
35+ execFileSync ( 'git' , [ ' config' , ' --global' , ' user.email' , ' daniel@roe.dev' ] )
36+ execFileSync ( 'git' , [ ' config' , ' --global' , ' user.name' , ' Daniel Roe' ] )
37+ execFileSync ( ' git' , [ ' checkout' , '-b' , ` v${ newVersion } `] )
3838
3939 for ( const pkg of workspace . packages . filter ( p => ! p . data . private ) ) {
4040 workspace . setVersion ( pkg . data . name , newVersion ! )
4141 }
4242 await workspace . save ( )
4343
44- execSync ( ` git commit -am v${ newVersion } `)
45- execSync ( ` git push -u origin v${ newVersion } `)
44+ execFileSync ( ' git' , [ ' commit' , ' -am' , ` v${ newVersion } `] )
45+ execFileSync ( ' git' , [ ' push' , '-u' , ' origin' , ` v${ newVersion } `] )
4646 }
4747
4848 // Get the current PR for this release, if it exists
0 commit comments