-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiscover.js
More file actions
23 lines (18 loc) · 717 Bytes
/
discover.js
File metadata and controls
23 lines (18 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import {join, relative} from 'node:path';
import {isGitIgnored, isDynamicPattern, globby} from 'globby';
/**
* @param {import('../index').SequenceUnion} ctx
*/
export default async function discover(ctx) {
const manifest = [];
const isIgnored = await isGitIgnored({cwd: ctx.directory});
for (const file of ctx.config.files) {
const found = isDynamicPattern(file, {cwd: ctx.directory})
? await globby(file, {cwd: ctx.directory})
: [file];
manifest.push(...found.map(path => relative(ctx.directory, path)));
ctx.log(`steps(discover): Found ${found.length} files in ${file}`);
}
return manifest.filter(file => !isIgnored(file))
.map(file => join(ctx.directory, file));
}