| 55 | } |
| 56 | |
| 57 | async function getEnvFiles(names) { |
| 58 | names ??= (await fs.readdir(indexDirEnv)) |
| 59 | .filter(n => /^\w+\.js$/.test(n)) |
| 60 | .filter(n => !ignoreEnv.includes(n)) |
| 61 | .map(f => f.slice(0, f.length - 3)) |
| 62 | |
| 63 | return await Promise.all( |
| 64 | names.map(async name => { |
| 65 | const file = `${indexDirEnv}/${name}.js` |
| 66 | |
| 67 | return fs.stat(file).then( |
| 68 | () => [name, file], |
| 69 | () => { |
| 70 | throw new Error(`${file} could not be found.`) |
| 71 | }, |
| 72 | ) |
| 73 | }), |
| 74 | ) |
| 75 | } |
| 76 | |
| 77 | async function installLib(name, dir) { |
| 78 | return new Promise((res, rej) => { |