chore: extract @k8slens/random

Signed-off-by: Gabriel <gaccettola@mirantis.com>
This commit is contained in:
Gabriel authored and Gabriel Accettola committed 2023-06-01 11:36:30 +02:00
1 parent 847f2b1b7b
commit 86fa93ac8b
30 files changed
+137 -20

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
{
"extends": "@k8slens/eslint-config/eslint",
"parserOptions": {
"project": "./tsconfig.json"
}
}
+1
View File
@@ -0,0 +1 @@
"@k8slens/eslint-config/prettier"
+4
View File
@@ -0,0 +1,4 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+15
View File
@@ -0,0 +1,15 @@
# @k8slens/random
This package contains stuff related to creating Lens-applications.
# Usage
```bash
$ npm install @k8slens/random
```
```typescript
export type { ... } from "@k8slens/random";
```
## Extendability
+7
View File
@@ -0,0 +1,7 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
export { randomFeature } from "./src/feature";
export { getRandomIdInjectable } from "./src/get-random-id.injectable";
+44
View File
@@ -0,0 +1,44 @@
{
"name": "@k8slens/random",
"private": false,
"version": "1.0.0-alpha.0",
"description": "Highly extendable random 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",
"exports": {
".": "./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": "lens-webpack-build",
"lint": "lens-lint",
"lint:fix": "lens-lint --fix"
},
"peerDependencies": {
"@k8slens/feature-core": "^6.5.0-alpha.0",
"@ogre-tools/injectable": "^17.1.0",
"@ogre-tools/injectable-extension-for-auto-registration": "^17.1.0",
"uuid": "^8.3.2"
},
"devDependencies": {
"@k8slens/eslint-config": "^6.5.0",
"@k8slens/webpack": "^6.5.0"
}
}
+14
View File
@@ -0,0 +1,14 @@
import { getFeature } from "@k8slens/feature-core";
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
export const randomFeature = getFeature({
id: "random-feature",
register: (di) => {
autoRegister({
di,
targetModule: module,
getRequireContexts: () => [require.context("./", true, /\.injectable\.(ts|tsx)$/)],
});
},
});
@@ -0,0 +1,12 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import { v4 as getRandomId } from "uuid";
export const getRandomIdInjectable = getInjectable({
id: "get-random-id",
instantiate: () => () => getRandomId(),
causesSideEffects: true,
});
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "@k8slens/typescript/config/base.json",
"include": ["**/*.ts", "**/*.tsx"],
}
+1
View File
@@ -0,0 +1 @@
module.exports = require("@k8slens/webpack").configForReact;