|
1 | 1 | import { fs, path } from "./src/deps.ts"; |
2 | 2 |
|
3 | 3 | const lookup = async () => { |
4 | | - const root = Deno.cwd(); |
5 | | - const paths = [ |
6 | | - path.join(root, "depker.config.ts"), |
7 | | - path.join(root, ".depker/depker.config.ts"), |
8 | | - path.join(root, "depker.config.js"), |
9 | | - path.join(root, ".depker/depker.config.js"), |
10 | | - path.join(root, "depker.config.cjs"), |
11 | | - path.join(root, ".depker/depker.config.cjs"), |
12 | | - path.join(root, "depker.config.mjs"), |
13 | | - path.join(root, ".depker/depker.config.mjs"), |
14 | | - ]; |
| 4 | + const paths = [] as string[]; |
| 5 | + const roots = [Deno.cwd(), Deno.build.os === "windows" ? Deno.env.get("USERPROFILE") : Deno.env.get("HOME")]; |
| 6 | + for (const r of roots) { |
| 7 | + if (r) { |
| 8 | + paths.push(path.join(r, "depker.config.ts")); |
| 9 | + paths.push(path.join(r, "depker.config.js")); |
| 10 | + paths.push(path.join(r, "depker.config.cjs")); |
| 11 | + paths.push(path.join(r, "depker.config.mjs")); |
| 12 | + paths.push(path.join(r, ".depker/depker.config.ts")); |
| 13 | + paths.push(path.join(r, ".depker/depker.config.js")); |
| 14 | + paths.push(path.join(r, ".depker/depker.config.cjs")); |
| 15 | + paths.push(path.join(r, ".depker/depker.config.mjs")); |
| 16 | + paths.push(path.join(r, ".depker/depker.ts")); |
| 17 | + paths.push(path.join(r, ".depker/depker.js")); |
| 18 | + paths.push(path.join(r, ".depker/depker.cjs")); |
| 19 | + paths.push(path.join(r, ".depker/depker.mjs")); |
| 20 | + paths.push(path.join(r, ".depker/config.ts")); |
| 21 | + paths.push(path.join(r, ".depker/config.js")); |
| 22 | + paths.push(path.join(r, ".depker/config.cjs")); |
| 23 | + paths.push(path.join(r, ".depker/config.mjs")); |
| 24 | + } |
| 25 | + } |
15 | 26 | for (const p of paths) { |
16 | 27 | if (await fs.exists(p)) { |
17 | 28 | return path.toFileUrl(p).toString(); |
|
0 commit comments