@@ -22,6 +22,7 @@ async function runConfigs(
22
22
let diffRepoStats
23
23
let diffs
24
24
25
+ let i = 0
25
26
for ( const pkgPaths of [ mainRepoPkgPaths , diffRepoPkgPaths ] ) {
26
27
let curStats = {
27
28
General : {
@@ -48,7 +49,42 @@ async function runConfigs(
48
49
}
49
50
50
51
// links local builds of the packages and installs dependencies
51
- await linkPkgs ( statsAppDir , pkgPaths )
52
+ const pkgJsonPath = path . join ( statsAppDir , 'package.json' )
53
+ const isMainRepo = i === 0
54
+ if ( isMainRepo ) {
55
+ // TODO: Remove me before merging
56
+ const original = await fs . readFile (
57
+ path . join ( statsAppDir , 'package.json' ) ,
58
+ 'utf8'
59
+ )
60
+ await fs . writeFile (
61
+ path . join ( statsAppDir , 'package.json' ) ,
62
+ original . replaceAll ( '^18.2.0' , '19.0.0-rc-7771d3a7-20240827' ) ,
63
+ 'utf8'
64
+ )
65
+ } else {
66
+ // TODO: Remove me before merging
67
+ const original = await fs . readFile (
68
+ path . join ( statsAppDir , 'package.json' ) ,
69
+ 'utf8'
70
+ )
71
+ await fs . writeFile (
72
+ path . join ( statsAppDir , 'package.json' ) ,
73
+ original . replaceAll ( '19.0.0-rc-7771d3a7-20240827' , '^18.2.0' ) ,
74
+ 'utf8'
75
+ )
76
+ }
77
+
78
+ const initialPkg = JSON . parse (
79
+ await fs . readFile ( path . join ( statsAppDir , 'package.json' ) , 'utf8' )
80
+ )
81
+
82
+ const pkgData = await linkPkgs ( statsAppDir , initialPkg , pkgPaths )
83
+ await fs . writeFile ( pkgJsonPath , JSON . stringify ( pkgData , null , 2 ) , 'utf8' )
84
+ await exec (
85
+ `cd ${ statsAppDir } && pnpm install --strict-peer-dependencies=false` ,
86
+ false
87
+ )
52
88
53
89
if ( ! diffing ) {
54
90
curStats . General . nodeModulesSize = await getDirSize (
@@ -156,6 +192,7 @@ async function runConfigs(
156
192
await exec ( `cd ${ statsAppDir } && ${ statsConfig . appBuildCommand } ` , false )
157
193
)
158
194
curStats . General . buildDurationCached = Date . now ( ) - secondBuildStart
195
+ i ++
159
196
}
160
197
161
198
logger ( `Finished running: ${ config . title } ` )
@@ -171,15 +208,12 @@ async function runConfigs(
171
208
return results
172
209
}
173
210
174
- async function linkPkgs ( pkgDir = '' , pkgPaths ) {
211
+ async function linkPkgs ( pkgDir = '' , pkgData , pkgPaths ) {
175
212
await fs . rm ( path . join ( pkgDir , 'node_modules' ) , {
176
213
recursive : true ,
177
214
force : true ,
178
215
} )
179
216
180
- const pkgJsonPath = path . join ( pkgDir , 'package.json' )
181
- const pkgData = require ( pkgJsonPath )
182
-
183
217
if ( ! pkgData . dependencies && ! pkgData . devDependencies ) return
184
218
185
219
for ( const pkg of pkgPaths . keys ( ) ) {
@@ -191,12 +225,8 @@ async function linkPkgs(pkgDir = '', pkgPaths) {
191
225
pkgData . devDependencies [ pkg ] = pkgPath
192
226
}
193
227
}
194
- await fs . writeFile ( pkgJsonPath , JSON . stringify ( pkgData , null , 2 ) , 'utf8' )
195
228
196
- await exec (
197
- `cd ${ pkgDir } && pnpm install --strict-peer-dependencies=false` ,
198
- false
199
- )
229
+ return pkgData
200
230
}
201
231
202
232
module . exports = runConfigs
0 commit comments