| 51 | if (stat.isDirectory()) { |
| 52 | zip.folder(file); |
| 53 | loadFile(path.join(root, file), path.join(folder, file)); |
| 54 | return; |
| 55 | } |
| 56 | |
| 57 | if (!/LICENSE.txt/.test(file)) { |
| 58 | zip.file(path.join(root, file), fs.readFileSync(path.join(folder, file))); |
| 59 | } |
| 60 | }); |
| 61 | } |
| 62 | |
| 63 | function resolveMetadataFile(configuredPath, fallbacks) { |
| 64 | if (configuredPath) { |
| 65 | const file = path.join(__dirname, configuredPath); |
| 66 | if (!fs.existsSync(file)) { |
| 67 | throw new Error(`Missing plugin metadata file: ${configuredPath}`); |
| 68 | } |
| 69 | return file; |
| 70 | } |
| 71 | |
| 72 | for (const fallback of fallbacks) { |