| 2 | const apiVersion = require("@shopify/shopify-app-remix").LATEST_API_VERSION; |
| 3 | |
| 4 | function getConfig() { |
| 5 | const config = { |
| 6 | projects: { |
| 7 | shopifyAdminApi: { |
| 8 | schema: `https://shopify.dev/admin-graphql-direct-proxy/${apiVersion}`, |
| 9 | documents: ['./app/**/*.{graphql,js,ts,jsx,tsx}'] |
| 10 | } |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | let extensions = [] |
| 15 | try { |
| 16 | extensions = fs.readdirSync('./extensions'); |
| 17 | } catch { |
| 18 | // ignore if no extensions |
| 19 | } |
| 20 | |
| 21 | for (const entry of extensions) { |
| 22 | const extensionPath = `./extensions/${entry}`; |
| 23 | const schema = `${extensionPath}/schema.graphql`; |
| 24 | if(!fs.existsSync(schema)) { |
| 25 | continue; |
| 26 | } |
| 27 | config.projects[entry] = { |
| 28 | schema, |
| 29 | documents: [`${extensionPath}/input.graphql`] |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | return config; |
| 34 | } |
| 35 | |
| 36 | module.exports = getConfig(); |