diff --git a/scripts/publish-packages.ts b/scripts/publish-packages.ts index 6763d7bb..52db59db 100644 --- a/scripts/publish-packages.ts +++ b/scripts/publish-packages.ts @@ -18,6 +18,10 @@ const publishPackages = async () => { console.log(` ๐Ÿš€๐Ÿš€๐Ÿš€ Publishing ${version} ๐Ÿš€๐Ÿš€๐Ÿš€`); console.log('\n______________________________________________________\n\n'); + console.log(' Checkout to main:'); + await exec('git checkout main'); + console.log(' - โœ… Checked out!'); + console.log(' Pull the tag:'); await exec('git pull'); console.log(' - โœ… Pulled!'); @@ -39,12 +43,32 @@ const publishPackages = async () => { console.log(' Test:'); console.log(' - ๐Ÿงช Testing packages...'); await exec('yarn test'); - console.log(' - โœ… Success!'); + console.log(' - โœ… Tested!'); console.log(' Publish:'); console.log(' - ๐Ÿ“ฆ Publishing packages...'); - await exec('yarn changeset publish'); - console.log(' - โœ… Published!'); + await new Promise((resolve, reject) => { + const publishProcess = child_process.spawn( + 'yarn', + ['changeset', 'publish'], + { + stdio: 'inherit', // This allows interaction with the process's stdio + shell: true, // Enables shell features if needed + }, + ); + + publishProcess.on('close', (code) => { + if (code === 0) { + resolve(null); + } else { + reject(new Error(`Publish process exited with code ${code}`)); + } + }); + + publishProcess.on('error', (err) => { + reject(err); + }); + }); console.log('\n______________________________________________________\n\n'); console.log(` - ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰ Packages published successfully ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰`);