@@ -60,10 +60,12 @@ const promises = fixtures.map((fixture) =>
6060} )
6161await Promise . all ( publishDirectories . map ( ( dir ) => rm ( dir , { recursive :true , force :true } ) ) )
6262
63- if ( NEXT_VERSION !== 'latest' ) {
64- await setNextVersionInFixture ( cwd , NEXT_VERSION , {
65- logPrefix :`[${ fixture } ] ` ,
66- } )
63+ const fixtureNextVersionSatisfied = await setNextVersionInFixture ( cwd , NEXT_VERSION , {
64+ logPrefix :`[${ fixture } ] ` ,
65+ } )
66+
67+ if ( ! fixtureNextVersionSatisfied ) {
68+ return
6769}
6870
6971let cmd = ``
@@ -79,19 +81,26 @@ const promises = fixtures.map((fixture) =>
7981await rm ( join ( cwd , 'package-lock.json' ) , { force :true } )
8082}
8183
82- const addPrefix = new Transform ( {
83- transform ( chunk , encoding , callback ) {
84- this . push ( chunk . toString ( ) . replace ( / \n / gm, `\n[${ fixture } ] ` ) )
85- callback ( )
86- } ,
87- flush ( callback ) {
88- // final transform might create non-terminated line with a prefix
89- // so this is just to make sure we end with a newline so further writes
90- // to same destination stream start on a new line for better readability
91- this . push ( '\n' )
92- callback ( )
93- } ,
94- } )
84+ const addPrefix = ( ) => {
85+ let isFirstChunk = true
86+ return new Transform ( {
87+ transform ( chunk , encoding , callback ) {
88+ if ( isFirstChunk ) {
89+ this . push ( `[${ fixture } ] ` )
90+ isFirstChunk = false
91+ }
92+ this . push ( chunk . toString ( ) . replace ( / \n / gm, `\n[${ fixture } ] ` ) )
93+ callback ( )
94+ } ,
95+ flush ( callback ) {
96+ // final transform might create non-terminated line with a prefix
97+ // so this is just to make sure we end with a newline so further writes
98+ // to same destination stream start on a new line for better readability
99+ this . push ( '\n' )
100+ callback ( )
101+ } ,
102+ } )
103+ }
95104
96105console . log ( `[${ fixture } ] Running \`${ cmd } \`...` )
97106const output = execaCommand ( cmd , {
@@ -100,16 +109,24 @@ const promises = fixtures.map((fixture) =>
100109env :{ ...process . env , FORCE_COLOR :'1' } ,
101110} )
102111if ( process . env . DEBUG ) {
103- output . stdout ?. pipe ( addPrefix ) . pipe ( process . stdout )
112+ output . stdout ?. pipe ( addPrefix ( ) ) . pipe ( process . stdout )
104113}
105- output . stderr ?. pipe ( addPrefix ) . pipe ( process . stderr )
114+ output . stderr ?. pipe ( addPrefix ( ) ) . pipe ( process . stderr )
106115return output . finally ( async ( ) => {
107- if ( NEXT_VERSION !== 'latest' ) {
108- await setNextVersionInFixture ( cwd , 'latest' , {
109- logPrefix :`[${ fixture } ] ` ,
110- operation :'revert' ,
111- } )
116+ if ( process . env . DEBUG ) {
117+ const npmListPromise = execaCommand (
118+ packageManager ?. startsWith ( 'pnpm' ) ?'pnpm list next' :'npm list next' ,
119+ { cwd, stdio :'pipe' , reject :false } ,
120+ )
121+ npmListPromise . stdout ?. pipe ( addPrefix ( ) ) . pipe ( process . stdout )
122+ npmListPromise . stderr ?. pipe ( addPrefix ( ) ) . pipe ( process . stderr )
123+ await npmListPromise
112124}
125+
126+ await setNextVersionInFixture ( cwd , 'latest' , {
127+ logPrefix :`[${ fixture } ] ` ,
128+ operation :'revert' ,
129+ } )
113130if ( output . exitCode !== 0 ) {
114131const errorMessage = `[${ fixture } ] 🚨 Failed to install dependencies or build a fixture`
115132console . error ( errorMessage )