diff --git a/packages/technical-features/ui-components/.eslintrc.json b/packages/technical-features/ui-components/.eslintrc.json new file mode 100644 index 0000000000..b15115cb69 --- /dev/null +++ b/packages/technical-features/ui-components/.eslintrc.json @@ -0,0 +1,6 @@ +{ + "extends": "@k8slens/eslint-config/eslint", + "parserOptions": { + "project": "./tsconfig.json" + } +} diff --git a/packages/technical-features/ui-components/.prettierrc b/packages/technical-features/ui-components/.prettierrc new file mode 100644 index 0000000000..edd47b479e --- /dev/null +++ b/packages/technical-features/ui-components/.prettierrc @@ -0,0 +1 @@ +"@k8slens/eslint-config/prettier" diff --git a/packages/technical-features/ui-components/README.md b/packages/technical-features/ui-components/README.md new file mode 100644 index 0000000000..5f512489df --- /dev/null +++ b/packages/technical-features/ui-components/README.md @@ -0,0 +1,20 @@ +# @k8slens/ui-components + +This package contains React UI components used in the Lens + +# Usage + +```bash +$ npm install @k8slens/ui-components +``` + +```typescript +import { uiComponentsFeature } from "@k8slens/ui-components"; +import { registerFeature } from "@k8slens/feature-core"; +import { createContainer } from "@ogre-tools/injectable"; + +const di = createContainer("some-container"); + +registerFeature(di, uiComponentsFeature); +``` + diff --git a/packages/technical-features/ui-components/index.ts b/packages/technical-features/ui-components/index.ts new file mode 100644 index 0000000000..ad8efe538a --- /dev/null +++ b/packages/technical-features/ui-components/index.ts @@ -0,0 +1 @@ +export { uiComponentsFeature } from "./src/feature"; diff --git a/packages/technical-features/ui-components/jest.config.js b/packages/technical-features/ui-components/jest.config.js new file mode 100644 index 0000000000..38d54ab7b6 --- /dev/null +++ b/packages/technical-features/ui-components/jest.config.js @@ -0,0 +1 @@ +module.exports = require("@k8slens/jest").monorepoPackageConfig(__dirname).configForReact; diff --git a/packages/technical-features/ui-components/package.json b/packages/technical-features/ui-components/package.json new file mode 100644 index 0000000000..65b089a0f6 --- /dev/null +++ b/packages/technical-features/ui-components/package.json @@ -0,0 +1,45 @@ +{ + "name": "@k8slens/ui-components", + "private": false, + "version": "1.0.0-alpha.0", + "description": "UI Components used in the Lens.", + "type": "commonjs", + "files": [ + "dist" + ], + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/lensapp/lens.git" + }, + "main": "dist/index.js", + "types": "dist/index.d.ts", + "author": { + "name": "OpenLens Authors", + "email": "info@k8slens.dev" + }, + "license": "MIT", + "homepage": "https://github.com/lensapp/lens", + "scripts": { + "build": "webpack", + "clean": "rimraf dist/", + "test:unit": "jest --coverage --runInBand", + "lint": "lens-lint", + "lint:fix": "lens-lint --fix" + }, + "peerDependencies": { + "@k8slens/feature-core": "^6.5.0-alpha.0", + "@ogre-tools/injectable": "^15.1.2", + "@ogre-tools/injectable-extension-for-auto-registration": "^15.1.2", + "@ogre-tools/fp": "^15.1.2", + "lodash": "^4.17.21" + }, + "devDependencies": { + "@async-fn/jest": "^1.6.4", + "@k8slens/eslint-config": "6.5.0-alpha.1", + "@k8slens/react-testing-library-discovery": "^1.0.0-alpha.0" + } +} diff --git a/packages/technical-features/ui-components/src/feature.ts b/packages/technical-features/ui-components/src/feature.ts new file mode 100644 index 0000000000..944f3a3e80 --- /dev/null +++ b/packages/technical-features/ui-components/src/feature.ts @@ -0,0 +1,14 @@ +import { getFeature } from "@k8slens/feature-core"; +import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration"; + +export const uiComponentsFeature = getFeature({ + id: "ui-components", + + register: (di) => { + autoRegister({ + di, + targetModule: module, + getRequireContexts: () => [require.context("./", true, /\.injectable\.(ts|tsx)$/)], + }); + }, +}); diff --git a/packages/technical-features/ui-components/tsconfig.json b/packages/technical-features/ui-components/tsconfig.json new file mode 100644 index 0000000000..9e140d79da --- /dev/null +++ b/packages/technical-features/ui-components/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "@k8slens/typescript/config/base.json", + "include": ["**/*.ts", "**/*.tsx"], +} diff --git a/packages/technical-features/ui-components/webpack.config.js b/packages/technical-features/ui-components/webpack.config.js new file mode 100644 index 0000000000..1cda407f5a --- /dev/null +++ b/packages/technical-features/ui-components/webpack.config.js @@ -0,0 +1 @@ +module.exports = require("@k8slens/webpack").configForReact;