remove autodetect package

Co-authored-by: Philipp Hugenroth <philipph@spotify.com>
Co-authored-by: Johan Haals <johan.haals@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-09-05 16:02:48 +02:00
parent b3c846db5e
commit 5c8b873f79
7 changed files with 0 additions and 169 deletions
-1
View File
@@ -1 +0,0 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
-12
View File
@@ -1,12 +0,0 @@
# @backstage/autodetect
_This package was created through the Backstage CLI_.
## Installation
Install the package via Yarn:
```sh
cd <package-dir> # if within a monorepo
yarn add @backstage/autodetect
```
-19
View File
@@ -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<string, any>;
};
// @public (undocumented)
export function getAvailablePlugins(): DetectedPlugin[];
// (No @packageDocumentation comment for this package)
```
-34
View File
@@ -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:^"
}
}
-22
View File
@@ -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<string, any>;
};
const modules: Array<{ name: string; module: Record<string, any> }>;
}
-65
View File
@@ -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<string, any>;
};
/**
* @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<string, any>;
},
);
}
function isBackstagePlugin(obj: Record<string, any>): obj is BackstagePlugin {
return (
typeof obj.getId !== 'undefined' &&
typeof obj.getApis !== 'undefined' &&
typeof obj.getFeatureFlags !== 'undefined' &&
typeof obj.provide !== 'undefined'
);
}
-16
View File
@@ -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';