From ffd5e47fb5c6338aa0e6965d687d0028e0baabb5 Mon Sep 17 00:00:00 2001 From: Kamil Wolny Date: Tue, 2 Aug 2022 10:35:51 +0100 Subject: [PATCH] feat: pr review fixes + changeset Signed-off-by: Kamil Wolny --- .changeset/silver-carpets-grin.md | 5 ++ plugins/github-issues/api-report.md | 8 +- plugins/github-issues/package.json | 4 +- .../components/GitHubIssues/GitHubIssues.tsx | 10 ++- .../src/hooks/useOctokitGraphQL.ts | 2 +- plugins/github-issues/src/index.ts | 2 + yarn.lock | 78 +------------------ 7 files changed, 23 insertions(+), 86 deletions(-) create mode 100644 .changeset/silver-carpets-grin.md diff --git a/.changeset/silver-carpets-grin.md b/.changeset/silver-carpets-grin.md new file mode 100644 index 0000000000..9865393631 --- /dev/null +++ b/.changeset/silver-carpets-grin.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-github-issues': minor +--- + +New plugin for displaying GitHub Issues added diff --git a/plugins/github-issues/api-report.md b/plugins/github-issues/api-report.md index 6679fec610..8c77aaf674 100644 --- a/plugins/github-issues/api-report.md +++ b/plugins/github-issues/api-report.md @@ -8,8 +8,6 @@ import { BackstagePlugin } from '@backstage/core-plugin-api'; import { RouteRef } from '@backstage/core-plugin-api'; -// Warning: (ae-forgotten-export) The symbol "GitHubIssuesProps" needs to be exported by the entry point index.d.ts -// // @public (undocumented) export const GitHubIssuesCard: ({ itemsPerPage, @@ -31,5 +29,11 @@ export const gitHubIssuesPlugin: BackstagePlugin< {} >; +// @public (undocumented) +export type GitHubIssuesProps = { + itemsPerPage?: number; + itemsPerRepo?: number; +}; + // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/github-issues/package.json b/plugins/github-issues/package.json index 861a67ffa2..74f108cd94 100644 --- a/plugins/github-issues/package.json +++ b/plugins/github-issues/package.json @@ -32,9 +32,9 @@ "@material-ui/core": "^4.12.4", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "^4.0.0-alpha.61", - "@octokit/rest": "^18.12.0", "@types/react": "^16.13.1 || ^17.0.0", "luxon": "^2.4.0", + "octokit": "^2.0.4", "react-use": "^17.2.4" }, "peerDependencies": { @@ -52,7 +52,7 @@ "@types/jest": "*", "@types/node": "*", "cross-fetch": "^3.1.5", - "msw": "^0.42.0", + "msw": "^0.44.0", "prettier": "^2.7.1" }, "files": [ diff --git a/plugins/github-issues/src/components/GitHubIssues/GitHubIssues.tsx b/plugins/github-issues/src/components/GitHubIssues/GitHubIssues.tsx index e873028060..5380c8eb22 100644 --- a/plugins/github-issues/src/components/GitHubIssues/GitHubIssues.tsx +++ b/plugins/github-issues/src/components/GitHubIssues/GitHubIssues.tsx @@ -28,15 +28,17 @@ import { import { IssueList } from './IssuesList'; import { NoRepositoriesInfo } from './NoRepositoriesInfo'; +/** + * @public + */ export type GitHubIssuesProps = { itemsPerPage?: number; itemsPerRepo?: number; }; -export const GitHubIssues = ({ - itemsPerPage = 10, - itemsPerRepo = 40, -}: GitHubIssuesProps) => { +export const GitHubIssues = (props: GitHubIssuesProps) => { + const { itemsPerPage = 10, itemsPerRepo = 40 } = props; + const [isLoading, setIsLoading] = React.useState(true); const [issuesByRepository, setIssuesByRepository] = diff --git a/plugins/github-issues/src/hooks/useOctokitGraphQL.ts b/plugins/github-issues/src/hooks/useOctokitGraphQL.ts index e408360c53..6b783efd6f 100644 --- a/plugins/github-issues/src/hooks/useOctokitGraphQL.ts +++ b/plugins/github-issues/src/hooks/useOctokitGraphQL.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Octokit } from '@octokit/rest'; +import { Octokit } from 'octokit'; import { useApi, githubAuthApiRef, diff --git a/plugins/github-issues/src/index.ts b/plugins/github-issues/src/index.ts index 7905d2fba2..5f6c248db7 100644 --- a/plugins/github-issues/src/index.ts +++ b/plugins/github-issues/src/index.ts @@ -18,3 +18,5 @@ export { GitHubIssuesPage, GitHubIssuesCard, } from './plugin'; + +export type { GitHubIssuesProps } from './components/GitHubIssues'; diff --git a/yarn.lock b/yarn.lock index 44409c647b..3b60557a67 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5431,19 +5431,6 @@ before-after-hook "^2.1.0" universal-user-agent "^6.0.0" -"@octokit/core@^3.5.1": - version "3.6.0" - resolved "https://registry.npmjs.org/@octokit/core/-/core-3.6.0.tgz#3376cb9f3008d9b3d110370d90e0a1fcd5fe6085" - integrity sha512-7RKRKuA4xTjMhY+eG3jthb3hlZCsOwg3rztWh75Xc+ShDWOfDDATWbeZpAHBNRpm4Tv9WgBMOy1zEJYXG6NJ7Q== - dependencies: - "@octokit/auth-token" "^2.4.4" - "@octokit/graphql" "^4.5.8" - "@octokit/request" "^5.6.3" - "@octokit/request-error" "^2.0.5" - "@octokit/types" "^6.0.3" - before-after-hook "^2.2.0" - universal-user-agent "^6.0.0" - "@octokit/core@^4.0.0": version "4.0.2" resolved "https://registry.npmjs.org/@octokit/core/-/core-4.0.2.tgz#4eaf9c5fd39913b541c5e31a2b8fdc3cf50480bc" @@ -5560,11 +5547,6 @@ resolved "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-11.2.0.tgz#b38d7fc3736d52a1e96b230c1ccd4a58a2f400a6" integrity sha512-PBsVO+15KSlGmiI8QAzaqvsNlZlrDlyAJYcrXBCvVUxCp7VnXjkwPoFHgjEJXx3WF9BAwkA6nfCUA7i9sODzKA== -"@octokit/openapi-types@^12.11.0": - version "12.11.0" - resolved "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-12.11.0.tgz#da5638d64f2b919bca89ce6602d059f1b52d3ef0" - integrity sha512-VsXyi8peyRq9PqIz/tpqiL2w3w80OgVMwBHltTml3LmVvXiphgeqmY9mvBw9Wu7e0QWk/fqD37ux8yP5uVekyQ== - "@octokit/openapi-types@^12.4.0": version "12.4.0" resolved "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-12.4.0.tgz#fd8bf5db72bd566c5ba2cb76754512a9ebe66e71" @@ -5585,13 +5567,6 @@ resolved "https://registry.npmjs.org/@octokit/plugin-enterprise-rest/-/plugin-enterprise-rest-6.0.1.tgz#e07896739618dab8da7d4077c658003775f95437" integrity sha512-93uGjlhUD+iNg1iWhUENAtJata6w5nE+V4urXOAlIXdco6xNZtUSfYY8dzp3Udy74aqO/B5UZL80x/YMa5PKRw== -"@octokit/plugin-paginate-rest@^2.16.8": - version "2.21.3" - resolved "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.21.3.tgz#7f12532797775640dbb8224da577da7dc210c87e" - integrity sha512-aCZTEf0y2h3OLbrgKkrfFdjRL6eSOo8komneVQJnYecAxIej7Bafor2xhuDJOIFau4pk0i/P28/XgtbyPF0ZHw== - dependencies: - "@octokit/types" "^6.40.0" - "@octokit/plugin-paginate-rest@^2.6.2": version "2.7.0" resolved "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.7.0.tgz#6bb7b043c246e0654119a6ec4e72a172c9e2c7f3" @@ -5624,14 +5599,6 @@ "@octokit/types" "^6.16.2" deprecation "^2.3.1" -"@octokit/plugin-rest-endpoint-methods@^5.12.0": - version "5.16.2" - resolved "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.16.2.tgz#7ee8bf586df97dd6868cf68f641354e908c25342" - integrity sha512-8QFz29Fg5jDuTPXVtey05BLm7OB+M8fnvE64RNegzX7U+5NUXcOcnpTIK0YfSHBg8gYd0oxIq3IZTe9SfPZiRw== - dependencies: - "@octokit/types" "^6.39.0" - deprecation "^2.3.1" - "@octokit/plugin-rest-endpoint-methods@^6.0.0": version "6.0.0" resolved "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-6.0.0.tgz#e4a55d83ec5a00e6b4d7a780f4ec9009095bff6f" @@ -5708,16 +5675,6 @@ "@octokit/plugin-request-log" "^1.0.2" "@octokit/plugin-rest-endpoint-methods" "5.3.1" -"@octokit/rest@^18.12.0": - version "18.12.0" - resolved "https://registry.npmjs.org/@octokit/rest/-/rest-18.12.0.tgz#f06bc4952fc87130308d810ca9d00e79f6988881" - integrity sha512-gDPiOHlyGavxr72y0guQEhLsemgVjwRePayJ+FcKc2SJqKUbxbkvf5kAZEWA/MKvsfYlQAMVzNJE3ezQcxMJ2Q== - dependencies: - "@octokit/core" "^3.5.1" - "@octokit/plugin-paginate-rest" "^2.16.8" - "@octokit/plugin-request-log" "^1.0.4" - "@octokit/plugin-rest-endpoint-methods" "^5.12.0" - "@octokit/rest@^19.0.3": version "19.0.3" resolved "https://registry.npmjs.org/@octokit/rest/-/rest-19.0.3.tgz#b9a4e8dc8d53e030d611c053153ee6045f080f02" @@ -5763,13 +5720,6 @@ dependencies: "@octokit/openapi-types" "^12.7.0" -"@octokit/types@^6.40.0": - version "6.41.0" - resolved "https://registry.npmjs.org/@octokit/types/-/types-6.41.0.tgz#e58ef78d78596d2fb7df9c6259802464b5f84a04" - integrity sha512-eJ2jbzjdijiL3B4PrSQaSjuF2sPEQPVCPzBvTHJD9Nz+9dw2SGH4K4xeQJ77YfTq5bRQ+bD8wT11JbeDPmxmGg== - dependencies: - "@octokit/openapi-types" "^12.11.0" - "@octokit/webhooks-methods@^3.0.0": version "3.0.0" resolved "https://registry.npmjs.org/@octokit/webhooks-methods/-/webhooks-methods-3.0.0.tgz#4f4443605233f46abc5f85a857ba105095aa1181" @@ -19310,32 +19260,6 @@ msw@^0.39.2: type-fest "^1.2.2" yargs "^17.3.1" -msw@^0.42.0: - version "0.42.3" - resolved "https://registry.npmjs.org/msw/-/msw-0.42.3.tgz#150c475e2cb6d53c67503bd0e3f6251bfd075328" - integrity sha512-zrKBIGCDsNUCZLd3DLSeUtRruZ0riwJgORg9/bSDw3D0PTI8XUGAK3nC0LJA9g0rChGuKaWK/SwObA8wpFrz4g== - dependencies: - "@mswjs/cookies" "^0.2.0" - "@mswjs/interceptors" "^0.16.3" - "@open-draft/until" "^1.0.3" - "@types/cookie" "^0.4.1" - "@types/js-levenshtein" "^1.1.1" - chalk "4.1.1" - chokidar "^3.4.2" - cookie "^0.4.2" - graphql "^16.3.0" - headers-polyfill "^3.0.4" - inquirer "^8.2.0" - is-node-process "^1.0.1" - js-levenshtein "^1.1.6" - node-fetch "^2.6.7" - outvariant "^1.3.0" - path-to-regexp "^6.2.0" - statuses "^2.0.0" - strict-event-emitter "^0.2.0" - type-fest "^1.2.2" - yargs "^17.3.1" - msw@^0.43.0: version "0.43.1" resolved "https://registry.npmjs.org/msw/-/msw-0.43.1.tgz#57cb4af56f07442e8a6d14d76032a0ab41434256" @@ -20090,7 +20014,7 @@ octokit-plugin-create-pull-request@^3.10.0: dependencies: "@octokit/types" "^6.8.2" -octokit@^2.0.0: +octokit@^2.0.0, octokit@^2.0.4: version "2.0.4" resolved "https://registry.npmjs.org/octokit/-/octokit-2.0.4.tgz#cfd3adee6b775d3fa8cd8746590bed36127cc0a0" integrity sha512-9QvgYGzrSTGmr3koSGtbgeMgqYI20QI0Vv8Bk9y6phchk6L2aHFhcrUOIeNUPj1Z+KZnEBd6A/8faNpDFNfVjg==