From cf950c3b6eab728f32da78fb6c465bf57a579612 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 7 Sep 2023 12:05:45 +0200 Subject: [PATCH] plugins/graphiql: initial migration to new system Co-authored-by: Camila Belo Co-authored-by: Johan Haals Co-authored-by: Philipp Hugenroth Signed-off-by: Patrik Oldsberg --- .changeset/clean-houses-invent.md | 5 ++++ plugins/graphiql/package.json | 20 +++++++++++++--- plugins/graphiql/src/alpha.tsx | 38 +++++++++++++++++++++++++++++++ yarn.lock | 1 + 4 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 .changeset/clean-houses-invent.md create mode 100644 plugins/graphiql/src/alpha.tsx diff --git a/.changeset/clean-houses-invent.md b/.changeset/clean-houses-invent.md new file mode 100644 index 0000000000..fe4a252d48 --- /dev/null +++ b/.changeset/clean-houses-invent.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-graphiql': patch +--- + +Added experimental exports for the new frontend system under `/alpha`. diff --git a/plugins/graphiql/package.json b/plugins/graphiql/package.json index 406604e7f5..22af81321c 100644 --- a/plugins/graphiql/package.json +++ b/plugins/graphiql/package.json @@ -3,9 +3,7 @@ "description": "Backstage plugin for browsing GraphQL APIs", "version": "0.2.54-next.2", "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts" + "access": "public" }, "backstage": { "role": "frontend-plugin" @@ -19,6 +17,21 @@ "keywords": [ "backstage" ], + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.tsx", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.tsx" + ], + "package.json": [ + "package.json" + ] + } + }, "license": "Apache-2.0", "main": "src/index.ts", "types": "src/index.ts", @@ -34,6 +47,7 @@ "dependencies": { "@backstage/core-components": "workspace:^", "@backstage/core-plugin-api": "workspace:^", + "@backstage/frontend-plugin-api": "workspace:^", "@backstage/theme": "workspace:^", "@material-ui/core": "^4.12.2", "@material-ui/icons": "^4.9.1", diff --git a/plugins/graphiql/src/alpha.tsx b/plugins/graphiql/src/alpha.tsx new file mode 100644 index 0000000000..ff9f59c042 --- /dev/null +++ b/plugins/graphiql/src/alpha.tsx @@ -0,0 +1,38 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React from 'react'; +import { + createPageExtension, + createPlugin, +} from '@backstage/frontend-plugin-api'; + +/** + * @alpha + */ +export const GraphiqlPage = createPageExtension({ + id: 'graphiql.page', + defaultPath: '/graphiql', + component: () => import('./components').then(m => ), +}); + +/** + * @alpha + */ +export const graphiqlPlugin = createPlugin({ + id: 'graphiql', + extensions: [GraphiqlPage], +}); diff --git a/yarn.lock b/yarn.lock index e41c5ef273..c26855be76 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7200,6 +7200,7 @@ __metadata: "@backstage/core-components": "workspace:^" "@backstage/core-plugin-api": "workspace:^" "@backstage/dev-utils": "workspace:^" + "@backstage/frontend-plugin-api": "workspace:^" "@backstage/test-utils": "workspace:^" "@backstage/theme": "workspace:^" "@material-ui/core": ^4.12.2