mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
License extension (#1174)
* License menu item should come from an extension #1141 Signed-off-by: Roman <ixrock@gmail.com> * fix: expose `Util.openExternal` via extensions-api Signed-off-by: Roman <ixrock@gmail.com> * move LICENSE back to root Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
da862db0b9
commit
32ca885596
5
extensions/license-menu-item/Makefile
Normal file
5
extensions/license-menu-item/Makefile
Normal file
@ -0,0 +1,5 @@
|
||||
install-deps:
|
||||
npm install
|
||||
|
||||
build: install-deps
|
||||
npm run build
|
||||
13
extensions/license-menu-item/main.ts
Normal file
13
extensions/license-menu-item/main.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { LensMainExtension, Util } from "@k8slens/extensions";
|
||||
|
||||
export default class LicenseLensMainExtension extends LensMainExtension {
|
||||
appMenus = [
|
||||
{
|
||||
parentId: "help",
|
||||
label: "License",
|
||||
async click() {
|
||||
Util.openExternal("https://k8slens.dev/licenses/eula.md")
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
3589
extensions/license-menu-item/package-lock.json
generated
Normal file
3589
extensions/license-menu-item/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
21
extensions/license-menu-item/package.json
Normal file
21
extensions/license-menu-item/package.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "lens-license",
|
||||
"version": "0.1.0",
|
||||
"description": "License menu item",
|
||||
"main": "dist/main.js",
|
||||
"scripts": {
|
||||
"build": "webpack -p",
|
||||
"dev": "webpack --watch"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@types/webpack": "^4.41.17",
|
||||
"@k8slens/extensions": "file:../../src/extensions/npm/extensions",
|
||||
"mobx": "^5.15.5",
|
||||
"react": "^16.13.1",
|
||||
"ts-loader": "^8.0.4",
|
||||
"ts-node": "^9.0.0",
|
||||
"typescript": "^4.0.3",
|
||||
"webpack": "^4.44.2"
|
||||
}
|
||||
}
|
||||
19
extensions/license-menu-item/tsconfig.json
Normal file
19
extensions/license-menu-item/tsconfig.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"baseUrl": ".",
|
||||
"module": "CommonJS",
|
||||
"target": "ES2017",
|
||||
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
||||
"moduleResolution": "Node",
|
||||
"sourceMap": false,
|
||||
"declaration": false,
|
||||
"strict": false,
|
||||
"noImplicitAny": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"experimentalDecorators": true,
|
||||
"jsx": "react"
|
||||
}
|
||||
}
|
||||
34
extensions/license-menu-item/webpack.config.ts
Normal file
34
extensions/license-menu-item/webpack.config.ts
Normal file
@ -0,0 +1,34 @@
|
||||
import path from "path"
|
||||
|
||||
const outputPath = path.resolve(__dirname, 'dist');
|
||||
|
||||
export default [
|
||||
{
|
||||
entry: './main.ts',
|
||||
context: __dirname,
|
||||
target: "electron-main",
|
||||
mode: "production",
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: 'ts-loader',
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
],
|
||||
},
|
||||
externals: {
|
||||
"@k8slens/extensions": "var global.LensExtensions",
|
||||
"mobx": "var global.Mobx",
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.tsx', '.ts', '.js'],
|
||||
},
|
||||
output: {
|
||||
libraryTarget: "commonjs2",
|
||||
globalObject: "this",
|
||||
filename: 'main.js',
|
||||
path: outputPath,
|
||||
},
|
||||
},
|
||||
];
|
||||
@ -185,6 +185,7 @@
|
||||
"pod-menu",
|
||||
"node-menu",
|
||||
"metrics-cluster-feature",
|
||||
"license-menu-item",
|
||||
"support-page"
|
||||
]
|
||||
},
|
||||
|
||||
@ -11,4 +11,4 @@ export * from "./getRandId"
|
||||
export * from "./splitArray"
|
||||
export * from "./saveToAppFiles"
|
||||
export * from "./singleton"
|
||||
export * from "./cloneJson"
|
||||
export * from "./openExternal"
|
||||
|
||||
6
src/common/utils/openExternal.ts
Normal file
6
src/common/utils/openExternal.ts
Normal file
@ -0,0 +1,6 @@
|
||||
// Opens a link in external browser
|
||||
import { shell } from "electron"
|
||||
|
||||
export function openExternal(url: string) {
|
||||
return shell.openExternal(url);
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
export { Singleton } from "../../common/utils"
|
||||
export { Singleton, openExternal } from "../../common/utils"
|
||||
export { prevDefault, stopPropagation } from "../../renderer/utils/prevDefault"
|
||||
export { cssNames } from "../../renderer/utils/cssNames"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { app, BrowserWindow, dialog, Menu, MenuItem, MenuItemConstructorOptions, shell, webContents } from "electron"
|
||||
import { app, BrowserWindow, dialog, Menu, MenuItem, MenuItemConstructorOptions, webContents } from "electron"
|
||||
import { autorun } from "mobx";
|
||||
import { WindowManager } from "./window-manager";
|
||||
import { appName, isMac, isWindows } from "../common/vars";
|
||||
@ -185,12 +185,6 @@ export function buildMenu(windowManager: WindowManager) {
|
||||
navigate(whatsNewURL())
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "License",
|
||||
click: async () => {
|
||||
shell.openExternal('https://k8slens.dev/licenses/eula.md');
|
||||
},
|
||||
},
|
||||
...ignoreOnMac([
|
||||
{
|
||||
label: "About Lens",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user