From 8fc45676bf14c9d4389a7fb8934aa7712e0935e6 Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 10 Aug 2020 11:46:54 +0200 Subject: [PATCH] chore(gql/catalog): fixing bundling of graphql asse --- plugins/catalog-graphql/package.json | 3 ++- plugins/catalog-graphql/src/graphql/module.ts | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index be5c585186..d339119901 100644 --- a/plugins/catalog-graphql/package.json +++ b/plugins/catalog-graphql/package.json @@ -44,6 +44,7 @@ "supertest": "^4.0.2" }, "files": [ - "dist" + "dist", + "schema.gql" ] } diff --git a/plugins/catalog-graphql/src/graphql/module.ts b/plugins/catalog-graphql/src/graphql/module.ts index 772e472d1b..eb4c550819 100644 --- a/plugins/catalog-graphql/src/graphql/module.ts +++ b/plugins/catalog-graphql/src/graphql/module.ts @@ -28,13 +28,15 @@ export interface ModuleOptions { config: Config; } +const schemaPath = path.resolve( + require.resolve('@backstage/plugin-graphql-backend/package.json'), + '../schema.gql', +); + export async function createModule( options: ModuleOptions, ): Promise { - const typeDefs = await fs.promises.readFile( - path.resolve(__dirname, '..', 'schema.gql'), - 'utf-8', - ); + const typeDefs = await fs.promises.readFile(schemaPath, 'utf-8'); const catalogClient = new CatalogClient( options.config.getString('backend.baseUrl'),