Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24352 from backstage/patch-release-pr-24351
Patch release of #24351
- Loading branch information
Showing
15 changed files
with
60 additions
and
194 deletions.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "root", | ||
"version": "1.26.0", | ||
"version": "1.26.1", | ||
"private": true, | ||
"repository": { | ||
"type": "git", | ||
|
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
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
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "example-app", | ||
"version": "0.2.96", | ||
"version": "0.2.97", | ||
"backstage": { | ||
"role": "frontend" | ||
}, | ||
|
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
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
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
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
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
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 |
---|---|---|
@@ -1,78 +1,3 @@ | ||
# @backstage/plugin-todo-backend | ||
# Deprecated | ||
|
||
Backend for the `@backstage/plugin-todo` plugin. Assists in scanning for and listing `// TODO` comments in source code repositories. | ||
|
||
## Installation | ||
|
||
Install the `@backstage/plugin-todo-backend` package in your backend packages, and then integrate the plugin using the following default setup for `src/plugins/todo.ts`: | ||
|
||
```ts | ||
import { Router } from 'express'; | ||
import { CatalogClient } from '@backstage/catalog-client'; | ||
import { | ||
createRouter, | ||
TodoReaderService, | ||
TodoScmReader, | ||
} from '@backstage/plugin-todo-backend'; | ||
import { PluginEnvironment } from '../types'; | ||
|
||
export default async function createPlugin( | ||
env: PluginEnvironment, | ||
): Promise<Router> { | ||
const todoReader = TodoScmReader.fromConfig(env.config, { | ||
logger: env.logger, | ||
reader: env.reader, | ||
}); | ||
|
||
const catalogClient = new CatalogClient({ | ||
discoveryApi: env.discovery, | ||
}); | ||
|
||
const todoService = new TodoReaderService({ | ||
todoReader, | ||
catalogClient, | ||
}); | ||
|
||
return await createRouter({ todoService }); | ||
} | ||
``` | ||
|
||
And then add to `packages/backend/src/index.ts`: | ||
|
||
```js | ||
// In packages/backend/src/index.ts | ||
import todo from './plugins/todo'; | ||
// ... | ||
async function main() { | ||
// ... | ||
const todoEnv = useHotMemoize(module, () => createEnv('todo')); | ||
// ... | ||
apiRouter.use('/todo', await todo(todoEnv)); | ||
``` | ||
## Scanned Files | ||
The included `TodoReaderService` and `TodoScmReader` works by getting the entity source location from the catalog. | ||
The location source code is determined automatically. In case of the source code of the component is not in the same place of the entity YAML file, you can explicitly set the value of the [`backstage.io/source-location`](https://backstage.io/docs/features/software-catalog/well-known-annotations#backstageiosource-location) annotation of the entity, and if that is missing it falls back to the [`backstage.io/managed-by-location `](https://backstage.io/docs/features/software-catalog/well-known-annotations#backstageiomanaged-by-location) annotation. Only `url` locations are currently supported, meaning locally configured `file` locations won't work. Also note that dot-files and folders are ignored. | ||
## Parser Configuration | ||
The `TodoScmReader` accepts a `TodoParser` option, which can be used to configure your own parser. The default one is based on [Leasot](https://github.com/pgilad/leasot) and supports a wide range of languages. You can add to the list of supported tags by configuring your own version of the built-in parser, for example: | ||
```ts | ||
import { | ||
TodoScmReader, | ||
createTodoParser, | ||
} from '@backstage/plugin-todo-backend'; | ||
|
||
// ... | ||
|
||
const todoReader = TodoScmReader.fromConfig(env.config, { | ||
logger: env.logger, | ||
reader: env.reader, | ||
parser: createTodoParser({ | ||
additionalTags: ['NOTE', 'XXX'], | ||
}), | ||
}); | ||
``` | ||
This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-todo-backend` instead. |
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
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
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 |
---|---|---|
@@ -1,107 +1,3 @@ | ||
# @backstage/plugin-todo | ||
# Deprecated | ||
|
||
This plugin lists `// TODO` comments in source code. It currently exports a single component extension for use on entity pages. | ||
|
||
## Setup | ||
|
||
1. Run: | ||
|
||
```bash | ||
# From your Backstage root directory | ||
yarn --cwd packages/app add @backstage/plugin-todo | ||
yarn --cwd packages/backend add @backstage/plugin-todo-backend | ||
``` | ||
|
||
2. Add the plugin backend: | ||
|
||
In a new file named `todo.ts` under `backend/src/plugins`: | ||
|
||
```js | ||
import { Router } from 'express'; | ||
import { CatalogClient } from '@backstage/catalog-client'; | ||
import { | ||
createRouter, | ||
TodoReaderService, | ||
TodoScmReader, | ||
} from '@backstage/plugin-todo-backend'; | ||
import { PluginEnvironment } from '../types'; | ||
|
||
export default async function createPlugin( | ||
env: PluginEnvironment, | ||
): Promise<Router> { | ||
const todoReader = TodoScmReader.fromConfig(env.config, { | ||
logger: env.logger, | ||
reader: env.reader, | ||
}); | ||
|
||
const catalogClient = new CatalogClient({ | ||
discoveryApi: env.discovery, | ||
}); | ||
|
||
const todoService = new TodoReaderService({ | ||
todoReader, | ||
catalogClient, | ||
}); | ||
|
||
return await createRouter({ todoService }); | ||
} | ||
``` | ||
|
||
And then add to `packages/backend/src/index.ts`: | ||
|
||
```js | ||
// In packages/backend/src/index.ts | ||
import todo from './plugins/todo'; | ||
// ... | ||
async function main() { | ||
// ... | ||
const todoEnv = useHotMemoize(module, () => createEnv('todo')); | ||
// ... | ||
apiRouter.use('/todo', await todo(todoEnv)); | ||
``` | ||
3. Add the plugin as a tab to your service entities: | ||
```jsx | ||
// In packages/app/src/components/catalog/EntityPage.tsx | ||
import { EntityTodoContent } from '@backstage/plugin-todo'; | ||
|
||
const serviceEntityPage = ( | ||
<EntityLayout> | ||
{/* other tabs... */} | ||
<EntityLayout.Route path="/todo" title="Todo"> | ||
<EntityTodoContent /> | ||
</EntityLayout.Route> | ||
``` | ||
## Format | ||
The default parser uses [Leasot](https://github.com/pgilad/leasot), which supports a wide range of languages. By default it supports the `TODO` and `FIXME` tags, along with `@` prefix and author reference through with either a `(<name>)` suffix or trailing `/<name>`. For more information on how to configure the parser, see `@backstage/plugin-todo-backend`. | ||
Below are some examples of formats that are supported by default: | ||
```ts | ||
// TODO: Ideally this would be working | ||
|
||
// TODO(Rugvip): Not sure why this works, investigate | ||
|
||
// @todo: This worked last Monday /Rugvip | ||
|
||
// FIXME Nobody knows why this is here | ||
``` | ||
Note that trailing comments are not supported, the following TODO would not be listed: | ||
```ts | ||
function reverse(str: string) { | ||
return str.reverse(); // TODO: optimize | ||
} | ||
``` | ||
The scanner also ignores all dot-files and directories, meaning TODOs inside of those will not be listed. | ||
## Extensions | ||
| name | description | | ||
| ------------------- | ------------------------------------------------------------------------------- | | ||
| `EntityTodoContent` | Content for an entity page, showing a table of TODO items for the given entity. | | ||
This package has been moved to the [backstage-community/plugins](https://github.com/backstage/community-plugins) repository. Migrate to using `@backstage-community/plugin-todo` instead. |
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