-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GraphQL config for Remix & extensions
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
] | ||
} |