mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Move in-tree extensions to top-level folder (#993)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
1 parent
5ec6751ab4
commit
82c4177cb9
6 files changed
+10
-10
No files matched your search
@@ -1,3 +0,0 @@
|
||||
# Lens Example Extension
|
||||
|
||||
*TODO*: add more info
|
||||
@@ -1,47 +0,0 @@
|
||||
import { Button, DynamicPageType, Icon, IconProps, LensExtension } from "@lens/extensions";
|
||||
import React from "react";
|
||||
import path from "path";
|
||||
|
||||
export default class ExampleExtension extends LensExtension {
|
||||
onActivate() {
|
||||
console.log('EXAMPLE EXTENSION: ACTIVATED', this.getMeta());
|
||||
this.registerPage({
|
||||
type: DynamicPageType.CLUSTER,
|
||||
path: "/extension-example",
|
||||
menuTitle: "Example Extension",
|
||||
components: {
|
||||
Page: () => <ExtensionPage extension={this}/>,
|
||||
MenuIcon: ExtensionIcon,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onDeactivate() {
|
||||
console.log('EXAMPLE EXTENSION: DEACTIVATED', this.getMeta());
|
||||
}
|
||||
}
|
||||
|
||||
export function ExtensionIcon(props: IconProps) {
|
||||
return <Icon {...props} material="camera" tooltip={path.basename(__filename)}/>
|
||||
}
|
||||
|
||||
export class ExtensionPage extends React.Component<{ extension: ExampleExtension }> {
|
||||
deactivate = () => {
|
||||
const { extension } = this.props;
|
||||
extension.runtime.navigate("/")
|
||||
extension.disable();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { TabLayout } = this.props.extension.runtime.components;
|
||||
return (
|
||||
<TabLayout className="ExampleExtension">
|
||||
<div className="flex column gaps align-flex-start">
|
||||
<p>Hello from extensions-api!</p>
|
||||
<p>File: <i>{__filename}</i></p>
|
||||
<Button accent label="Deactivate" onClick={this.deactivate}/>
|
||||
</div>
|
||||
</TabLayout>
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"name": "extension-example",
|
||||
"version": "1.0.0",
|
||||
"description": "Example extension",
|
||||
"main": "example-extension.js",
|
||||
"lens": {
|
||||
"metadata": {},
|
||||
"styles": []
|
||||
},
|
||||
"dependencies": {
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": ".",
|
||||
"module": "CommonJS",
|
||||
"sourceMap": false,
|
||||
"declaration": false
|
||||
},
|
||||
"include": [
|
||||
"../../../types",
|
||||
"./example-extension.tsx"
|
||||
]
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import path from "path";
|
||||
import fs from "fs-extra";
|
||||
import { action, observable, reaction, toJS, } from "mobx";
|
||||
import { BaseStore } from "../common/base-store";
|
||||
import { isDevelopment } from "../common/vars";
|
||||
import logger from "../main/logger";
|
||||
|
||||
export interface ExtensionStoreModel {
|
||||
@@ -44,9 +43,6 @@ export class ExtensionStore extends BaseStore<ExtensionStoreModel> {
|
||||
@observable installed = observable.map<ExtensionId, InstalledExtension>([], { deep: false });
|
||||
|
||||
get folderPath(): string {
|
||||
if (isDevelopment) {
|
||||
return path.resolve(__static, "../src/extensions");
|
||||
}
|
||||
return path.resolve(__static, "../extensions");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user