install extensions as normal npm packages

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen committed 2020-10-02 13:21:26 +03:00
1 parent de3849d22c
commit 0219c62b8a
14 files changed
+1877 -189

No files matched your search

+2
View File
@@ -1 +1,3 @@
*.js
node_modules/
dist/
@@ -1,8 +1,12 @@
import { Button, DynamicPageType, Icon, IconProps, LensExtension, React } from "@lens/extensions";
import path from "path";
import _ from "lodash"
import stripAnsi from "strip-ansi"
export default class ExampleExtension extends LensExtension {
onActivate() {
_.has({a: 1}, "a")
stripAnsi("asdasdasd")
console.log('EXAMPLE EXTENSION: ACTIVATED', this.getMeta());
this.registerPage({
type: DynamicPageType.CLUSTER,
@@ -36,7 +40,7 @@ export class ExtensionPage extends React.Component<{ extension: ExampleExtension
return (
<TabLayout className="ExampleExtension">
<div className="flex column gaps align-flex-start">
<p>Hello from extensions-api!</p>
<p>{stripAnsi("Hello from extensions-api!!!!!!!")}</p>
<p>File: <i>{__filename}</i></p>
<Button accent label="Deactivate" onClick={this.deactivate}/>
</div>
+32
View File
@@ -0,0 +1,32 @@
{
"name": "extension-example",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
},
"lodash": {
"version": "4.17.20",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
},
"strip-ansi": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
"requires": {
"ansi-regex": "^5.0.0"
}
},
"typescript": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.3.tgz",
"integrity": "sha512-tEu6DGxGgRJPb/mVPIZ48e69xCn2yRmCgYmDugAVwmJ6o+0u1RI18eO7E7WBTLYLaEVVOhwQmcdhQHweux/WPg==",
"dev": true
}
}
}
+9 -1
View File
@@ -2,11 +2,19 @@
"name": "extension-example",
"version": "1.0.0",
"description": "Example extension",
"main": "example-extension.js",
"main": "dist/index.js",
"lens": {
"metadata": {},
"styles": []
},
"scripts": {
"build": "tsc"
},
"dependencies": {
"lodash": "^4.17.20",
"strip-ansi": "^6.0.0"
},
"devDependencies": {
"typescript": "^4.0.3"
}
}
+16 -4
View File
@@ -1,13 +1,25 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": ".",
"outDir": "dist",
"module": "CommonJS",
"target": "ES2017",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"moduleResolution": "Node",
"sourceMap": false,
"declaration": false
"declaration": false,
"strict": false,
"noImplicitAny": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"jsx": "react"
},
"include": [
"../../types",
"./example-extension.tsx"
"./index.tsx"
],
"exclude": [
"node_modules",
"*.js"
]
}