Skip to content
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@less/root",
"private": true,
"version": "4.5.0",
"version": "4.5.1",
"description": "Less monorepo",
"homepage": "http://lesscss.org",
"scripts": {
Expand Down
23 changes: 20 additions & 3 deletions scripts/bump-and-publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,26 +417,43 @@ function main() {

console.log(`\n📦 Publishing packages to NPM with tag: ${npmTag}...`);

const publishErrors = [];

for (const pkg of publishable) {
console.log(`\n📤 Publishing ${pkg.name}...`);
if (dryRun) {
console.log(` [DRY RUN] Would publish: ${pkg.name}@${nextVersion} with tag: ${npmTag}`);
console.log(` [DRY RUN] Command: npm publish --tag ${npmTag}`);
} else {
try {
execSync(`npm publish --tag ${npmTag}`, {
// For scoped packages, ensure access is set correctly
const publishCmd = `npm publish --tag ${npmTag} --access public`;
execSync(publishCmd, {
cwd: pkg.dir,
stdio: 'inherit',
env: { ...process.env, NODE_AUTH_TOKEN: process.env.NPM_TOKEN }
});
console.log(`✅ Successfully published ${pkg.name}@${nextVersion}`);
} catch (e) {
console.error(`❌ Failed to publish ${pkg.name}:`, e.message);
process.exit(1);
const errorMsg = e.message || String(e);
console.error(`❌ Failed to publish ${pkg.name}: ${errorMsg}`);
publishErrors.push({ name: pkg.name, error: errorMsg });
// Continue with other packages instead of exiting immediately
}
}
}

// Report any publish errors at the end
if (publishErrors.length > 0) {
console.error(`\n❌ Publishing completed with ${publishErrors.length} error(s):`);
publishErrors.forEach(({ name, error }) => {
console.error(` - ${name}: ${error}`);
});
console.error(`\n⚠️ Note: Version bump and commit were successful.`);
console.error(` Some packages failed to publish. You may need to publish them manually.`);
process.exit(1);
}

if (dryRun) {
console.log(`\n🧪 DRY RUN COMPLETE - No changes were made`);
console.log(` Would publish version: ${nextVersion}`);
Expand Down