@@ -2,7 +2,8 @@ import { crypto } from '@std/crypto';
2
2
import { logger } from './logger.ts' ;
3
3
import { dirname , join } from '@std/path' ;
4
4
import { copy , ensureDir , exists , expandGlob } from '@std/fs' ;
5
- import type { Graph , PackageJson } from './graph.ts' ;
5
+ import type { Graph , Project } from './graph.ts' ;
6
+ import { parseGitignore } from './gitignore.ts' ;
6
7
7
8
interface TaskCache {
8
9
hash : string ;
@@ -19,7 +20,7 @@ interface HashCache {
19
20
taskName : string ;
20
21
dependencies : {
21
22
files : string [ ] ;
22
- packageJson : PackageJson ;
23
+ project : Project ;
23
24
} ;
24
25
localDependencyHashes : string [ ] ;
25
26
} ;
@@ -230,10 +231,10 @@ export async function calculateTaskHash(
230
231
taskName : string ,
231
232
dependencies : {
232
233
files : string [ ] ;
233
- packageJson : PackageJson ;
234
+ project : Project ;
234
235
} ,
235
236
graph ?: Graph ,
236
- packageMap ?: Map < string , { packageJson : PackageJson ; cwd : string } > ,
237
+ packageMap ?: Map < string , Project > ,
237
238
affectedPackages ?: Set < string > ,
238
239
) : Promise < string > {
239
240
if ( ! globalCacheManager ) {
@@ -298,15 +299,13 @@ export async function calculateTaskHash(
298
299
if ( await exists ( gitignorePath ) ) {
299
300
const gitignore = await Deno . readTextFile ( gitignorePath ) ;
300
301
exclude . push (
301
- ...gitignore . split ( '\n' ) . map ( ( file ) => file . trim ( ) ) . filter (
302
- Boolean ,
303
- ) ,
302
+ ...parseGitignore ( gitignore ) ,
304
303
) ;
305
304
}
306
305
307
306
const depFiles = await Array . fromAsync (
308
307
expandGlob ( '**/*' , {
309
- root : depInfo . cwd ,
308
+ root : depInfo . path ,
310
309
exclude,
311
310
} ) ,
312
311
) . then ( ( files ) =>
@@ -319,7 +318,7 @@ export async function calculateTaskHash(
319
318
taskName ,
320
319
{
321
320
files : depFiles ,
322
- packageJson : depInfo . packageJson ,
321
+ project : depInfo ,
323
322
} ,
324
323
graph ,
325
324
packageMap ,
@@ -372,3 +371,5 @@ export async function hashify(input: string): Promise<string> {
372
371
373
372
return hash ;
374
373
}
374
+
375
+ export const cacheManager = await initCacheManager ( Deno . cwd ( ) ) ;
0 commit comments