@@ -120,7 +120,7 @@ const checkNewFilesAndDependencies = async (pkg, rootDir) => {
120
120
} ;
121
121
122
122
// eslint-disable-next-line complexity
123
- const ui = async ( options , { pkg, rootDir, isYarnBerry} ) => {
123
+ const ui = async ( options , { pkg, rootDir, isYarnBerry = false } ) => {
124
124
const oldVersion = pkg . version ;
125
125
const extraBaseUrls = [ 'gitlab.com' ] ;
126
126
const repoUrl = pkg . repository && githubUrlFromGit ( pkg . repository . url , { extraBaseUrls} ) ;
@@ -241,12 +241,14 @@ const ui = async (options, {pkg, rootDir, isYarnBerry}) => {
241
241
&& ! options . tag
242
242
) ;
243
243
244
+ const alreadyPublicScoped = isYarnBerry && options . runPublish && await util . getNpmPackageAccess ( pkg . name ) === 'public' ;
245
+
244
246
// Note that inquirer question.when is a bit confusing. Only `false` will cause the question to be skipped.
245
247
// Any other value like `true` and `undefined` means ask the question.
246
248
// so we make sure to always return an explicit boolean here to make it less confusing
247
249
// see https://github.com/SBoudrias/Inquirer.js/pull/1340
248
250
const needToAskForPublish = ( ( ) => {
249
- if ( ! isScoped ( pkg . name ) || ! options . availability . isAvailable || options . availability . isUnknown || ! options . runPublish ) {
251
+ if ( alreadyPublicScoped || ! isScoped ( pkg . name ) || ! options . availability . isAvailable || options . availability . isUnknown || ! options . runPublish ) {
250
252
return false ;
251
253
}
252
254
@@ -347,7 +349,7 @@ const ui = async (options, {pkg, rootDir, isYarnBerry}) => {
347
349
...options ,
348
350
version : answers . version || answers . customVersion || options . version ,
349
351
tag : answers . tag || answers . customTag || options . tag ,
350
- publishScoped : answers . publishScoped ,
352
+ publishScoped : alreadyPublicScoped || answers . publishScoped ,
351
353
confirm : true ,
352
354
repoUrl,
353
355
releaseNotes,
0 commit comments