@@ -43,18 +43,31 @@ const { values: cliArgs } = parseArgs({
4343 'force-publish' : {
4444 type : 'boolean' ,
4545 } ,
46+ 'force-registry' : {
47+ type : 'boolean' ,
48+ } ,
49+ 'skip-npm-packages' : {
50+ type : 'boolean' ,
51+ } ,
4652 quiet : {
4753 type : 'boolean' ,
4854 } ,
4955 } ,
5056 strict : false ,
5157} )
5258
53- // Debug: Always log force-publish status to diagnose workflow issues.
59+ // Debug: Always log force flags status to diagnose workflow issues.
5460logger . log ( 'DEBUG: process.argv:' , process . argv . slice ( 2 ) . join ( ' ' ) )
5561logger . log ( 'DEBUG: Full cliArgs:' , JSON . stringify ( cliArgs , null , 2 ) )
5662logger . log ( 'DEBUG: cliArgs.forcePublish =' , cliArgs . forcePublish )
5763logger . log ( 'DEBUG: cliArgs["force-publish"] =' , cliArgs [ 'force-publish' ] )
64+ logger . log ( 'DEBUG: cliArgs.forceRegistry =' , cliArgs . forceRegistry )
65+ logger . log ( 'DEBUG: cliArgs["force-registry"] =' , cliArgs [ 'force-registry' ] )
66+ logger . log ( 'DEBUG: cliArgs.skipNpmPackages =' , cliArgs . skipNpmPackages )
67+ logger . log (
68+ 'DEBUG: cliArgs["skip-npm-packages"] =' ,
69+ cliArgs [ 'skip-npm-packages' ] ,
70+ )
5871
5972/**
6073 * Checkout a specific commit and discard uncommitted changes.
@@ -213,19 +226,27 @@ async function publishAtCommit(sha) {
213226 path : REGISTRY_PKG_PATH ,
214227 printName : registryPkgJson . name ,
215228 } )
216- const allPackages = [
217- ...getNpmPackageNames ( ) . map ( sockRegPkgName => {
218- const pkgPath = path . join ( NPM_PACKAGES_PATH , sockRegPkgName )
219- const pkgJson = readPackageJsonSync ( pkgPath )
220- return packageData ( {
221- name : pkgJson . name ,
222- path : pkgPath ,
223- printName : pkgJson . name ,
224- tag : getReleaseTag ( pkgJson . version ) ,
229+
230+ // Check if we should skip npm override packages.
231+ const skipNpmPackagesFlag =
232+ cliArgs . skipNpmPackages ||
233+ cliArgs [ 'skip-npm-packages' ] ||
234+ cliArgs [ '--' ] ?. includes ( '--skip-npm-packages' )
235+
236+ const npmPackages = skipNpmPackagesFlag
237+ ? [ ]
238+ : getNpmPackageNames ( ) . map ( sockRegPkgName => {
239+ const pkgPath = path . join ( NPM_PACKAGES_PATH , sockRegPkgName )
240+ const pkgJson = readPackageJsonSync ( pkgPath )
241+ return packageData ( {
242+ name : pkgJson . name ,
243+ path : pkgPath ,
244+ printName : pkgJson . name ,
245+ tag : getReleaseTag ( pkgJson . version ) ,
246+ } )
225247 } )
226- } ) ,
227- registryPackage ,
228- ]
248+
249+ const allPackages = [ ...npmPackages , registryPackage ]
229250
230251 // Filter packages to only publish those with bumped versions.
231252 const packagesToPublish = [ ]
@@ -234,6 +255,19 @@ async function publishAtCommit(sha) {
234255 const pkgJson = readPackageJsonSync ( pkg . path )
235256 const localVersion = pkgJson . version
236257
258+ // Force-include registry package if --force-registry flag is set.
259+ const isRegistryPkg = pkg . printName === '@socketsecurity/registry'
260+ const forceRegistryFlag =
261+ cliArgs . forceRegistry ||
262+ cliArgs [ 'force-registry' ] ||
263+ cliArgs [ '--' ] ?. includes ( '--force-registry' )
264+
265+ if ( isRegistryPkg && forceRegistryFlag ) {
266+ packagesToPublish . push ( pkg )
267+ logger . log ( `${ pkg . printName } : Force publishing (${ localVersion } )` )
268+ continue
269+ }
270+
237271 // Fetch the latest version from npm registry.
238272
239273 const manifest = await fetchPackageManifest ( `${ pkgJson . name } @${ pkg . tag } ` )
@@ -524,6 +558,28 @@ async function main() {
524558 return
525559 }
526560
561+ // Log if --force-registry is set.
562+ const forceRegistryFlag =
563+ cliArgs . forceRegistry ||
564+ cliArgs [ 'force-registry' ] ||
565+ cliArgs [ '--' ] ?. includes ( '--force-registry' )
566+ if ( forceRegistryFlag ) {
567+ logger . log ( 'Running with --force-registry' )
568+ logger . log (
569+ 'Registry package will be force-published regardless of version changes' ,
570+ )
571+ }
572+
573+ // Log if --skip-npm-packages is set.
574+ const skipNpmPackagesFlag =
575+ cliArgs . skipNpmPackages ||
576+ cliArgs [ 'skip-npm-packages' ] ||
577+ cliArgs [ '--' ] ?. includes ( '--skip-npm-packages' )
578+ if ( skipNpmPackagesFlag ) {
579+ logger . log ( 'Running with --skip-npm-packages' )
580+ logger . log ( 'NPM override packages (packages/*) will be skipped' )
581+ }
582+
527583 // Find all version bump commits.
528584 const bumpCommits = await findVersionBumpCommits ( )
529585
0 commit comments