From fb0e84df1c60d1de65040afbc7b66d3eab8dae97 Mon Sep 17 00:00:00 2001 From: Taras Mankovski Date: Wed, 7 Feb 2024 19:02:04 -0500 Subject: [PATCH 1/2] Added default exports to graphql modules --- .changeset/slimy-cooks-relate.md | 24 +++++++++++++++++++ .../src/index.ts | 1 + plugins/graphql-backend/src/index.ts | 1 + 3 files changed, 26 insertions(+) create mode 100644 .changeset/slimy-cooks-relate.md diff --git a/.changeset/slimy-cooks-relate.md b/.changeset/slimy-cooks-relate.md new file mode 100644 index 0000000000..f47205e393 --- /dev/null +++ b/.changeset/slimy-cooks-relate.md @@ -0,0 +1,24 @@ +--- +'@frontside/backstage-plugin-graphql-backend-module-catalog': patch +'@frontside/backstage-plugin-graphql-backend': patch +--- + +Make module default exports to allow using import syntax + +This change allows to use import syntax to load modules + +```ts +import { createBackend } from '@backstage/backend-defaults'; +- import { graphqlPlugin } from '@frontside/backstage-plugin-graphql-backend'; +- import { graphqlModuleCatalog } from '@frontside/backstage-plugin-graphql-backend-module-catalog'; + +const backend = createBackend(); + + +- backend.add(graphqlPlugin()); ++ backend.add(import('@frontside/backstage-plugin-graphql-backend')); +- backend.add(graphqlModuleCatalog()); ++ backend.add(import('@frontside/backstage-plugin-graphql-backend-module-catalog')); + +backend.start(); +``` diff --git a/plugins/graphql-backend-module-catalog/src/index.ts b/plugins/graphql-backend-module-catalog/src/index.ts index efedbcebf4..8b8b7477ce 100644 --- a/plugins/graphql-backend-module-catalog/src/index.ts +++ b/plugins/graphql-backend-module-catalog/src/index.ts @@ -4,3 +4,4 @@ export * from './relation'; export * from './catalogModule'; export * from './relationModule'; export * from './entitiesLoadFn'; +export { graphqlModuleCatalog as default } from './catalogModule'; \ No newline at end of file diff --git a/plugins/graphql-backend/src/index.ts b/plugins/graphql-backend/src/index.ts index a4fa32bbf1..0e7ed91675 100644 --- a/plugins/graphql-backend/src/index.ts +++ b/plugins/graphql-backend/src/index.ts @@ -1,3 +1,4 @@ export * from './graphql'; export * from './router'; export * from '@frontside/backstage-plugin-graphql-backend-node'; +export { graphqlPlugin as default } from './graphql'; \ No newline at end of file From 1e09425032b3717c27131774bbc78933dd68c107 Mon Sep 17 00:00:00 2001 From: Taras Mankovski Date: Thu, 8 Feb 2024 09:26:52 -0500 Subject: [PATCH 2/2] Update slimy-cooks-relate.md --- .changeset/slimy-cooks-relate.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.changeset/slimy-cooks-relate.md b/.changeset/slimy-cooks-relate.md index f47205e393..8a358399ca 100644 --- a/.changeset/slimy-cooks-relate.md +++ b/.changeset/slimy-cooks-relate.md @@ -7,18 +7,18 @@ Make module default exports to allow using import syntax This change allows to use import syntax to load modules -```ts +```diff import { createBackend } from '@backstage/backend-defaults'; -- import { graphqlPlugin } from '@frontside/backstage-plugin-graphql-backend'; -- import { graphqlModuleCatalog } from '@frontside/backstage-plugin-graphql-backend-module-catalog'; +-import { graphqlPlugin } from '@frontside/backstage-plugin-graphql-backend'; +-import { graphqlModuleCatalog } from '@frontside/backstage-plugin-graphql-backend-module-catalog'; const backend = createBackend(); -- backend.add(graphqlPlugin()); -+ backend.add(import('@frontside/backstage-plugin-graphql-backend')); -- backend.add(graphqlModuleCatalog()); -+ backend.add(import('@frontside/backstage-plugin-graphql-backend-module-catalog')); +-backend.add(graphqlPlugin()); ++backend.add(import('@frontside/backstage-plugin-graphql-backend')); +-backend.add(graphqlModuleCatalog()); ++backend.add(import('@frontside/backstage-plugin-graphql-backend-module-catalog')); backend.start(); ```