@@ -10,7 +10,7 @@ logger.info = new Proxy(logger.info, {
1010 target . apply ( thisArg , args ) ;
1111
1212 // nx prints this message after rollup finishes and nx itself has completed building the resulting package.json
13- if ( args [ 0 ] . includes ( 'Done in' ) ) {
13+ if ( args [ 0 ] . includes ( 'Done in' ) && builtCompleteFunction ) {
1414 builtCompleteFunction ( ) ;
1515 }
1616 } ,
@@ -25,6 +25,10 @@ const rollupConfig = (config) => {
2525 const outputDir = config . output . dir ;
2626
2727 builtCompleteFunction = ( ) => {
28+ if ( path . basename ( outputDir ) === 'core' ) {
29+ return ;
30+ }
31+
2832 // STEP 1: Add @ts-rest/core to peerDependencies of all libs, except core itself
2933 // Can't let changesets handle this for us because it sees peerDependencies updates as a breaking change
3034 const packageJsonPath = path . join ( outputDir , 'package.json' ) ;
@@ -33,19 +37,19 @@ const rollupConfig = (config) => {
3337 splitVersion . splice ( - 1 , 1 , '0' ) ;
3438
3539 const peerVersion = packageJsonObject . version . includes ( '-' )
36- ? packageJsonObject . version // pre-release needs to use exact version
40+ ? packageJsonObject . version // pre-release needs to use exact version
3741 : `~${ splitVersion . join ( '.' ) } ` ;
3842
3943 packageJsonObject . peerDependencies = {
4044 ...packageJsonObject . peerDependencies ,
4145 '@ts-rest/core' : peerVersion ,
4246 } ;
4347
44- fs . writeJsonSync ( packageJsonPath , sortPackageJson ( packageJsonObject ) , { spaces : 2 } ) ;
48+ fs . writeJsonSync ( packageJsonPath , sortPackageJson ( packageJsonObject ) , {
49+ spaces : 2 ,
50+ } ) ;
4551
46- logger . info (
47- '\nAdded @ts-rest/core to peer dependencies' ,
48- ) ;
52+ logger . info ( '\nAdded @ts-rest/core to peer dependencies' ) ;
4953 } ;
5054
5155 return {
@@ -57,10 +61,8 @@ const rollupConfig = (config) => {
5761 }
5862 return config . external ( source , importer , isResolved ) ;
5963 } ,
60- plugins : [
61- ...config . plugins ,
62- ]
63- }
64- }
64+ plugins : [ ...config . plugins ] ,
65+ } ;
66+ } ;
6567
6668module . exports = rollupConfig ;
0 commit comments