@@ -34,6 +34,17 @@ export async function getPackageJson({ packageDir, packagesDir }: { packageDir:
34
34
return { file : packageJsonFile , pkg, path : packageJsonPath , nicePath : path . join ( packageDir , 'package.json' ) } ;
35
35
}
36
36
37
+ export async function runPrettier ( ) {
38
+ const root = await getMonorepoRoot ( ) ;
39
+ const childProcess = Bun . spawn ( [ 'bun' , 'lint:prettier:fix' ] , {
40
+ env : process . env ,
41
+ cwd : root ,
42
+ stdout : 'inherit' ,
43
+ stderr : 'inherit' ,
44
+ } ) ;
45
+ await childProcess . exited ;
46
+ }
47
+
37
48
type PkgJsonFile = {
38
49
name : string ;
39
50
version : string ;
@@ -91,6 +102,11 @@ interface BaseProjectPackage {
91
102
tsconfigFile : BunFile ;
92
103
pkgPath : string ;
93
104
tsconfigPath : string ;
105
+ isRoot : boolean ;
106
+ isPrivate : boolean ;
107
+ isTooling : boolean ;
108
+ isConfig : boolean ;
109
+ isTest : boolean ;
94
110
pkg : PkgJsonFile ;
95
111
save : ( editStatus : { pkgEdited : boolean ; configEdited : Boolean } ) => Promise < void > ;
96
112
}
@@ -138,13 +154,14 @@ export async function walkPackages(
138
154
const dir = await getMonorepoRoot ( ) ;
139
155
const packages = await collectAllPackages ( dir ) ;
140
156
const projects = new Map < string , ProjectPackageWithTsConfig > ( ) ;
157
+ const TestDir = path . join ( dir , 'tests' ) ;
141
158
142
159
for ( const [ name , project ] of packages ) {
143
160
if ( config . excludeRoot && name === 'root' ) continue ;
144
161
if ( config . excludePrivate && project . manifest . private ) continue ;
145
162
if ( config . excludeTooling && name === '@warp-drive/internal-tooling' ) continue ;
146
163
if ( config . excludeConfig && name === '@warp-drive/config' ) continue ;
147
- if ( config . excludeTests && project . dir === 'tests' ) continue ;
164
+ if ( config . excludeTests && project . dir . startsWith ( TestDir ) ) continue ;
148
165
149
166
const pkgPath = path . join ( project . dir , 'package.json' ) ;
150
167
const tsconfigPath = path . join ( project . dir , 'tsconfig.json' ) ;
@@ -162,6 +179,11 @@ export async function walkPackages(
162
179
pkgPath,
163
180
hasTsConfig,
164
181
tsconfigPath,
182
+ isRoot : name === 'root' ,
183
+ isPrivate : project . manifest . private ?? false ,
184
+ isTooling : name === '@warp-drive/internal-tooling' ,
185
+ isConfig : name === '@warp-drive/config' ,
186
+ isTest : project . dir . startsWith ( TestDir ) ,
165
187
pkg,
166
188
tsconfig,
167
189
save : async ( { pkgEdited, configEdited } : { pkgEdited : boolean ; configEdited : Boolean } ) => {
0 commit comments