Skip to content

Commit

Permalink
Add GraphQL config for Remix & extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
shauns committed Jul 18, 2023
1 parent 214b981 commit 2762faa
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .graphqlrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const fs = require('node:fs');

function getConfig() {
const config = {
projects: {
shopifyAdminApi: {
schema: 'https://shopify.dev/admin-graphql-direct-proxy/2023-07',
documents: ['./app/**/*.{graphql,js,ts,jsx,tsx}']
}
}
}

let extensions = []
try {
extensions = fs.readdirSync('./extensions');
} catch {
// ignore if no extensions
}

for (const entry of extensions) {
const extensionPath = `./extensions/${entry}`;
const schema = `${extensionPath}/schema.graphql`;
if(!fs.existsSync(schema)) {
continue;
}
config.projects[entry] = {
schema,
documents: [`${extensionPath}/input.graphql`]
}
}

return config;
}

module.exports = getConfig();
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"recommendations": [
"orsenkucher.vscode-graphql",
"graphql.vscode-graphql",
"shopify.polaris-for-vscode"
]
}

0 comments on commit 2762faa

Please sign in to comment.