initial version (template only)
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import fs from "fs";
|
||||
import { ApiVersion } from "@shopify/shopify-app-react-router/server";
|
||||
import { shopifyApiProject, ApiType } from "@shopify/api-codegen-preset";
|
||||
import type { IGraphQLConfig } from "graphql-config";
|
||||
|
||||
function getConfig() {
|
||||
const config: IGraphQLConfig = {
|
||||
projects: {
|
||||
default: shopifyApiProject({
|
||||
apiType: ApiType.Admin,
|
||||
apiVersion: ApiVersion.October25,
|
||||
documents: ["./app/**/*.{js,ts,jsx,tsx}", "./app/.server/**/*.{js,ts,jsx,tsx}"],
|
||||
outputDir: "./app/types",
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
let extensions: string[] = [];
|
||||
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}/**/*.graphql`],
|
||||
};
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
const config = getConfig();
|
||||
|
||||
export default config;
|
||||
Reference in New Issue
Block a user