| 4 | const fs = require('node:fs'); |
| 5 | |
| 6 | function getProjects(path) { |
| 7 | const projects = {} |
| 8 | |
| 9 | const extensions = fs.readdirSync(`./${path}`); |
| 10 | for (const entry of extensions) { |
| 11 | const extensionPath = `./${path}/${entry}`; |
| 12 | const schema = `${extensionPath}/schema.graphql`; |
| 13 | if(!fs.existsSync(schema)) { |
| 14 | continue; |
| 15 | } |
| 16 | |
| 17 | const projectName = extensionPath.substring(2).replaceAll('/', '-'); |
| 18 | projects[projectName] = { |
| 19 | schema, |
| 20 | documents: `${extensionPath}/input.graphql` |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | return projects; |
| 25 | } |
| 26 | |
| 27 | const projects = { |
| 28 | ...getProjects("sample-apps/discounts/extensions"), |