File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -420,14 +420,8 @@ function publishToNpm() {
420420 console . log ( chalk . yellow ( '📦 发布到 npm...' ) ) ;
421421
422422 try {
423- // 检查是否已登录 npm
424- exec ( 'npm whoami' , { allowInDryRun : true } ) ;
425-
426423 // 构建发布命令
427- let publishCmd = 'npm publish' ;
428- if ( config . publish ?. npmConfig ?. access ) {
429- publishCmd += ` --access ${ config . publish . npmConfig . access } ` ;
430- }
424+ let publishCmd = 'npm publish --access public' ;
431425 if ( config . publish ?. npmConfig ?. registry ) {
432426 publishCmd += ` --registry ${ config . publish . npmConfig . registry } ` ;
433427 }
@@ -438,7 +432,12 @@ function publishToNpm() {
438432 console . log ( chalk . green ( '✅ 已发布到 npm' ) ) ;
439433 } catch ( error ) {
440434 console . log ( chalk . red ( '❌ 发布失败' ) ) ;
441- throw error ;
435+ // 如果发布失败,提示用户手动登录后重试
436+ console . log ( chalk . yellow ( '💡 请手动登录 npm 后重试:' ) ) ;
437+ console . log ( chalk . yellow ( ' npm login --registry https://registry.npmjs.org/' ) ) ;
438+ console . log ( chalk . yellow ( ' npm publish --access public --registry https://registry.npmjs.org/' ) ) ;
439+
440+ // 不抛出错误,让后续的git推送仍能执行
442441 }
443442}
444443
You can’t perform that action at this time.
0 commit comments