Skip to content

Commit

Permalink
fix: publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
davidecarpini committed Oct 28, 2024
1 parent 84a9356 commit b16db80
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions scripts/publish-packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
Expand All @@ -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 πŸŽ‰πŸŽ‰πŸŽ‰`);
Expand Down

0 comments on commit b16db80

Please sign in to comment.