From 4698e1f4d43b26c11d71192e267d5e9f950096a7 Mon Sep 17 00:00:00 2001 From: MT Lewis Date: Wed, 24 Jul 2024 18:04:13 +0100 Subject: [PATCH] techdocs: add common package for annotation constants Signed-off-by: MT Lewis --- .changeset/quick-roses-juggle.md | 5 +++ plugins/techdocs-backend/package.json | 1 + plugins/techdocs-common/.eslintrc.js | 1 + plugins/techdocs-common/README.md | 3 ++ plugins/techdocs-common/api-report.md | 11 +++++ plugins/techdocs-common/catalog-info.yaml | 11 +++++ plugins/techdocs-common/package.json | 52 +++++++++++++++++++++++ plugins/techdocs-common/src/constants.ts | 20 +++++++++ plugins/techdocs-common/src/index.test.ts | 24 +++++++++++ plugins/techdocs-common/src/index.ts | 22 ++++++++++ plugins/techdocs-node/package.json | 1 + plugins/techdocs-react/package.json | 1 + plugins/techdocs/package.json | 1 + 13 files changed, 153 insertions(+) create mode 100644 .changeset/quick-roses-juggle.md create mode 100644 plugins/techdocs-common/.eslintrc.js create mode 100644 plugins/techdocs-common/README.md create mode 100644 plugins/techdocs-common/api-report.md create mode 100644 plugins/techdocs-common/catalog-info.yaml create mode 100644 plugins/techdocs-common/package.json create mode 100644 plugins/techdocs-common/src/constants.ts create mode 100644 plugins/techdocs-common/src/index.test.ts create mode 100644 plugins/techdocs-common/src/index.ts diff --git a/.changeset/quick-roses-juggle.md b/.changeset/quick-roses-juggle.md new file mode 100644 index 0000000000..981bd8591a --- /dev/null +++ b/.changeset/quick-roses-juggle.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-techdocs-common': minor +--- + +Initial release of the techdocs-common package. diff --git a/plugins/techdocs-backend/package.json b/plugins/techdocs-backend/package.json index 0bf2381a8c..fc862ad909 100644 --- a/plugins/techdocs-backend/package.json +++ b/plugins/techdocs-backend/package.json @@ -8,6 +8,7 @@ "pluginPackages": [ "@backstage/plugin-techdocs", "@backstage/plugin-techdocs-backend", + "@backstage/plugin-techdocs-common", "@backstage/plugin-techdocs-node", "@backstage/plugin-techdocs-react" ] diff --git a/plugins/techdocs-common/.eslintrc.js b/plugins/techdocs-common/.eslintrc.js new file mode 100644 index 0000000000..e2a53a6ad2 --- /dev/null +++ b/plugins/techdocs-common/.eslintrc.js @@ -0,0 +1 @@ +module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); diff --git a/plugins/techdocs-common/README.md b/plugins/techdocs-common/README.md new file mode 100644 index 0000000000..be8bf64d0b --- /dev/null +++ b/plugins/techdocs-common/README.md @@ -0,0 +1,3 @@ +# @backstage/plugin-techdocs-common + +Common functionality for TechDocs diff --git a/plugins/techdocs-common/api-report.md b/plugins/techdocs-common/api-report.md new file mode 100644 index 0000000000..c7e1829a28 --- /dev/null +++ b/plugins/techdocs-common/api-report.md @@ -0,0 +1,11 @@ +## API Report File for "@backstage/plugin-techdocs-common" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +// @public (undocumented) +export const TECHDOCS_ANNOTATION = 'backstage.io/techdocs-ref'; + +// @public (undocumented) +export const TECHDOCS_EXTERNAL_ANNOTATION = 'backstage.io/techdocs-entity'; +``` diff --git a/plugins/techdocs-common/catalog-info.yaml b/plugins/techdocs-common/catalog-info.yaml new file mode 100644 index 0000000000..16c7e66638 --- /dev/null +++ b/plugins/techdocs-common/catalog-info.yaml @@ -0,0 +1,11 @@ +apiVersion: backstage.io/v1alpha1 +kind: Component +metadata: + name: backstage-plugin-techdocs-common + title: '@backstage/plugin-techdocs-common' + description: >- + Common functionality for TechDocs +spec: + lifecycle: production + type: backstage-common-library + owner: techdocs-maintainers diff --git a/plugins/techdocs-common/package.json b/plugins/techdocs-common/package.json new file mode 100644 index 0000000000..3e9eebbd23 --- /dev/null +++ b/plugins/techdocs-common/package.json @@ -0,0 +1,52 @@ +{ + "name": "@backstage/plugin-techdocs-common", + "version": "0.0.0", + "description": "Common functionality for TechDocs", + "backstage": { + "role": "common-library", + "pluginId": "techdocs", + "pluginPackages": [ + "@backstage/plugin-techdocs", + "@backstage/plugin-techdocs-backend", + "@backstage/plugin-techdocs-common", + "@backstage/plugin-techdocs-node", + "@backstage/plugin-techdocs-react" + ] + }, + "publishConfig": { + "access": "public", + "main": "dist/index.cjs.js", + "types": "dist/index.d.ts" + }, + "keywords": [ + "backstage", + "techdocs" + ], + "homepage": "https://backstage.io", + "repository": { + "type": "git", + "url": "https://github.com/backstage/backstage", + "directory": "plugins/techdocs-common" + }, + "bugs": { + "url": "https://github.com/backstage/backstage/issues" + }, + "license": "Apache-2.0", + "sideEffects": false, + "main": "src/index.ts", + "types": "src/index.ts", + "files": [ + "dist" + ], + "scripts": { + "build": "backstage-cli package build", + "clean": "backstage-cli package clean", + "lint": "backstage-cli package lint", + "prepack": "backstage-cli package prepack", + "postpack": "backstage-cli package postpack", + "test": "backstage-cli package test" + }, + "devDependencies": { + "@backstage/cli": "workspace:^" + } +} diff --git a/plugins/techdocs-common/src/constants.ts b/plugins/techdocs-common/src/constants.ts new file mode 100644 index 0000000000..40187f41ce --- /dev/null +++ b/plugins/techdocs-common/src/constants.ts @@ -0,0 +1,20 @@ +/* + * Copyright 2024 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. + */ + +/** @public */ +export const TECHDOCS_ANNOTATION = 'backstage.io/techdocs-ref'; +/** @public */ +export const TECHDOCS_EXTERNAL_ANNOTATION = 'backstage.io/techdocs-entity'; diff --git a/plugins/techdocs-common/src/index.test.ts b/plugins/techdocs-common/src/index.test.ts new file mode 100644 index 0000000000..555aa06f4c --- /dev/null +++ b/plugins/techdocs-common/src/index.test.ts @@ -0,0 +1,24 @@ +/* + * Copyright 2024 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 * as anything from './'; + +describe('techdocs-common', () => { + // TODO: Test real things once they exist. + it('should exist', () => { + expect(anything).toBeTruthy(); + }); +}); diff --git a/plugins/techdocs-common/src/index.ts b/plugins/techdocs-common/src/index.ts new file mode 100644 index 0000000000..d5e7818f50 --- /dev/null +++ b/plugins/techdocs-common/src/index.ts @@ -0,0 +1,22 @@ +/* + * Copyright 2024 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. + */ + +/** + * Common functionality for TechDocs + * + * @packageDocumentation + */ +export * from './constants'; diff --git a/plugins/techdocs-node/package.json b/plugins/techdocs-node/package.json index 615a0b7235..94711e8933 100644 --- a/plugins/techdocs-node/package.json +++ b/plugins/techdocs-node/package.json @@ -8,6 +8,7 @@ "pluginPackages": [ "@backstage/plugin-techdocs", "@backstage/plugin-techdocs-backend", + "@backstage/plugin-techdocs-common", "@backstage/plugin-techdocs-node", "@backstage/plugin-techdocs-react" ] diff --git a/plugins/techdocs-react/package.json b/plugins/techdocs-react/package.json index 2db27e2c60..ae1f72c8c9 100644 --- a/plugins/techdocs-react/package.json +++ b/plugins/techdocs-react/package.json @@ -8,6 +8,7 @@ "pluginPackages": [ "@backstage/plugin-techdocs", "@backstage/plugin-techdocs-backend", + "@backstage/plugin-techdocs-common", "@backstage/plugin-techdocs-node", "@backstage/plugin-techdocs-react" ] diff --git a/plugins/techdocs/package.json b/plugins/techdocs/package.json index b1717ce92e..2992c7a067 100644 --- a/plugins/techdocs/package.json +++ b/plugins/techdocs/package.json @@ -8,6 +8,7 @@ "pluginPackages": [ "@backstage/plugin-techdocs", "@backstage/plugin-techdocs-backend", + "@backstage/plugin-techdocs-common", "@backstage/plugin-techdocs-node", "@backstage/plugin-techdocs-react" ]