Skip to content

Commit 27011f6

Browse files
committed
Add version consistency check to yao-pkg publish script
1 parent 443138b commit 27011f6

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

scripts/publish-yao.mjs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,10 @@ async function main() {
476476
type: 'boolean',
477477
default: false,
478478
},
479+
'skip-consistency-check': {
480+
type: 'boolean',
481+
default: false,
482+
},
479483
'dry-run': {
480484
type: 'boolean',
481485
default: false,
@@ -514,6 +518,7 @@ Options:
514518
--version=VERSION Version to publish (default: from package.json)
515519
--node-version=VERSION Node.js version for yao-pkg (default: v24.9.0 socket-node)
516520
--skip-version-check Skip checking for newer yao-pkg Node versions
521+
--skip-consistency-check Skip package version consistency validation (NOT RECOMMENDED)
517522
--dry-run Perform dry-run without publishing
518523
--skip-build Skip building binaries (use existing)
519524
--skip-optional Skip optional platforms (armv7, alpine)
@@ -577,6 +582,31 @@ Notes:
577582
const version = values.version || await getVersion()
578583
console.log(`Publishing version: ${version}\n`)
579584

585+
// Check version consistency across all packages.
586+
if (!values['skip-consistency-check']) {
587+
console.log(colors.bold('📋 Package Version Consistency Check'))
588+
console.log('─'.repeat(60))
589+
const isConsistent = await checkVersionConsistency(version)
590+
console.log('─'.repeat(60))
591+
592+
if (!isConsistent) {
593+
console.log(colors.red('\n❌ Version consistency check failed!'))
594+
console.log(colors.yellow('This is CRITICAL: All @socketbin packages must have the same version.'))
595+
console.log(colors.yellow('Fix the version mismatches before publishing.'))
596+
597+
if (!values['dry-run']) {
598+
console.log(colors.red('\nAborting publish to prevent version inconsistency.'))
599+
console.log('Use --skip-consistency-check to bypass this check (NOT RECOMMENDED).\n')
600+
process.exitCode = 1
601+
return
602+
} else {
603+
console.log(colors.yellow('\n⚠️ Continuing with dry-run despite version mismatch...\n'))
604+
}
605+
} else {
606+
console.log()
607+
}
608+
}
609+
580610
// Determine which platforms to build
581611
let platformsToBuild = values.platform || []
582612

0 commit comments

Comments
 (0)