File tree Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -124,9 +124,9 @@ export const release = async (options: ReleaseOptions) => {
124124
125125 await stepRunPreScripts ( options ) ;
126126
127- await stepCheckWorkspaces ( options , changedWorkspaces ) ;
127+ const publishableWorkspaces = await stepCheckWorkspaces ( options , changedWorkspaces ) ;
128128
129- await stepPublish ( options , changedWorkspaces ) ;
129+ await stepPublish ( options , publishableWorkspaces ) ;
130130
131131 await stepRunPostScripts ( options ) ;
132132} ;
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ export const stepCheckWorkspaces = async (
3030) => {
3131 const { logger } = options ;
3232 const rootWorkspaceDir = getRootWorkspaceDir ( ) ;
33+ const publishableWorkspaces : Array < YarnWorkspace > = [ ] ;
3334
3435 logger . info ( 'Checking latest versions of published packages on npmjs' ) ;
3536
@@ -38,13 +39,22 @@ export const stepCheckWorkspaces = async (
3839 const packageJson = await getWorkspacePackageJson ( workspaceDir ) ;
3940
4041 if ( packageJson . private ) {
41- logger . debug ( `[${ workspace . name } ] Package is private and will not be published` ) ;
42+ logger . debug (
43+ `[${ workspace . name } ] Package is private and will not be published`
44+ ) ;
4245 continue ;
4346 }
4447
4548 const publishedVersions = await getNpmPublishedVersions ( workspace . name ) ;
4649 if ( publishedVersions . includes ( packageJson . version ) ) {
47- throw new ValidationError ( `${ workspace . name } @${ packageJson . version } is already available on npmjs and cannot be republished` ) ;
50+ logger . warning (
51+ `[${ workspace . name } ] Version ${ packageJson . version } is already available on npmjs and cannot be republished. The package will be skipped from publishing`
52+ ) ;
53+ continue ;
4854 }
55+
56+ publishableWorkspaces . push ( workspace ) ;
4957 }
58+
59+ return publishableWorkspaces ;
5060} ;
Original file line number Diff line number Diff line change @@ -28,6 +28,11 @@ export const stepPublish = async (
2828 const { logger, dryRun } = options ;
2929 const rootWorkspaceDir = getRootWorkspaceDir ( ) ;
3030
31+ if ( ! workspacesToPublish . length ) {
32+ logger . warning ( 'No packages to publish' ) ;
33+ return ;
34+ }
35+
3136 const publishedWorkspaces : Array < PublishedWorkspace > = [ ] ;
3237
3338 for ( const workspace of workspacesToPublish ) {
You can’t perform that action at this time.
0 commit comments