diff --git a/packages/autodetect/.eslintrc.js b/packages/autodetect/.eslintrc.js deleted file mode 100644 index e2a53a6ad2..0000000000 --- a/packages/autodetect/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); diff --git a/packages/autodetect/README.md b/packages/autodetect/README.md deleted file mode 100644 index b5d48ff3df..0000000000 --- a/packages/autodetect/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# @backstage/autodetect - -_This package was created through the Backstage CLI_. - -## Installation - -Install the package via Yarn: - -```sh -cd # if within a monorepo -yarn add @backstage/autodetect -``` diff --git a/packages/autodetect/api-report.md b/packages/autodetect/api-report.md deleted file mode 100644 index 034dd3e8f0..0000000000 --- a/packages/autodetect/api-report.md +++ /dev/null @@ -1,19 +0,0 @@ -## API Report File for "@backstage/autodetect" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts -import { BackstagePlugin } from '@backstage/core-plugin-api'; - -// @public (undocumented) -export type DetectedPlugin = { - name: string; - plugin: BackstagePlugin; - components: Record; -}; - -// @public (undocumented) -export function getAvailablePlugins(): DetectedPlugin[]; - -// (No @packageDocumentation comment for this package) -``` diff --git a/packages/autodetect/package.json b/packages/autodetect/package.json deleted file mode 100644 index 4cd00c6f8a..0000000000 --- a/packages/autodetect/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "@backstage/autodetect", - "version": "0.0.0", - "main": "src/index.ts", - "types": "src/index.ts", - "license": "Apache-2.0", - "publishConfig": { - "access": "public", - "main": "dist/index.esm.js", - "types": "dist/index.d.ts" - }, - "backstage": { - "role": "web-library" - }, - "scripts": { - "start": "backstage-cli package start", - "build": "backstage-cli package build", - "lint": "backstage-cli package lint", - "test": "backstage-cli package test", - "clean": "backstage-cli package clean", - "prepack": "backstage-cli package prepack", - "postpack": "backstage-cli package postpack" - }, - "devDependencies": { - "@backstage/cli": "workspace:^", - "@testing-library/jest-dom": "^5.10.1" - }, - "files": [ - "dist" - ], - "dependencies": { - "@backstage/core-plugin-api": "workspace:^" - } -} diff --git a/packages/autodetect/src/autodetect-plugins.d.ts b/packages/autodetect/src/autodetect-plugins.d.ts deleted file mode 100644 index a5af550743..0000000000 --- a/packages/autodetect/src/autodetect-plugins.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ -declare module '__backstage-autodetected-plugins__' { - type DetectedModule = { - name: string; - module: Record; - }; - const modules: Array<{ name: string; module: Record }>; -} diff --git a/packages/autodetect/src/index.ts b/packages/autodetect/src/index.ts deleted file mode 100644 index 67c3251290..0000000000 --- a/packages/autodetect/src/index.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 { BackstagePlugin } from '@backstage/core-plugin-api'; - -// eslint-disable-next-line @backstage/no-undeclared-imports -import { modules, DetectedModule } from '__backstage-autodetected-plugins__'; - -/** - * @public - */ -export type DetectedPlugin = { - name: string; - plugin: BackstagePlugin; - components: Record; -}; - -/** - * @public - */ -export function getAvailablePlugins(): DetectedPlugin[] { - return modules - .map(splitPluginFromComponents) - .filter((m): m is DetectedPlugin => !!m.plugin); -} - -function splitPluginFromComponents({ module, name }: DetectedModule) { - return Object.entries(module).reduce( - (acc, [k, v]) => { - if (!isBackstagePlugin(v)) { - acc.components[k] = v; - } else { - acc.plugin = v; - } - return acc; - }, - { name, components: {} } as { - name: string; - plugin?: BackstagePlugin; - components: Record; - }, - ); -} - -function isBackstagePlugin(obj: Record): obj is BackstagePlugin { - return ( - typeof obj.getId !== 'undefined' && - typeof obj.getApis !== 'undefined' && - typeof obj.getFeatureFlags !== 'undefined' && - typeof obj.provide !== 'undefined' - ); -} diff --git a/packages/autodetect/src/setupTests.ts b/packages/autodetect/src/setupTests.ts deleted file mode 100644 index 865308e634..0000000000 --- a/packages/autodetect/src/setupTests.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * 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 '@testing-library/jest-dom';