File tree Expand file tree Collapse file tree 3 files changed +35
-3
lines changed Expand file tree Collapse file tree 3 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -91,5 +91,5 @@ export const setup = (tag: GitNewTag, options: LogOptions) => {
9191
9292 if ( config ?. release ) release ( next , true ) ;
9393
94- if ( config ?. publish ) publish ( next , lerna ) ;
94+ if ( config ?. publish ) publish ( next , lerna , next ) ;
9595} ;
Original file line number Diff line number Diff line change 1+ import path from 'pathe' ;
2+ import { getRoot } from './utils' ;
3+ import { existsSync } from 'fs-extra' ;
4+
5+ export const getManager = ( ) : {
6+ tool : 'pnpm' | 'yarn' | 'bun' | 'npm' ;
7+ isMonorepoWithTool : boolean ;
8+ isPnpmWorkspace : boolean ;
9+ } => {
10+ const cwd = getRoot ( ) ;
11+
12+ const exists = ( file : string ) => existsSync ( path . join ( cwd , file ) ) ;
13+
14+ const tool = exists ( './pnpm-lock.yaml' )
15+ ? 'pnpm'
16+ : exists ( './yarn.lock' )
17+ ? 'yarn'
18+ : exists ( './bun.lock' )
19+ ? 'bun'
20+ : 'npm' ;
21+
22+ const isMonorepoWithTool = exists ( './lerna.json' ) || exists ( './nx.json' ) ;
23+ const isPnpmWorkspace = exists ( 'pnpm-workspace.yaml' ) ;
24+
25+ return { tool, isMonorepoWithTool, isPnpmWorkspace } ;
26+ } ;
Original file line number Diff line number Diff line change 11import { $ } from 'zx' ;
22import { info , success , error } from './console' ;
3+ import { getManager } from './monorepo' ;
4+ import { lastTag } from './git' ;
35
4- export const publish = ( target : string , lerna ?: boolean ) => {
6+ export const publish = ( target : string , lerna ?: boolean , tag : string = lastTag ( ) ) => {
57 info ( 'Publishing...' ) ;
68
79 if ( lerna ) {
@@ -12,7 +14,11 @@ export const publish = (target: string, lerna?: boolean) => {
1214 }
1315 } else {
1416 try {
15- $ . sync `npm publish` ;
17+ const { isPnpmWorkspace, tool } = getManager ( ) ;
18+
19+ isPnpmWorkspace && tool === 'pnpm'
20+ ? $ . sync `pnpm -r publish --access public --no-git-checks --tag ${ tag } `
21+ : $ . sync `npm publish` ;
1622 } catch ( e ) {
1723 error ( 'Unable to publish the package in NPM!' ) ;
1824 }
You can’t perform that action at this time.
0 commit comments