( root: string, options: Options & (TestOptions | MonitorOptions), featureFlags: Set<string> = new Set<string>(), )
| 37 | |
| 38 | // Force getDepsFromPlugin to return scannedProjects for processing |
| 39 | export async function getDepsFromPlugin( |
| 40 | root: string, |
| 41 | options: Options & (TestOptions | MonitorOptions), |
| 42 | featureFlags: Set<string> = new Set<string>(), |
| 43 | ): Promise<pluginApi.MultiProjectResult | MultiProjectResultCustom> { |
| 44 | if (Object.keys(multiProjectProcessors).some((key) => options[key])) { |
| 45 | const scanType = options.yarnWorkspaces ? 'yarnWorkspaces' : 'allProjects'; |
| 46 | const levelsDeep = options.detectionDepth; |
| 47 | const ignore = options.exclude ? options.exclude.split(',') : []; |
| 48 | const excludePaths = options.excludePaths |
| 49 | ? options.excludePaths |
| 50 | .split(',') |
| 51 | .map((p) => pathLib.resolve(root, p.trim())) |
| 52 | : []; |
| 53 | |
| 54 | const { files: targetFiles, allFilesFound } = await find({ |
| 55 | path: root, |
| 56 | ignore, |
| 57 | excludePaths, |
| 58 | filter: multiProjectProcessors[scanType].files, |
| 59 | featureFlags, |
| 60 | levelsDeep, |
| 61 | }); |
| 62 | debug( |
| 63 | `auto detect manifest files, found ${targetFiles.length}`, |
| 64 | targetFiles, |
| 65 | ); |
| 66 | if (targetFiles.length === 0) { |
| 67 | const error = NoSupportedManifestsFoundError([root]); |
| 68 | if (options['print-output-jsonl-with-errors']) { |
| 69 | return { |
| 70 | plugin: { name: 'custom-auto-detect' }, |
| 71 | scannedProjects: [], |
| 72 | failedResults: [ |
| 73 | { |
| 74 | targetFile: options.file, |
| 75 | error, |
| 76 | errMessage: error.userMessage, |
| 77 | }, |
| 78 | ], |
| 79 | } as MultiProjectResultCustom; |
| 80 | } |
| 81 | throw error; |
| 82 | } |
| 83 | // enable full sub-project scan for gradle |
| 84 | options.allSubProjects = true; |
| 85 | const inspectRes = await multiProjectProcessors[scanType].handler( |
| 86 | root, |
| 87 | options, |
| 88 | targetFiles, |
| 89 | featureFlags, |
| 90 | ); |
| 91 | |
| 92 | if (excludePaths.length > 0) { |
| 93 | // Workspace parsers (e.g. pnpm) discover projects by reading workspace |
| 94 | // config files rather than walking the filesystem, so they bypass the |
| 95 | // exclusion in find(). Re-apply isExcludedPath here so both code paths |
| 96 | // share the same matching semantics (including Windows case handling). |
no test coverage detected