From 2729e06d28747a8fe5036470353bfc384f4cd203 Mon Sep 17 00:00:00 2001 From: Vincenzo Scamporlino Date: Tue, 18 Jul 2023 10:38:37 +0200 Subject: [PATCH] create autodetect plugin Signed-off-by: Vincenzo Scamporlino --- packages/autodetect/.eslintrc.js | 1 + packages/autodetect/README.md | 12 +++++++++++ packages/autodetect/package.json | 31 +++++++++++++++++++++++++++ packages/autodetect/src/index.ts | 22 +++++++++++++++++++ packages/autodetect/src/setupTests.ts | 16 ++++++++++++++ 5 files changed, 82 insertions(+) create mode 100644 packages/autodetect/.eslintrc.js create mode 100644 packages/autodetect/README.md create mode 100644 packages/autodetect/package.json create mode 100644 packages/autodetect/src/index.ts create mode 100644 packages/autodetect/src/setupTests.ts diff --git a/packages/autodetect/.eslintrc.js b/packages/autodetect/.eslintrc.js new file mode 100644 index 0000000000..e2a53a6ad2 --- /dev/null +++ b/packages/autodetect/.eslintrc.js @@ -0,0 +1 @@ +module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); diff --git a/packages/autodetect/README.md b/packages/autodetect/README.md new file mode 100644 index 0000000000..b5d48ff3df --- /dev/null +++ b/packages/autodetect/README.md @@ -0,0 +1,12 @@ +# @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/package.json b/packages/autodetect/package.json new file mode 100644 index 0000000000..dc3684a6bf --- /dev/null +++ b/packages/autodetect/package.json @@ -0,0 +1,31 @@ +{ + "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" + ] +} diff --git a/packages/autodetect/src/index.ts b/packages/autodetect/src/index.ts new file mode 100644 index 0000000000..4cc4c191f3 --- /dev/null +++ b/packages/autodetect/src/index.ts @@ -0,0 +1,22 @@ +/* + * 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. + */ + +function getAvailablePlugins() { + return __webpack_require__( + './node_modules/backstage-autodetected-plugins.js', + ); +} +export { getAvailablePlugins }; diff --git a/packages/autodetect/src/setupTests.ts b/packages/autodetect/src/setupTests.ts new file mode 100644 index 0000000000..865308e634 --- /dev/null +++ b/packages/autodetect/src/setupTests.ts @@ -0,0 +1,16 @@ +/* + * 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';