()
| 16 | } |
| 17 | |
| 18 | async function getLocalPackageDir() { |
| 19 | const proposedDirs = [ |
| 20 | getContainerDir(), |
| 21 | resolve(process.cwd(), 'node_modules'), |
| 22 | resolve(process.cwd(), '..', 'node_modules'), |
| 23 | resolve(process.cwd(), '..', '..', 'node_modules'), |
| 24 | resolve(process.cwd(), '..', '..', '..', 'node_modules'), |
| 25 | ]; |
| 26 | |
| 27 | // Right now we always take the first one, but in the future this may be different |
| 28 | // once we come up with more / better criteria to identify if its a good/valid |
| 29 | // plugin root directory |
| 30 | for (const dir of proposedDirs.filter(Boolean)) { |
| 31 | log('generalDebug_0003', `Checking for potential plugin directory "${dir}" ...`); |
| 32 | |
| 33 | if (await isValidModulesDirectory(dir)) { |
| 34 | return dir; |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | return undefined; |
| 39 | } |
| 40 | |
| 41 | function isValidModulesDirectory(dir: string) { |
| 42 | return isDirectory(resolve(dir, 'piral-cli')); |
no test coverage detected