-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitHub Discussions Search Collator #1744
Open
minkimcello
wants to merge
55
commits into
backstage:main
Choose a base branch
from
guidanti:mk/github-discussions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+30,353
−0
Open
Changes from 54 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
ef464fb
Create github-discussions workspace
minkimcello 77c6476
Instantiate new backend-module
minkimcello 350ca18
Initialize new frontend plugin
minkimcello 780cc9d
Remove unnecessary files from default template
minkimcello a684d7c
Create bare collator and yield example documents
minkimcello 4ca7a27
Export collator factory
minkimcello a7c222d
Upgrade yarn to 4.5.0
minkimcello 77cc3af
Upgrade backstage to 1.32.1
minkimcello 1b82ee2
Install backstage app and backend to workspace
minkimcello 7664d01
Strip away all irrelevant plugins from app/backend
minkimcello c97aaa1
Install collator and result item to example app
minkimcello 50fbe2a
Add another example document to the collator
minkimcello 284e80a
Display title and text in result item
minkimcello 24ed620
Create a common plugin
minkimcello ff495b5
Add Github Discussion Fetcher integration
minkimcello 40a4d22
Move document type to types file
minkimcello d882d28
WIP
minkimcello 860d975
Move document type to common plugin
minkimcello 1455a83
Add category chip to search result item
minkimcello 831f0c1
Integrate github-discussions-fetcher in collator
minkimcello 6e98853
Add clickable github user chip and discussions label chips
minkimcello 1b77ed1
Upgrade fetcher to 0.2.3 and fix integration config
minkimcello e88ea1e
Provide something that looks like a logger
taras a866d92
Fix chip label and conditional logic
minkimcello 73cb3ee
Avoid passing unneeded integrations
taras 04cc648
Bump fetcher to 0.3.0
minkimcello 1c1636a
Require users to provide a cache path for discussion queries
minkimcello 91f4cc0
Allow collator schedule to be set in app-config
minkimcello 1afbf9a
Move other collator config next to schedule
minkimcello 4fc73ea
Parse and pass timeout of collator to fetcher
minkimcello 65466a1
Bump fetcher to 0.4.0
minkimcello cd4ba23
Move config out of collator
minkimcello 46dbce1
Allow cache dir to be optional and add clear boolean config
minkimcello 1a35dc6
Bump fetcher to 0.5.0
minkimcello f5cc127
Add .cache to .gitignore
minkimcello 396cba7
Make batch sizes configurable via app-config
minkimcello ed12f33
Cache arg is optional
minkimcello 0898b83
WIP app-config type validation
minkimcello b71ee85
Bump fetcher to 0.6.0
minkimcello b0309af
Add READMEs
minkimcello 29ad091
Add comments for config.d.ts
minkimcello 5fdf802
Setup first collator test
minkimcello 51a94d2
Remove @microsoft/api-extractor resolution
minkimcello 67c86c4
Add comments and re-generate report
minkimcello 01f4c07
WIP Write more tests
minkimcello d765a55
Bump fetcher to 0.7.2
minkimcello f68913f
Upgrade Effection and refactor collator
minkimcello 2115d41
Bump fetcher to 0.7.3
minkimcello 1dcde2f
Write unit tests with mock data
minkimcello 1127bee
Bump fetcher to 0.7.4
minkimcello 5ecbcd1
Fix prettier issue and dedupe lockfile
minkimcello 083999b
Merge pull request #1 from guidanti/mk/collator-tests
minkimcello f37ef0f
Run repo fix to fill in missing info
minkimcello f1adcdb
Pass root config for ScmIntegrations
minkimcello 00ae9ae
Remove .yarn
minkimcello File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Changesets | ||
|
||
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works | ||
with multi-package repos, or single-package repos to help you version and publish your code. You can | ||
find the full documentation for it [in our repository](https://github.com/changesets/changesets) | ||
|
||
We have a quick list of common questions to get you started engaging with this project in | ||
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json", | ||
"changelog": "@changesets/cli/changelog", | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "public", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.git | ||
.yarn/cache | ||
.yarn/install-state.gz | ||
node_modules | ||
packages/*/src | ||
packages/*/node_modules | ||
plugins | ||
*.local.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
playwright.config.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('../../.eslintrc.cjs'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
.cache | ||
|
||
# macOS | ||
.DS_Store | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Coverage directory generated when running tests with coverage | ||
coverage | ||
|
||
# Dependencies | ||
node_modules/ | ||
|
||
# Yarn 3 files | ||
.pnp.* | ||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions | ||
|
||
# Node version directives | ||
.nvmrc | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# Build output | ||
dist | ||
dist-types | ||
|
||
# Temporary change files created by Vim | ||
*.swp | ||
|
||
# MkDocs build output | ||
site | ||
|
||
# Local configuration files | ||
*.local.yaml | ||
|
||
# Sensitive credentials | ||
*-credentials.yaml | ||
|
||
# vscode database functionality support files | ||
*.session.sql | ||
|
||
# E2E test reports | ||
e2e-test-report/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dist | ||
dist-types | ||
coverage | ||
.vscode | ||
.eslintrc.js |
925 changes: 925 additions & 0 deletions
925
workspaces/github-discussions/.yarn/releases/yarn-4.5.0.cjs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
compressionLevel: mixed | ||
|
||
nodeLinker: node-modules | ||
|
||
yarnPath: .yarn/releases/yarn-4.5.0.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# [Backstage](https://backstage.io) | ||
|
||
This is your newly scaffolded Backstage App, Good Luck! | ||
|
||
To start the app, run: | ||
|
||
```sh | ||
yarn install | ||
yarn dev | ||
``` | ||
|
||
To generate knip reports for this app, run: | ||
|
||
```sh | ||
yarn backstage-repo-tools knip-reports | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
app: | ||
title: Scaffolded Backstage App | ||
baseUrl: http://localhost:3000 | ||
|
||
organization: | ||
name: My Company | ||
|
||
search: | ||
collators: | ||
githubDiscussions: | ||
url: https://github.com/guidanti/github-discussions-fetcher | ||
schedule: | ||
initialDelay: { seconds: 10 } | ||
timeout: { minutes: 10 } | ||
frequency: { minutes: 30 } | ||
cacheBase: file:///example/absolute/path | ||
clearCacheOnSuccess: true | ||
discussionsBatchSize: 65 | ||
commentsBatchSize: 65 | ||
repliesBatchSize: 65 | ||
|
||
backend: | ||
# Used for enabling authentication, secret is shared by all backend plugins | ||
# See https://backstage.io/docs/auth/service-to-service-auth for | ||
# information on the format | ||
# auth: | ||
# keys: | ||
# - secret: ${BACKEND_SECRET} | ||
baseUrl: http://localhost:7007 | ||
listen: | ||
port: 7007 | ||
# Uncomment the following host directive to bind to specific interfaces | ||
# host: 127.0.0.1 | ||
csp: | ||
connect-src: ["'self'", 'http:', 'https:'] | ||
# Content-Security-Policy directives follow the Helmet format: https://helmetjs.github.io/#reference | ||
# Default Helmet Content-Security-Policy values can be removed by setting the key to false | ||
cors: | ||
origin: http://localhost:3000 | ||
methods: [GET, HEAD, PATCH, POST, PUT, DELETE] | ||
credentials: true | ||
# This is for local development only, it is not recommended to use this in production | ||
# The production database configuration is stored in app-config.production.yaml | ||
database: | ||
client: better-sqlite3 | ||
connection: ':memory:' | ||
# workingDirectory: /tmp # Use this to configure a working directory for the scaffolder, defaults to the OS temp-dir | ||
|
||
integrations: | ||
github: | ||
- host: github.com | ||
# This is a Personal Access Token or PAT from GitHub. You can find out how to generate this token, and more information | ||
# about setting up the GitHub integration here: https://backstage.io/docs/integrations/github/locations#configuration | ||
token: ${GITHUB_TOKEN} | ||
### Example for how to add your GitHub Enterprise instance using the API: | ||
# - host: ghe.example.net | ||
# apiBaseUrl: https://ghe.example.net/api/v3 | ||
# token: ${GHE_TOKEN} | ||
|
||
auth: | ||
# see https://backstage.io/docs/auth/ to learn about auth providers | ||
providers: | ||
# See https://backstage.io/docs/auth/guest/provider | ||
guest: {} | ||
|
||
# see https://backstage.io/docs/permissions/getting-started for more on the permission framework | ||
permission: | ||
# setting this to `false` will disable permissions | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"version": "1.32.1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: Component | ||
metadata: | ||
name: github-discussions | ||
description: An example of a Backstage application. | ||
# Example for optional annotations | ||
# annotations: | ||
# github.com/project-slug: backstage/backstage | ||
# backstage.io/techdocs-ref: dir:. | ||
spec: | ||
type: website | ||
owner: john@example.com | ||
lifecycle: experimental |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"name": "@internal/github-discussions", | ||
"version": "1.0.0", | ||
"private": true, | ||
"engines": { | ||
"node": "18 || 20" | ||
}, | ||
"scripts": { | ||
"dev": "yarn workspaces foreach -A --include backend --include app --parallel -v -i run start", | ||
"start": "yarn workspace app start", | ||
"start-backend": "yarn workspace backend start", | ||
"tsc": "tsc", | ||
"tsc:full": "tsc --skipLibCheck false --incremental false", | ||
"build:all": "backstage-cli repo build --all", | ||
"build:api-reports": "yarn build:api-reports:only --tsc", | ||
"build:api-reports:only": "backstage-repo-tools api-reports -o --allow-all-warnings ae-wrong-input-file-type --validate-release-tags", | ||
"clean": "backstage-cli repo clean", | ||
"test": "backstage-cli repo test", | ||
"test:all": "backstage-cli repo test --coverage", | ||
"fix": "backstage-cli repo fix", | ||
"lint": "backstage-cli repo lint --since origin/main", | ||
"lint:all": "backstage-cli repo lint", | ||
"prettier:check": "prettier --check .", | ||
"new": "backstage-cli new --scope @backstage-community", | ||
"postinstall": "cd ../../ && yarn install" | ||
}, | ||
"workspaces": { | ||
"packages": [ | ||
"packages/*", | ||
"plugins/*" | ||
] | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/backstage/community-plugins", | ||
"directory": "workspaces/github-discussions" | ||
}, | ||
"devDependencies": { | ||
"@backstage/cli": "^0.28.0", | ||
"@backstage/e2e-test-utils": "^0.1.1", | ||
"@backstage/repo-tools": "^0.10.0", | ||
"@changesets/cli": "^2.27.1", | ||
"@spotify/prettier-config": "^12.0.0", | ||
"node-gyp": "^9.0.0", | ||
"prettier": "^2.3.2", | ||
"typescript": "~5.3.0" | ||
}, | ||
"dependencies": { | ||
"@backstage/plugin-search-react": "^1.8.1", | ||
"knip": "^5.27.4" | ||
}, | ||
"resolutions": { | ||
"@types/react": "^18", | ||
"@types/react-dom": "^18" | ||
}, | ||
"prettier": "@spotify/prettier-config", | ||
"lint-staged": { | ||
"*.{js,jsx,ts,tsx,mjs,cjs}": [ | ||
"eslint --fix", | ||
"prettier --write" | ||
], | ||
"*.{json,md}": [ | ||
"prettier --write" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# The Packages Folder | ||
|
||
This is where your own applications and centrally managed libraries live, each | ||
in a separate folder of its own. | ||
|
||
From the start there's an `app` folder (for the frontend) and a `backend` folder | ||
(for the Node backend), but you can also add more modules in here that house | ||
your core additions and adaptations, such as themes, common React component | ||
libraries, utilities, and similar. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); |
27 changes: 27 additions & 0 deletions
27
workspaces/github-discussions/packages/app/e2e-tests/app.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright 2020 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 { test, expect } from '@playwright/test'; | ||
|
||
test('App should render the welcome page', async ({ page }) => { | ||
await page.goto('/'); | ||
|
||
const enterButton = page.getByRole('button', { name: 'Enter' }); | ||
await expect(enterButton).toBeVisible(); | ||
await enterButton.click(); | ||
|
||
await expect(page.getByText('My Company Catalog')).toBeVisible(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"name": "app", | ||
"version": "0.0.0", | ||
"private": true, | ||
"bundled": true, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/backstage/community-plugins", | ||
"directory": "workspaces/github-discussions/packages/app" | ||
}, | ||
"backstage": { | ||
"role": "frontend" | ||
}, | ||
"scripts": { | ||
"start": "backstage-cli package start", | ||
"build": "backstage-cli package build", | ||
"clean": "backstage-cli package clean", | ||
"test": "backstage-cli package test", | ||
"lint": "backstage-cli package lint" | ||
}, | ||
"dependencies": { | ||
"@backstage-community/plugin-github-discussions": "workspace:^", | ||
"@backstage/app-defaults": "^1.5.12", | ||
"@backstage/cli": "^0.28.0", | ||
"@backstage/core-app-api": "^1.15.1", | ||
"@backstage/core-components": "^0.15.1", | ||
"@backstage/core-plugin-api": "^1.10.0", | ||
"@backstage/integration-react": "^1.2.0", | ||
"@backstage/plugin-search": "^1.4.18", | ||
"@backstage/plugin-search-react": "^1.8.1", | ||
"@backstage/theme": "^0.6.0", | ||
"@material-ui/core": "^4.12.2", | ||
"@material-ui/icons": "^4.9.1", | ||
"react": "^18.0.2", | ||
"react-dom": "^18.0.2", | ||
"react-router": "^6.3.0", | ||
"react-router-dom": "^6.3.0" | ||
}, | ||
"devDependencies": { | ||
"@backstage/test-utils": "^1.7.0", | ||
"@playwright/test": "^1.32.3", | ||
"@testing-library/dom": "^9.0.0", | ||
"@testing-library/jest-dom": "^6.0.0", | ||
"@testing-library/react": "^14.0.0", | ||
"@testing-library/user-event": "^14.0.0", | ||
"@types/react-dom": "*", | ||
"cross-env": "^7.0.0" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
}, | ||
"files": [ | ||
"dist" | ||
] | ||
} |
Binary file added
BIN
+13.3 KB
workspaces/github-discussions/packages/app/public/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.3 KB
workspaces/github-discussions/packages/app/public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+883 Bytes
workspaces/github-discussions/packages/app/public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can skip this file and the
.yarn
folder