mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
chore: Fix build of open-lens
- Remove need for using relative paths during build Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
6167ad2c25
commit
91354eae01
40 files changed
+284
-160
No files matched your search
@@ -18,9 +18,14 @@
|
||||
},
|
||||
"main": "static/build/main.js",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
"./main": "./static/build/library/main.js",
|
||||
"./renderer": "./static/build/library/renderer.js",
|
||||
"./styles": "./static/build/library/renderer.css"
|
||||
"./styles": "./static/build/library/renderer.css",
|
||||
"./template.html": "./src/renderer/template.html",
|
||||
"./vars.scss": "./src/renderer/components/vars.scss",
|
||||
"./fonts/*": "./static/build/library/fonts/*",
|
||||
"./icons/*.svg": "./src/renderer/components/icon/*.svg"
|
||||
},
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
@@ -38,7 +43,8 @@
|
||||
"build/notarize.js",
|
||||
"static/build/library/**/*",
|
||||
"src/renderer/template.html",
|
||||
"templates/**/*",
|
||||
"src/renderer/components/vars.scss",
|
||||
"src/renderer/components/icon/*.svg",
|
||||
"types/*",
|
||||
"tsconfig.json"
|
||||
],
|
||||
|
||||
@@ -124,7 +124,10 @@ export function iconsAndImagesWebpackRules(): webpack.RuleSetRule[] {
|
||||
},
|
||||
{
|
||||
test: /\.(jpg|png|ico)$/,
|
||||
type: "asset/resource", // path to file, e.g. "/static/build/assets/*"
|
||||
type: "asset/resource",
|
||||
generator: {
|
||||
filename: "images/[name][ext]",
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -137,6 +140,9 @@ export function fontsLoaderWebpackRules(): webpack.RuleSetRule[] {
|
||||
{
|
||||
test: /\.(ttf|eot|woff2?)$/,
|
||||
type: "asset/resource",
|
||||
generator: {
|
||||
filename: "fonts/[name][ext]",
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"scripts": {
|
||||
"clean": "rimraf dist/",
|
||||
"build": "swc ./src/index.ts -d ./dist/",
|
||||
"generate": "node ./dist/index.js"
|
||||
"generate": "node --experimental-import-meta-resolve ./dist/index.js"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
|
||||
@@ -9,6 +9,7 @@ import { JSDOM } from "jsdom";
|
||||
import path from "path";
|
||||
import sharp from "sharp";
|
||||
import arg from "arg";
|
||||
import assert from "assert";
|
||||
|
||||
const options = arg({
|
||||
"--input": String,
|
||||
@@ -41,11 +42,21 @@ const joinWithInitCwd = (relativePath: string): string => {
|
||||
return path.join(INIT_CWD, relativePath);
|
||||
};
|
||||
|
||||
const resolve = async (input: string) => {
|
||||
return (await import.meta.resolve?.(input))?.replace("file://", "");
|
||||
}
|
||||
|
||||
const size = options["--output-size"] ?? 16;
|
||||
const inputFile = joinWithInitCwd(assertOption("--input"));
|
||||
const outputFolder = joinWithInitCwd(assertOption("--output"));
|
||||
const noticeFile = joinWithInitCwd(assertOption("--notice-icon"));
|
||||
const spinnerFile = joinWithInitCwd(assertOption("--spinner-icon"));
|
||||
const inputFile = await resolve(assertOption("--input"));
|
||||
const noticeFile = await resolve(assertOption("--notice-icon"));
|
||||
const spinnerFile = await resolve(assertOption("--spinner-icon"));
|
||||
|
||||
assert(inputFile, "input file not found");
|
||||
assert(noticeFile, "notice icon file not found");
|
||||
assert(spinnerFile, "spinner icon file not found");
|
||||
|
||||
console.log(inputFile, noticeFile, spinnerFile)
|
||||
|
||||
const getSvgStyling = (colouring: "dark" | "light") => (
|
||||
`
|
||||
|
||||
@@ -69,6 +69,9 @@ export const getReactConfigFor =
|
||||
{
|
||||
test: /\.(ttf|eot|woff2?)$/,
|
||||
type: "asset/resource",
|
||||
generator: {
|
||||
filename: "fonts/[name][ext]",
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
@@ -79,6 +82,9 @@ export const getReactConfigFor =
|
||||
{
|
||||
test: /\.(jpg|png|ico)$/,
|
||||
type: "asset/resource",
|
||||
generator: {
|
||||
filename: "images/[name][ext]",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
"lint:fix": "lens-lint --fix"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@k8slens/list-layout": "^1.0.0-alpha.1",
|
||||
"@k8slens/utilities": "^1.0.0-alpha.2",
|
||||
"@ogre-tools/injectable": "^15.8.1",
|
||||
"auto-bind": "^4.0.0",
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import moment from "moment";
|
||||
import { formatDuration, isObject, isString } from "@k8slens/utilities";
|
||||
import type { ItemObject } from "@k8slens/list-layout";
|
||||
import type { Patch } from "rfc6902";
|
||||
import autoBind from "auto-bind";
|
||||
import type { KubeObjectMetadata, KubeObjectScope, KubeJsonApiData } from "./api-types";
|
||||
@@ -34,8 +33,7 @@ export class KubeObject<
|
||||
Metadata extends KubeObjectMetadata<KubeObjectScope> = KubeObjectMetadata<KubeObjectScope>,
|
||||
Status = unknown,
|
||||
Spec = unknown,
|
||||
> implements ItemObject
|
||||
{
|
||||
> {
|
||||
static readonly kind?: string;
|
||||
|
||||
static readonly namespaced?: boolean;
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
static/build
|
||||
binaries/
|
||||
*.mjs
|
||||
*.mjs.map
|
||||
@@ -1,202 +0,0 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# 6.5.0-alpha.10 (2023-05-09)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.9 (2023-05-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add new packages to open-lens to fix build ([f2f6cc5](https://github.com/lensapp/lens/commit/f2f6cc500c38cdeb4d6e8bd1da16e36c61a07aea))
|
||||
* Disable cycle detection due to bug in ogre-tools ([d4e8b48](https://github.com/lensapp/lens/commit/d4e8b48b4a166e2aabeab76355765d78a445c43c))
|
||||
* Fix generating tray icons and downloading binaries on windows ([289d62c](https://github.com/lensapp/lens/commit/289d62caaadcf4899719c6a8b8c2ee4b7e725e9c))
|
||||
* Fix paths provided as parameters to workspace scripts ([d5acd57](https://github.com/lensapp/lens/commit/d5acd57584887f8eed544650761ef4408481a6a2))
|
||||
* Readd run-script-os to open-lens to fix build:app ([430beba](https://github.com/lensapp/lens/commit/430bebaa6f90941d0b7e2c88d59aaac0a9260d7f))
|
||||
* Revise paths for generating tray icons ([58b8b4f](https://github.com/lensapp/lens/commit/58b8b4f1f9113aaedb136ebbf00c568abea0173c))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Compute the kubectl download version map at build time ([0bd7b1f](https://github.com/lensapp/lens/commit/0bd7b1fe92a173379c8a5a1ab7e13cf9e4f8223b))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.6 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.5 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.4 (2023-04-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove platform specific injectable file names ([9b0318b](https://github.com/lensapp/lens/commit/9b0318b493fe2e49a34b8a4cb3d0bef1600759b8))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Allow built versions to specify an environment ([#7495](https://github.com/lensapp/lens/issues/7495)) ([128b05d](https://github.com/lensapp/lens/commit/128b05d4d46344a511398f654865c133c6e36514))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.3 (2023-03-15)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.2 (2023-03-14)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.1 (2023-03-14)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.13 (2023-02-03)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.12 (2023-02-01)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.11 (2023-02-01)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.10 (2023-01-27)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.9 (2023-01-27)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.8 (2023-01-27)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.7 (2023-01-27)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.6 (2023-01-26)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.5 (2023-01-26)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.4 (2023-01-26)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.3 (2023-01-26)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.9 (2023-05-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add new packages to open-lens to fix build ([f2f6cc5](https://github.com/lensapp/lens/commit/f2f6cc500c38cdeb4d6e8bd1da16e36c61a07aea))
|
||||
* Disable cycle detection due to bug in ogre-tools ([d4e8b48](https://github.com/lensapp/lens/commit/d4e8b48b4a166e2aabeab76355765d78a445c43c))
|
||||
* Fix generating tray icons and downloading binaries on windows ([289d62c](https://github.com/lensapp/lens/commit/289d62caaadcf4899719c6a8b8c2ee4b7e725e9c))
|
||||
* Fix paths provided as parameters to workspace scripts ([d5acd57](https://github.com/lensapp/lens/commit/d5acd57584887f8eed544650761ef4408481a6a2))
|
||||
* Readd run-script-os to open-lens to fix build:app ([430beba](https://github.com/lensapp/lens/commit/430bebaa6f90941d0b7e2c88d59aaac0a9260d7f))
|
||||
* Revise paths for generating tray icons ([58b8b4f](https://github.com/lensapp/lens/commit/58b8b4f1f9113aaedb136ebbf00c568abea0173c))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Compute the kubectl download version map at build time ([0bd7b1f](https://github.com/lensapp/lens/commit/0bd7b1fe92a173379c8a5a1ab7e13cf9e4f8223b))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.6 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.5 (2023-04-12)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.4 (2023-04-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove platform specific injectable file names ([9b0318b](https://github.com/lensapp/lens/commit/9b0318b493fe2e49a34b8a4cb3d0bef1600759b8))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Allow built versions to specify an environment ([#7495](https://github.com/lensapp/lens/issues/7495)) ([128b05d](https://github.com/lensapp/lens/commit/128b05d4d46344a511398f654865c133c6e36514))
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.3 (2023-03-15)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.2 (2023-03-14)
|
||||
|
||||
|
||||
|
||||
# 6.5.0-alpha.1 (2023-03-14)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.13 (2023-02-03)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.12 (2023-02-01)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.11 (2023-02-01)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.10 (2023-01-27)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.9 (2023-01-27)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.8 (2023-01-27)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.7 (2023-01-27)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.6 (2023-01-26)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.5 (2023-01-26)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.4 (2023-01-26)
|
||||
|
||||
|
||||
|
||||
# 6.4.0-beta.3 (2023-01-26)
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.cs.allow-jit</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.disable-library-validation</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 169 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 51 KiB |
@@ -1,15 +0,0 @@
|
||||
!macro customInit
|
||||
; Make sure all old extensions are removed
|
||||
RMDir /r "$INSTDIR\resources\extensions"
|
||||
|
||||
; Workaround for installer handing when the app directory is removed manually
|
||||
${ifNot} ${FileExists} "$INSTDIR"
|
||||
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\{${UNINSTALL_APP_KEY}}"
|
||||
${EndIf}
|
||||
|
||||
; Workaround for the old-format uninstall registry key (some people report it causes hangups, too)
|
||||
ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}" "QuietUninstallString"
|
||||
StrCmp $0 "" proceed 0
|
||||
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL_APP_KEY}"
|
||||
proceed:
|
||||
!macroend
|
||||
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
const { notarize } = require("electron-notarize");
|
||||
|
||||
exports.default = async function notarizing(context) {
|
||||
const { electronPlatformName, appOutDir } = context;
|
||||
|
||||
if (electronPlatformName !== "darwin") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!process.env.APPLEID || !process.env.APPLEIDPASS) {
|
||||
return;
|
||||
}
|
||||
|
||||
const appName = context.packager.appInfo.productFilename;
|
||||
|
||||
return await notarize({
|
||||
appBundleId: process.env.APPBUNDLEID || "io.kontena.lens-app",
|
||||
appPath: `${appOutDir}/${appName}.app`,
|
||||
appleId: process.env.APPLEID,
|
||||
appleIdPassword: process.env.APPLEIDPASS,
|
||||
ascProvider:process.env.ASCPROVIDER,
|
||||
});
|
||||
};
|
||||
@@ -1,67 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
/*
|
||||
Cluster tests are run if there is a pre-existing minikube cluster. Before running cluster tests the TEST_NAMESPACE
|
||||
namespace is removed, if it exists, from the minikube cluster. Resources are created as part of the cluster tests in the
|
||||
TEST_NAMESPACE namespace. This is done to minimize destructive impact of the cluster tests on an existing minikube
|
||||
cluster and vice versa.
|
||||
*/
|
||||
import type { ElectronApplication, Page } from "playwright";
|
||||
import * as utils from "../helpers/utils";
|
||||
|
||||
describe("preferences page tests", () => {
|
||||
let window: Page;
|
||||
let cleanup: undefined | (() => Promise<void>);
|
||||
|
||||
beforeEach(async () => {
|
||||
let app: ElectronApplication;
|
||||
|
||||
({ window, cleanup, app } = await utils.start());
|
||||
await utils.clickWelcomeButton(window);
|
||||
|
||||
await app.evaluate(async ({ app }) => {
|
||||
await app.applicationMenu
|
||||
?.getMenuItemById(process.platform === "darwin" ? "mac" : "file")
|
||||
?.submenu
|
||||
?.getMenuItemById("navigate-to-preferences")
|
||||
?.click();
|
||||
});
|
||||
}, 10*60*1000);
|
||||
|
||||
afterEach(async () => {
|
||||
await cleanup?.();
|
||||
}, 10*60*1000);
|
||||
|
||||
it('shows "preferences" and can navigate through the tabs', async () => {
|
||||
const pages = [
|
||||
{
|
||||
id: "app",
|
||||
header: "Application",
|
||||
},
|
||||
{
|
||||
id: "proxy",
|
||||
header: "Proxy",
|
||||
},
|
||||
{
|
||||
id: "kubernetes",
|
||||
header: "Kubernetes",
|
||||
},
|
||||
];
|
||||
|
||||
for (const { id, header } of pages) {
|
||||
await window.click(`[data-preference-tab-link-test=${id}]`);
|
||||
await window.waitForSelector(`[data-preference-page-title-test] >> text=${header}`);
|
||||
}
|
||||
}, 10*60*1000);
|
||||
|
||||
// Skipping, but will turn it on again in the follow up PR
|
||||
it.skip("ensures helm repos", async () => {
|
||||
await window.click("[data-testid=kubernetes-tab]");
|
||||
await window.waitForSelector("[data-testid=repository-name]");
|
||||
await window.click("#HelmRepoSelect");
|
||||
await window.waitForSelector("div.Select__option");
|
||||
}, 10*60*1000);
|
||||
});
|
||||
@@ -1,390 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
/*
|
||||
Cluster tests are run if there is a pre-existing minikube cluster. Before running cluster tests the TEST_NAMESPACE
|
||||
namespace is removed, if it exists, from the minikube cluster. Resources are created as part of the cluster tests in the
|
||||
TEST_NAMESPACE namespace. This is done to minimize destructive impact of the cluster tests on an existing minikube
|
||||
cluster and vice versa.
|
||||
*/
|
||||
import * as utils from "../helpers/utils";
|
||||
import { minikubeReady } from "../helpers/minikube";
|
||||
import type { Frame, Page } from "playwright";
|
||||
import { groupBy, toPairs } from "lodash/fp";
|
||||
import { pipeline } from "@ogre-tools/fp";
|
||||
import { describeIf } from "../../../core/src/test-utils/skippers";
|
||||
|
||||
const TEST_NAMESPACE = "integration-tests";
|
||||
|
||||
describeIf(minikubeReady(TEST_NAMESPACE))("Minikube based tests", () => {
|
||||
let window: Page;
|
||||
let cleanup: undefined | (() => Promise<void>);
|
||||
let frame: Frame;
|
||||
|
||||
beforeEach(async () => {
|
||||
({ window, cleanup } = await utils.start());
|
||||
await utils.clickWelcomeButton(window);
|
||||
|
||||
frame = await utils.launchMinikubeClusterFromCatalog(window);
|
||||
}, 10 * 60 * 1000);
|
||||
|
||||
afterEach(async () => {
|
||||
await cleanup?.();
|
||||
}, 10 * 60 * 1000);
|
||||
|
||||
it("shows cluster context menu in sidebar", async () => {
|
||||
await frame.click(`[data-testid="sidebar-cluster-dropdown"]`);
|
||||
await frame.waitForSelector(`.Menu >> text="Add to Hotbar"`);
|
||||
await frame.waitForSelector(`.Menu >> text="Settings"`);
|
||||
await frame.waitForSelector(`.Menu >> text="Disconnect"`);
|
||||
await frame.waitForSelector(`.Menu >> text="Remove"`);
|
||||
});
|
||||
|
||||
// FIXME: failed locally since metrics might already exist, cc @aleksfront
|
||||
it.skip("opens cluster settings by clicking link in no-metrics area", async () => {
|
||||
await frame.locator("text=Open cluster settings >> nth=0").click();
|
||||
await window.waitForSelector(`[data-testid="metrics-header"]`);
|
||||
});
|
||||
|
||||
it(
|
||||
"should navigate around common cluster pages",
|
||||
async () => {
|
||||
const scenariosByParent = pipeline(
|
||||
scenarios,
|
||||
groupBy("parentSidebarItemTestId"),
|
||||
toPairs,
|
||||
);
|
||||
|
||||
for (const [parentSidebarItemTestId, scenarios] of scenariosByParent) {
|
||||
if (parentSidebarItemTestId !== "null") {
|
||||
await frame.click(`[data-testid="${parentSidebarItemTestId}"]`);
|
||||
}
|
||||
|
||||
for (const scenario of scenarios) {
|
||||
await frame.click(`[data-testid="${scenario.sidebarItemTestId}"]`);
|
||||
|
||||
await frame.waitForSelector(
|
||||
scenario.expectedSelector,
|
||||
selectorTimeout,
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
10 * 60 * 1000,
|
||||
);
|
||||
|
||||
it(
|
||||
"should show the default namespaces",
|
||||
async () => {
|
||||
await navigateToNamespaces(frame);
|
||||
await frame.waitForSelector("div.TableCell >> text='default'");
|
||||
await frame.waitForSelector("div.TableCell >> text='kube-system'");
|
||||
},
|
||||
10 * 60 * 1000,
|
||||
);
|
||||
|
||||
it(
|
||||
`should create the ${TEST_NAMESPACE} and a pod in the namespace and then remove that pod via the context menu`,
|
||||
async () => {
|
||||
await navigateToNamespaces(frame);
|
||||
await frame.click("button.add-button");
|
||||
await frame.waitForSelector(
|
||||
"div.AddNamespaceDialog >> text='Create Namespace'",
|
||||
);
|
||||
|
||||
const namespaceNameInput = await frame.waitForSelector(
|
||||
".AddNamespaceDialog input",
|
||||
);
|
||||
|
||||
await namespaceNameInput.type(TEST_NAMESPACE);
|
||||
await namespaceNameInput.press("Enter");
|
||||
|
||||
await frame.waitForSelector(`div.TableCell >> text=${TEST_NAMESPACE}`);
|
||||
|
||||
await navigateToPods(frame);
|
||||
|
||||
const namespacesSelector = await frame.waitForSelector(
|
||||
".NamespaceSelect",
|
||||
);
|
||||
|
||||
await namespacesSelector.click();
|
||||
await namespacesSelector.type(TEST_NAMESPACE);
|
||||
await namespacesSelector.press("Enter");
|
||||
await namespacesSelector.click();
|
||||
|
||||
await frame.click(".Icon.new-dock-tab");
|
||||
|
||||
try {
|
||||
await frame.click("li.MenuItem.create-resource-tab", {
|
||||
// NOTE: the following shouldn't be required, but is because without it a TypeError is thrown
|
||||
// see: https://github.com/microsoft/playwright/issues/8229
|
||||
position: {
|
||||
y: 0,
|
||||
x: 0,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
await frame.waitForTimeout(100_000);
|
||||
}
|
||||
|
||||
const testPodName = "nginx-create-pod-test";
|
||||
const monacoEditor = await frame.waitForSelector(`.Dock.isOpen [data-test-id="monaco-editor"]`);
|
||||
|
||||
await monacoEditor.click();
|
||||
await monacoEditor.type("apiVersion: v1", { delay: 10 });
|
||||
await monacoEditor.press("Enter", { delay: 10 });
|
||||
await monacoEditor.type("kind: Pod", { delay: 10 });
|
||||
await monacoEditor.press("Enter", { delay: 10 });
|
||||
await monacoEditor.type("metadata:", { delay: 10 });
|
||||
await monacoEditor.press("Enter", { delay: 10 });
|
||||
await monacoEditor.type(`name: ${testPodName}`, { delay: 10 });
|
||||
await monacoEditor.press("Enter", { delay: 10 });
|
||||
await monacoEditor.type(`namespace: ${TEST_NAMESPACE}`, { delay: 10 });
|
||||
await monacoEditor.press("Enter", { delay: 10 });
|
||||
await monacoEditor.press("Backspace", { delay: 10 });
|
||||
await monacoEditor.type("spec:", { delay: 10 });
|
||||
await monacoEditor.press("Enter", { delay: 10 });
|
||||
await monacoEditor.type("containers:", { delay: 10 });
|
||||
await monacoEditor.press("Enter", { delay: 10 });
|
||||
await monacoEditor.type(`- name: ${testPodName}`, { delay: 10 });
|
||||
await monacoEditor.press("Enter", { delay: 10 });
|
||||
await monacoEditor.type(" image: nginx:alpine", { delay: 10 });
|
||||
await monacoEditor.press("Enter", { delay: 10 });
|
||||
|
||||
await frame.click(".Dock .Button >> text='Create'");
|
||||
await frame.waitForSelector(`.TableCell >> text=${testPodName}`);
|
||||
await frame.click(".TableRow .TableCell.menu");
|
||||
await frame.click(".MenuItem >> text=Delete");
|
||||
await frame.click("button >> text=Remove");
|
||||
await frame.waitForSelector(`.TableCell >> text=${testPodName}`, { state: "detached" });
|
||||
},
|
||||
10 * 60 * 1000,
|
||||
);
|
||||
});
|
||||
|
||||
const selectorTimeout = { timeout: 30000 };
|
||||
|
||||
const scenarios = [
|
||||
{
|
||||
expectedSelector: "div[data-testid='cluster-overview-page'] div.label",
|
||||
parentSidebarItemTestId: null,
|
||||
sidebarItemTestId: "sidebar-item-link-for-cluster-overview",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: null,
|
||||
sidebarItemTestId: "sidebar-item-link-for-nodes",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: 'h5 >> text="Overview"',
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-workloads",
|
||||
sidebarItemTestId: "sidebar-item-link-for-overview",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-workloads",
|
||||
sidebarItemTestId: "sidebar-item-link-for-pods",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-workloads",
|
||||
sidebarItemTestId: "sidebar-item-link-for-deployments",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-workloads",
|
||||
sidebarItemTestId: "sidebar-item-link-for-daemon-sets",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-workloads",
|
||||
sidebarItemTestId: "sidebar-item-link-for-stateful-sets",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-workloads",
|
||||
sidebarItemTestId: "sidebar-item-link-for-replica-sets",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-workloads",
|
||||
sidebarItemTestId: "sidebar-item-link-for-jobs",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-workloads",
|
||||
sidebarItemTestId: "sidebar-item-link-for-cron-jobs",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-config",
|
||||
sidebarItemTestId: "sidebar-item-link-for-config-maps",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-config",
|
||||
sidebarItemTestId: "sidebar-item-link-for-secrets",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-config",
|
||||
sidebarItemTestId: "sidebar-item-link-for-resource-quotas",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-config",
|
||||
sidebarItemTestId: "sidebar-item-link-for-limit-ranges",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-config",
|
||||
sidebarItemTestId: "sidebar-item-link-for-horizontal-pod-auto-scalers",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-config",
|
||||
sidebarItemTestId: "sidebar-item-link-for-pod-disruption-budgets",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-network",
|
||||
sidebarItemTestId: "sidebar-item-link-for-services",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-network",
|
||||
sidebarItemTestId: "sidebar-item-link-for-endpoints",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-network",
|
||||
sidebarItemTestId: "sidebar-item-link-for-ingresses",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-network",
|
||||
sidebarItemTestId: "sidebar-item-link-for-network-policies",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-storage",
|
||||
sidebarItemTestId: "sidebar-item-link-for-persistent-volume-claims",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-storage",
|
||||
sidebarItemTestId: "sidebar-item-link-for-persistent-volumes",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-storage",
|
||||
sidebarItemTestId: "sidebar-item-link-for-storage-classes",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: null,
|
||||
sidebarItemTestId: "sidebar-item-link-for-namespaces",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: null,
|
||||
sidebarItemTestId: "sidebar-item-link-for-events",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "div.HelmCharts input",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-helm",
|
||||
sidebarItemTestId: "sidebar-item-link-for-charts",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-helm",
|
||||
sidebarItemTestId: "sidebar-item-link-for-releases",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-user-management",
|
||||
sidebarItemTestId: "sidebar-item-link-for-service-accounts",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-user-management",
|
||||
sidebarItemTestId: "sidebar-item-link-for-cluster-roles",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-user-management",
|
||||
sidebarItemTestId: "sidebar-item-link-for-roles",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-user-management",
|
||||
sidebarItemTestId: "sidebar-item-link-for-cluster-role-bindings",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-user-management",
|
||||
sidebarItemTestId: "sidebar-item-link-for-role-bindings",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: null,
|
||||
sidebarItemTestId: "sidebar-item-link-for-custom-resources",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-config",
|
||||
sidebarItemTestId: "sidebar-item-link-for-validating-webhook-configurations",
|
||||
},
|
||||
|
||||
{
|
||||
expectedSelector: "h5.title",
|
||||
parentSidebarItemTestId: "sidebar-item-link-for-config",
|
||||
sidebarItemTestId: "sidebar-item-link-for-mutating-webhook-configurations",
|
||||
},
|
||||
];
|
||||
|
||||
const navigateToPods = async (frame: Frame) => {
|
||||
await frame.click(`[data-testid="sidebar-item-link-for-workloads"]`);
|
||||
await frame.click(`[data-testid="sidebar-item-link-for-pods"]`);
|
||||
};
|
||||
|
||||
const navigateToNamespaces = async (frame: Frame) => {
|
||||
await frame.click(`[data-testid="sidebar-item-link-for-namespaces"]`);
|
||||
};
|
||||
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { ElectronApplication, Page } from "playwright";
|
||||
import * as utils from "../helpers/utils";
|
||||
|
||||
describe("Lens command palette", () => {
|
||||
let window: Page;
|
||||
let cleanup: undefined | (() => Promise<void>);
|
||||
let app: ElectronApplication;
|
||||
|
||||
beforeEach(async () => {
|
||||
({ window, cleanup, app } = await utils.start());
|
||||
await utils.clickWelcomeButton(window);
|
||||
}, 10*60*1000);
|
||||
|
||||
afterEach(async () => {
|
||||
await cleanup?.();
|
||||
}, 10*60*1000);
|
||||
|
||||
describe("menu", () => {
|
||||
it("opens command dialog from menu", async () => {
|
||||
await app.evaluate(async ({ app }) => {
|
||||
await app.applicationMenu
|
||||
?.getMenuItemById("view")
|
||||
?.submenu?.getMenuItemById("open-command-palette")
|
||||
?.click();
|
||||
});
|
||||
await window.waitForSelector(".Select__option >> text=Hotbar: Switch");
|
||||
}, 10*60*1000);
|
||||
});
|
||||
});
|
||||
@@ -1,42 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { spawnSync } from "child_process";
|
||||
|
||||
export function minikubeReady(testNamespace: string): boolean {
|
||||
// determine if minikube is running
|
||||
{
|
||||
const { status } = spawnSync("minikube status", { shell: true });
|
||||
|
||||
if (status !== 0) {
|
||||
console.warn("minikube not running");
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove TEST_NAMESPACE if it already exists
|
||||
{
|
||||
const { status } = spawnSync(`minikube kubectl -- get namespace ${testNamespace}`, { shell: true });
|
||||
|
||||
if (status === 0) {
|
||||
console.warn(`Removing existing ${testNamespace} namespace`);
|
||||
|
||||
const { status, stdout, stderr } = spawnSync(
|
||||
`minikube kubectl -- delete namespace ${testNamespace}`,
|
||||
{ shell: true },
|
||||
);
|
||||
|
||||
if (status !== 0) {
|
||||
console.warn(`Error removing ${testNamespace} namespace: ${stderr.toString()}`);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log(stdout.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { createHash } from "crypto";
|
||||
import { mkdirp, remove } from "fs-extra";
|
||||
import * as os from "os";
|
||||
import * as path from "path";
|
||||
import * as uuid from "uuid";
|
||||
import type { ElectronApplication, Frame, Page } from "playwright";
|
||||
import { _electron as electron } from "playwright";
|
||||
import { noop } from "lodash";
|
||||
import { disposer } from "@k8slens/utilities";
|
||||
|
||||
export const appPaths: Partial<Record<NodeJS.Platform, string>> = {
|
||||
"win32": "./dist/win-unpacked/OpenLens.exe",
|
||||
"linux": "./dist/linux-unpacked/open-lens",
|
||||
"darwin": `./dist/mac${ process.arch === "arm64" ? "-arm64" : "" }/OpenLens.app/Contents/MacOS/OpenLens`,
|
||||
};
|
||||
|
||||
async function getMainWindow(app: ElectronApplication, timeout = 50_000): Promise<Page> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const cleanup = disposer();
|
||||
let stdoutBuf = "";
|
||||
|
||||
const onWindow = (page: Page) => {
|
||||
console.log(`Page opened: ${page.url()}`);
|
||||
|
||||
if (page.url().startsWith("https://lens.app")) {
|
||||
cleanup();
|
||||
console.log(stdoutBuf);
|
||||
resolve(page);
|
||||
}
|
||||
};
|
||||
|
||||
app.on("window", onWindow);
|
||||
cleanup.push(() => app.off("window", onWindow));
|
||||
|
||||
app.on("close", cleanup);
|
||||
cleanup.push(() => app.off("close", cleanup));
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const stdout = app.process().stdout!;
|
||||
const onData = (chunk: any) => stdoutBuf += chunk.toString();
|
||||
|
||||
stdout.on("data", onData);
|
||||
cleanup.push(() => stdout.off("data", onData));
|
||||
|
||||
const timeoutId = setTimeout(() => {
|
||||
cleanup();
|
||||
console.log(stdoutBuf);
|
||||
reject(new Error(`Lens did not open the main window within ${timeout}ms`));
|
||||
}, timeout);
|
||||
|
||||
cleanup.push(() => clearTimeout(timeoutId));
|
||||
});
|
||||
}
|
||||
|
||||
async function attemptStart() {
|
||||
const CICD = path.join(os.tmpdir(), "lens-integration-testing", uuid.v4());
|
||||
|
||||
// Make sure that the directory is clear
|
||||
await remove(CICD).catch(noop);
|
||||
await mkdirp(CICD);
|
||||
|
||||
const app = await electron.launch({
|
||||
args: ["--integration-testing"], // this argument turns off the blocking of quit
|
||||
executablePath: appPaths[process.platform],
|
||||
bypassCSP: true,
|
||||
env: {
|
||||
CICD,
|
||||
...process.env,
|
||||
},
|
||||
timeout: 100_000,
|
||||
});
|
||||
|
||||
try {
|
||||
const window = await getMainWindow(app);
|
||||
|
||||
return {
|
||||
app,
|
||||
window,
|
||||
cleanup: async () => {
|
||||
app.process().kill();
|
||||
await remove(CICD).catch(noop);
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
await app.close();
|
||||
await remove(CICD).catch(noop);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export async function start() {
|
||||
// this is an attempted workaround for an issue with playwright not always getting the main window when using Electron 14.2.4 (observed on windows)
|
||||
for (let i = 0; ; i++) {
|
||||
try {
|
||||
return await attemptStart();
|
||||
} catch (error) {
|
||||
if (i === 4) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function clickWelcomeButton(window: Page) {
|
||||
await window.click("[data-testid=welcome-menu-container] li a");
|
||||
}
|
||||
|
||||
function minikubeEntityId() {
|
||||
return createHash("md5").update(`${path.join(os.homedir(), ".kube", "config")}:minikube`).digest("hex");
|
||||
}
|
||||
|
||||
/**
|
||||
* From the catalog, click the minikube entity and wait for it to connect, returning its frame
|
||||
*/
|
||||
export async function launchMinikubeClusterFromCatalog(window: Page): Promise<Frame> {
|
||||
await window.click("div.TableCell >> text='minikube'");
|
||||
|
||||
const minikubeFrame = await window.waitForSelector(`#cluster-frame-${minikubeEntityId()}`);
|
||||
|
||||
const frame = await minikubeFrame.contentFrame();
|
||||
|
||||
if (!frame) {
|
||||
throw new Error("No iframe for minikube found");
|
||||
}
|
||||
|
||||
await frame.waitForSelector("[data-testid=cluster-sidebar]");
|
||||
|
||||
return frame;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"include": [
|
||||
"./**/*",
|
||||
]
|
||||
}
|
||||
@@ -1,280 +0,0 @@
|
||||
{
|
||||
"name": "open-lens",
|
||||
"private": true,
|
||||
"productName": "OpenLens",
|
||||
"description": "OpenLens - Open Source IDE for Kubernetes",
|
||||
"homepage": "https://github.com/lensapp/lens",
|
||||
"version": "6.5.0-alpha.10",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lensapp/lens.git"
|
||||
},
|
||||
"keywords": [],
|
||||
"bugs": {
|
||||
"url": "https://github.com/lensapp/lens/issues"
|
||||
},
|
||||
"main": "static/build/main.js",
|
||||
"copyright": "© 2023 OpenLens Authors",
|
||||
"license": "MIT",
|
||||
"author": "OpenLens Authors <info@k8slens.dev>",
|
||||
"scripts": {
|
||||
"clean": "rimraf binaries/ dist/ static/build",
|
||||
"build": "npm run compile",
|
||||
"postbuild": "npm run build:tray-icons && npm run download:binaries",
|
||||
"build:app": "electron-builder --publish onTag",
|
||||
"prebuild:app": "run-script-os",
|
||||
"prebuild:app:default": "exit 0",
|
||||
"prebuild:app:win32": "rimraf node_modules/win-ca/pem",
|
||||
"build:dir": "npm run compile && electron-builder --dir",
|
||||
"compile": "cross-env NODE_ENV=production webpack --config webpack/webpack.ts --progress",
|
||||
"postcompile": "npm run build:tray-icons && npm run download:binaries",
|
||||
"start": "concurrently -i -k \"npm run dev-run -C\" npm:dev:*",
|
||||
"dev-run": "nodemon --watch ./static/build/main.js --exec \"electron --remote-debugging-port=9223 --inspect .\"",
|
||||
"dev:main": "cross-env NODE_ENV=development webpack --config webpack/main.ts --progress --watch",
|
||||
"dev:renderer": "cross-env NODE_ENV=development ts-node ./webpack/dev-server.ts",
|
||||
"test:integration": "jest -xyz --runInBand --modulePaths=[\"<rootDir>/integration/\"];",
|
||||
"build:tray-icons": "npm run --workspace @k8slens/generate-tray-icons generate -- --output static/build/tray --input ../core/src/renderer/components/icon/logo-lens.svg --notice-icon ../core/src/renderer/components/icon/notice.svg --spinner-icon ../core/src/renderer/components/icon/arrow-spinner.svg",
|
||||
"download:binaries": "npm run --workspace @k8slens/ensure-binaries ensure -- --package package.json --base-dir binaries/client",
|
||||
"postinstall": "electron-rebuild"
|
||||
},
|
||||
"config": {
|
||||
"k8sProxyVersion": "0.3.0",
|
||||
"bundledKubectlVersion": "1.23.3",
|
||||
"bundledHelmVersion": "3.7.2",
|
||||
"sentryDsn": "",
|
||||
"contentSecurityPolicy": "script-src 'unsafe-eval' 'self'; frame-src https://*.lens.app:*/; img-src * data:",
|
||||
"welcomeRoute": "/welcome"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16 <17"
|
||||
},
|
||||
"jest": {
|
||||
"collectCoverage": false,
|
||||
"verbose": true,
|
||||
"transform": {
|
||||
"^.+\\.(t|j)sx?$": [
|
||||
"@swc/jest"
|
||||
]
|
||||
}
|
||||
},
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build": {
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
],
|
||||
"outputs": [
|
||||
"{workspaceRoot}/binaries/",
|
||||
"{workspaceRoot}/build/webpack/",
|
||||
"{workspaceRoot}/static/build/"
|
||||
]
|
||||
},
|
||||
"build:app": {
|
||||
"dependsOn": [
|
||||
"build"
|
||||
],
|
||||
"outputs": [
|
||||
"{workspaceRoot}/dist/"
|
||||
]
|
||||
},
|
||||
"test:integration": {
|
||||
"dependsOn": [
|
||||
"build:app"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"build": {
|
||||
"npmRebuild": false,
|
||||
"electronVersion": "22.3.3",
|
||||
"generateUpdatesFilesForAllChannels": true,
|
||||
"files": [
|
||||
"static/**/*",
|
||||
"!node_modules/@k8slens/core/node_modules/**/*",
|
||||
"!node_modules/@k8slens/core/src"
|
||||
],
|
||||
"afterSign": "build/notarize.js",
|
||||
"extraResources": [
|
||||
"LICENSE"
|
||||
],
|
||||
"linux": {
|
||||
"category": "Network",
|
||||
"artifactName": "${productName}-${version}.${arch}.${ext}",
|
||||
"target": [
|
||||
"deb",
|
||||
"rpm",
|
||||
"AppImage"
|
||||
],
|
||||
"extraResources": [
|
||||
{
|
||||
"from": "binaries/client/linux/${arch}/kubectl",
|
||||
"to": "./${arch}/kubectl"
|
||||
},
|
||||
{
|
||||
"from": "binaries/client/linux/${arch}/lens-k8s-proxy",
|
||||
"to": "./${arch}/lens-k8s-proxy"
|
||||
},
|
||||
{
|
||||
"from": "binaries/client/linux/${arch}/helm",
|
||||
"to": "./${arch}/helm"
|
||||
}
|
||||
]
|
||||
},
|
||||
"rpm": {
|
||||
"fpm": [
|
||||
"--rpm-rpmbuild-define=%define _build_id_links none"
|
||||
]
|
||||
},
|
||||
"mac": {
|
||||
"hardenedRuntime": true,
|
||||
"gatekeeperAssess": false,
|
||||
"entitlements": "build/entitlements.mac.plist",
|
||||
"entitlementsInherit": "build/entitlements.mac.plist",
|
||||
"extraResources": [
|
||||
{
|
||||
"from": "binaries/client/darwin/${arch}/kubectl",
|
||||
"to": "./${arch}/kubectl"
|
||||
},
|
||||
{
|
||||
"from": "binaries/client/darwin/${arch}/lens-k8s-proxy",
|
||||
"to": "./${arch}/lens-k8s-proxy"
|
||||
},
|
||||
{
|
||||
"from": "binaries/client/darwin/${arch}/helm",
|
||||
"to": "./${arch}/helm"
|
||||
}
|
||||
]
|
||||
},
|
||||
"win": {
|
||||
"target": [
|
||||
"nsis"
|
||||
],
|
||||
"extraResources": [
|
||||
{
|
||||
"from": "binaries/client/windows/${arch}/kubectl.exe",
|
||||
"to": "./${arch}/kubectl.exe"
|
||||
},
|
||||
{
|
||||
"from": "binaries/client/windows/${arch}/lens-k8s-proxy.exe",
|
||||
"to": "./${arch}/lens-k8s-proxy.exe"
|
||||
},
|
||||
{
|
||||
"from": "binaries/client/windows/${arch}/helm.exe",
|
||||
"to": "./${arch}/helm.exe"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nsis": {
|
||||
"include": "build/installer.nsh",
|
||||
"oneClick": false,
|
||||
"allowElevation": true,
|
||||
"createStartMenuShortcut": true,
|
||||
"allowToChangeInstallationDirectory": true
|
||||
},
|
||||
"protocols": {
|
||||
"name": "Lens Protocol Handler",
|
||||
"schemes": [
|
||||
"lens"
|
||||
],
|
||||
"role": "Viewer"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@k8slens/application": "^6.5.0-alpha.5",
|
||||
"@k8slens/application-for-electron-main": "^6.5.0-alpha.4",
|
||||
"@k8slens/core": "^6.5.0-alpha.10",
|
||||
"@k8slens/ensure-binaries": "^6.5.0-alpha.5",
|
||||
"@k8slens/event-emitter": "^1.0.0-alpha.2",
|
||||
"@k8slens/feature-core": "^6.5.0-alpha.4",
|
||||
"@k8slens/keyboard-shortcuts": "^1.0.0-alpha.4",
|
||||
"@k8slens/kube-object": "^1.0.0-alpha.2",
|
||||
"@k8slens/kubectl-versions": "^1.0.0-alpha.3",
|
||||
"@k8slens/legacy-extension-example": "^1.0.0-alpha.8",
|
||||
"@k8slens/legacy-extensions": "^1.0.0-alpha.4",
|
||||
"@k8slens/legacy-global-di": "^1.0.0-alpha.1",
|
||||
"@k8slens/logger": "^1.0.0-alpha.6",
|
||||
"@k8slens/messaging": "^1.0.0-alpha.4",
|
||||
"@k8slens/messaging-for-main": "^1.0.0-alpha.4",
|
||||
"@k8slens/messaging-for-renderer": "^1.0.0-alpha.4",
|
||||
"@k8slens/node-fetch": "^6.5.0-alpha.3",
|
||||
"@k8slens/react-application": "^1.0.0-alpha.3",
|
||||
"@k8slens/run-many": "^1.0.0-alpha.4",
|
||||
"@k8slens/startable-stoppable": "^1.0.0-alpha.3",
|
||||
"@k8slens/utilities": "^1.0.0-alpha.3",
|
||||
"@ogre-tools/fp": "^15.8.1",
|
||||
"@ogre-tools/injectable": "^15.8.1",
|
||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.8.1",
|
||||
"@ogre-tools/injectable-extension-for-mobx": "^15.8.1",
|
||||
"@ogre-tools/injectable-react": "^15.8.1",
|
||||
"mobx": "^6.8.0",
|
||||
"rimraf": "^4.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@electron/rebuild": "^3.2.10",
|
||||
"@k8slens/generate-tray-icons": "^6.5.0-alpha.5",
|
||||
"@k8slens/test-utils": "^1.0.0-alpha.4",
|
||||
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
||||
"@swc/cli": "^0.1.62",
|
||||
"@swc/core": "^1.3.53",
|
||||
"@swc/jest": "^0.2.26",
|
||||
"@types/byline": "^4.2.33",
|
||||
"@types/chart.js": "^2.9.36",
|
||||
"@types/color": "^3.0.3",
|
||||
"@types/crypto-js": "^3.1.47",
|
||||
"@types/lodash": "^4.14.191",
|
||||
"@types/node": "^16.18.25",
|
||||
"@types/proper-lockfile": "^4.1.2",
|
||||
"@types/react-dom": "^17.0.16",
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
"@types/react-virtualized-auto-sizer": "^1.0.1",
|
||||
"@types/react-window": "^1.8.5",
|
||||
"@types/request-promise-native": "^1.0.18",
|
||||
"@types/tar": "^6.1.4",
|
||||
"@types/tcp-port-used": "^1.0.1",
|
||||
"@types/url-parse": "^1.4.8",
|
||||
"@types/uuid": "^8.3.4",
|
||||
"@types/webpack": "^5.28.1",
|
||||
"@types/webpack-dev-server": "^4.7.2",
|
||||
"@types/webpack-env": "^1.18.0",
|
||||
"@types/webpack-node-externals": "2.5.3",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"circular-dependency-plugin": "^5.2.2",
|
||||
"concurrently": "^7.6.0",
|
||||
"copy-webpack-plugin": "^11.0.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-loader": "^6.7.2",
|
||||
"electron": "^22.3.7",
|
||||
"electron-builder": "^23.6.0",
|
||||
"electron-notarize": "^0.3.0",
|
||||
"esbuild-loader": "^2.20.0",
|
||||
"fork-ts-checker-webpack-plugin": "^7.3.0",
|
||||
"html-webpack-plugin": "^5.5.1",
|
||||
"jest": "^29.5.0",
|
||||
"jest-environment-jsdom": "^28.1.3",
|
||||
"jsonfile": "^6.1.0",
|
||||
"mini-css-extract-plugin": "^2.7.1",
|
||||
"monaco-editor": "^0.37.1",
|
||||
"monaco-editor-webpack-plugin": "^7.0.1",
|
||||
"node-loader": "^2.0.0",
|
||||
"nodemon": "^2.0.20",
|
||||
"playwright": "^1.33.0",
|
||||
"react-refresh": "^0.14.0",
|
||||
"react-refresh-typescript": "^2.0.7",
|
||||
"react-select": "^5.7.0",
|
||||
"rimraf": "^4.4.1",
|
||||
"run-script-os": "^1.1.6",
|
||||
"style-loader": "^3.3.1",
|
||||
"tailwindcss": "^3.3.2",
|
||||
"ts-loader": "^9.4.2",
|
||||
"ts-node": "^10.9.1",
|
||||
"type-fest": "^2.14.0",
|
||||
"typed-emitter": "^1.4.0",
|
||||
"typescript": "^4.9.5",
|
||||
"typescript-plugin-css-modules": "^4.1.1",
|
||||
"webpack": "^5.81.0",
|
||||
"webpack-cli": "^4.9.2",
|
||||
"webpack-dev-server": "^4.13.3",
|
||||
"webpack-node-externals": "^3.0.0",
|
||||
"xterm-addon-fit": "^0.5.0"
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/**
|
||||
* 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 packageJson from "../../package.json";
|
||||
import { applicationInformationToken } from "@k8slens/application";
|
||||
|
||||
const applicationInformationInjectable = getInjectable({
|
||||
id: "application-information",
|
||||
instantiate: () => {
|
||||
const {
|
||||
version,
|
||||
config: {
|
||||
bundledHelmVersion,
|
||||
bundledKubectlVersion,
|
||||
contentSecurityPolicy,
|
||||
k8sProxyVersion,
|
||||
sentryDsn,
|
||||
welcomeRoute,
|
||||
},
|
||||
productName,
|
||||
build,
|
||||
copyright,
|
||||
description,
|
||||
name,
|
||||
dependencies,
|
||||
} = packageJson;
|
||||
|
||||
return {
|
||||
version,
|
||||
productName,
|
||||
copyright,
|
||||
description,
|
||||
name,
|
||||
k8sProxyVersion,
|
||||
bundledKubectlVersion,
|
||||
bundledHelmVersion,
|
||||
sentryDsn,
|
||||
contentSecurityPolicy,
|
||||
welcomeRoute,
|
||||
updatingIsEnabled: (build as any)?.publish?.length > 0,
|
||||
dependencies,
|
||||
};
|
||||
},
|
||||
causesSideEffects: true,
|
||||
injectionToken: applicationInformationToken,
|
||||
});
|
||||
|
||||
export default applicationInformationInjectable;
|
||||
@@ -1,14 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { lensBuildEnvironmentInjectionToken } from "@k8slens/application";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
|
||||
const lensBuildEnvironmentInjectable = getInjectable({
|
||||
id: "lens-build-environment",
|
||||
instantiate: () => "unknown",
|
||||
injectionToken: lensBuildEnvironmentInjectionToken,
|
||||
});
|
||||
|
||||
export default lensBuildEnvironmentInjectable;
|
||||
@@ -1,21 +0,0 @@
|
||||
import { bundledExtensionInjectionToken } from "@k8slens/legacy-extensions";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import exampleBundledExtensionManifest from "@k8slens/legacy-extension-example/package.json";
|
||||
|
||||
const exampleBundledExtensionInjectable = getInjectable({
|
||||
id: "example-bundled-extension",
|
||||
instantiate: (di) => ({
|
||||
manifest: exampleBundledExtensionManifest,
|
||||
/**
|
||||
* Inline `require` is needed as to delay the loading and execution of the JS file until it is needed.
|
||||
*
|
||||
* Futhermore there might be code that runs "during load" and shouldn't be executed until everything is
|
||||
* setup for the extensions (ie globals).
|
||||
*/
|
||||
main: () => require("@k8slens/legacy-extension-example/main").default,
|
||||
renderer: () => require("@k8slens/legacy-extension-example/renderer").default,
|
||||
}),
|
||||
injectionToken: bundledExtensionInjectionToken,
|
||||
});
|
||||
|
||||
export default exampleBundledExtensionInjectable;
|
||||
@@ -1,67 +0,0 @@
|
||||
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
|
||||
import { runInAction } from "mobx";
|
||||
import {
|
||||
mainExtensionApi as Main,
|
||||
commonExtensionApi as Common,
|
||||
registerLensCore,
|
||||
} from "@k8slens/core/main";
|
||||
import { createContainer } from "@ogre-tools/injectable";
|
||||
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
||||
import { registerFeature } from "@k8slens/feature-core";
|
||||
import { applicationFeature, startApplicationInjectionToken } from '@k8slens/application'
|
||||
import { applicationFeatureForElectronMain } from '@k8slens/application-for-electron-main'
|
||||
import { messagingFeatureForMain } from "@k8slens/messaging-for-main";
|
||||
import { loggerFeature } from "@k8slens/logger";
|
||||
|
||||
const environment = "main";
|
||||
|
||||
const di = createContainer(environment, {
|
||||
detectCycles: false,
|
||||
});
|
||||
|
||||
registerMobX(di);
|
||||
|
||||
runInAction(() => {
|
||||
registerLensCore(di, environment);
|
||||
|
||||
registerFeature(di,
|
||||
loggerFeature,
|
||||
);
|
||||
|
||||
registerFeature(di,
|
||||
applicationFeature,
|
||||
applicationFeatureForElectronMain,
|
||||
messagingFeatureForMain,
|
||||
);
|
||||
|
||||
try {
|
||||
autoRegister({
|
||||
di,
|
||||
targetModule: module,
|
||||
getRequireContexts: () => [
|
||||
require.context("./", true, CONTEXT_MATCHER_FOR_NON_FEATURES),
|
||||
require.context("../common", true, CONTEXT_MATCHER_FOR_NON_FEATURES),
|
||||
],
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
const startApplication = di.inject(startApplicationInjectionToken);
|
||||
|
||||
startApplication().catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
})
|
||||
|
||||
export {
|
||||
Mobx,
|
||||
Pty,
|
||||
} from "@k8slens/core/main";
|
||||
|
||||
export const LensExtensions = {
|
||||
Main,
|
||||
Common,
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { nodeEnvInjectionToken } from "@k8slens/core/main";
|
||||
|
||||
export const nodeEnvInjectable = getInjectable({
|
||||
id: "node-env",
|
||||
instantiate: () => process.env.NODE_ENV || "development",
|
||||
injectionToken: nodeEnvInjectionToken,
|
||||
});
|
||||
@@ -1,79 +0,0 @@
|
||||
import "@k8slens/core/styles";
|
||||
import "@k8slens/button/dist/index.css";
|
||||
import "@k8slens/error-boundary/dist/index.css";
|
||||
import "@k8slens/tooltip/dist/index.css";
|
||||
import { runInAction } from "mobx";
|
||||
import {
|
||||
rendererExtensionApi as Renderer,
|
||||
commonExtensionApi as Common,
|
||||
registerLensCore,
|
||||
metricsFeature
|
||||
} from "@k8slens/core/renderer";
|
||||
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
|
||||
import { registerFeature } from "@k8slens/feature-core";
|
||||
import {
|
||||
applicationFeature,
|
||||
startApplicationInjectionToken
|
||||
} from "@k8slens/application";
|
||||
import { createContainer } from "@ogre-tools/injectable";
|
||||
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
||||
import { registerInjectableReact } from "@ogre-tools/injectable-react";
|
||||
import { messagingFeatureForRenderer } from "@k8slens/messaging-for-renderer";
|
||||
import { keyboardShortcutsFeature } from "@k8slens/keyboard-shortcuts";
|
||||
import { reactApplicationFeature } from "@k8slens/react-application";
|
||||
import { routingFeature } from "@k8slens/routing";
|
||||
import { loggerFeature } from "@k8slens/logger";
|
||||
|
||||
const environment = "renderer";
|
||||
|
||||
const di = createContainer(environment, {
|
||||
detectCycles: false,
|
||||
});
|
||||
|
||||
runInAction(() => {
|
||||
registerMobX(di);
|
||||
registerInjectableReact(di);
|
||||
registerLensCore(di, environment);
|
||||
|
||||
registerFeature(
|
||||
di,
|
||||
loggerFeature,
|
||||
);
|
||||
|
||||
registerFeature(
|
||||
di,
|
||||
applicationFeature,
|
||||
messagingFeatureForRenderer,
|
||||
keyboardShortcutsFeature,
|
||||
reactApplicationFeature,
|
||||
routingFeature,
|
||||
metricsFeature
|
||||
);
|
||||
|
||||
autoRegister({
|
||||
di,
|
||||
targetModule: module,
|
||||
getRequireContexts: () => [
|
||||
require.context("./", true, CONTEXT_MATCHER_FOR_NON_FEATURES),
|
||||
require.context("../common", true, CONTEXT_MATCHER_FOR_NON_FEATURES),
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
const startApplication = di.inject(startApplicationInjectionToken);
|
||||
|
||||
startApplication();
|
||||
|
||||
export {
|
||||
React,
|
||||
ReactDOM,
|
||||
ReactRouter,
|
||||
ReactRouterDom,
|
||||
Mobx,
|
||||
MobxReact,
|
||||
} from "@k8slens/core/renderer";
|
||||
|
||||
export const LensExtensions = {
|
||||
Renderer,
|
||||
Common,
|
||||
};
|
||||
@@ -1,8 +0,0 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { nodeEnvInjectionToken } from "@k8slens/core/renderer";
|
||||
|
||||
export const nodeEnvInjectable = getInjectable({
|
||||
id: "node-env",
|
||||
instantiate: () => process.env.NODE_ENV || "development",
|
||||
injectionToken: nodeEnvInjectionToken,
|
||||
});
|
||||
@@ -1,164 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
html, body{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
body {
|
||||
background: #1e2124;
|
||||
color: #6c757d;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
.aligner-center-center{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.aligner-content{
|
||||
position: relative;
|
||||
width: 100%;
|
||||
padding: 80px;
|
||||
}
|
||||
.icon {
|
||||
position: relative;
|
||||
font-size: 36px;
|
||||
line-height: 54px;
|
||||
margin-bottom: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
.icon svg{
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 54px;
|
||||
height: 54px;
|
||||
top: 14px;
|
||||
}
|
||||
.icon .icon-text{
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
display: inline;
|
||||
}
|
||||
svg{
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
.loading{
|
||||
padding-top: 10px;
|
||||
position: relative;
|
||||
}
|
||||
.bar{
|
||||
position: relative;;
|
||||
height: 2px;
|
||||
background: #262b2f;
|
||||
}
|
||||
.progress{
|
||||
position: relative;
|
||||
height: 2px;
|
||||
background: #3d90ce;
|
||||
box-shadow: 0 0 20px #3d90ce;
|
||||
animation-name: loader-animation;
|
||||
animation-duration: 1.6s;
|
||||
animation-iteration-count: infinite;
|
||||
animation-timing-function: ease-in-out;
|
||||
}
|
||||
|
||||
@keyframes loader-animation{
|
||||
0% {
|
||||
left: 0;
|
||||
width: 0px;
|
||||
}
|
||||
50% {
|
||||
left: 0;
|
||||
width: 100%;
|
||||
}
|
||||
100% {
|
||||
left: 100%;
|
||||
width: 0px;
|
||||
}
|
||||
}
|
||||
.glow-wrapper{
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
top: -2px;
|
||||
}
|
||||
|
||||
.glow{
|
||||
height: 100%;
|
||||
display: flex;
|
||||
transform: translateZ(0);
|
||||
}
|
||||
|
||||
.glow div{
|
||||
flex: 1;
|
||||
background: #3d90ce;
|
||||
animation: glow 0.8s infinite alternate ease;
|
||||
box-shadow: 0 0 20px #3d90ce;
|
||||
}
|
||||
|
||||
.glow div.b1{ animation-delay: -0.72s; }
|
||||
.glow div.b2{ animation-delay: -0.64s; }
|
||||
.glow div.b3{ animation-delay: -0.56s; }
|
||||
.glow div.b4{ animation-delay: -0.48s; }
|
||||
.glow div.b5{ animation-delay: -0.40s; }
|
||||
.glow div.b6{ animation-delay: -0.32s; }
|
||||
.glow div.b7{ animation-delay: -0.24s; }
|
||||
.glow div.b8{ animation-delay: -0.16s; }
|
||||
.glow div.b9{ animation-delay: -0.08s; }
|
||||
|
||||
|
||||
@keyframes glow{
|
||||
100% {
|
||||
background: transparent;
|
||||
flex: 10;
|
||||
box-shadow: 0 0 0 transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.text{
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
text-align: center;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="aligner-center-center">
|
||||
<div class="aligner-content">
|
||||
<div class="icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#3f90ce"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M14.25 2.26l-.08-.04-.01.02C13.46 2.09 12.74 2 12 2 6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10c0-4.75-3.31-8.72-7.75-9.74zM19.41 9h-7.99l2.71-4.7c2.4.66 4.35 2.42 5.28 4.7zM13.1 4.08L10.27 9l-1.15 2L6.4 6.3C7.84 4.88 9.82 4 12 4c.37 0 .74.03 1.1.08zM5.7 7.09L8.54 12l1.15 2H4.26C4.1 13.36 4 12.69 4 12c0-1.85.64-3.55 1.7-4.91zM4.59 15h7.98l-2.71 4.7c-2.4-.67-4.34-2.42-5.27-4.7zm6.31 4.91L14.89 13l2.72 4.7C16.16 19.12 14.18 20 12 20c-.38 0-.74-.04-1.1-.09zm7.4-3l-4-6.91h5.43c.17.64.27 1.31.27 2 0 1.85-.64 3.55-1.7 4.91z"/></svg>
|
||||
<div class="icon-text">OpenLens</div>
|
||||
</div>
|
||||
<div class="loading">
|
||||
<div class="bar">
|
||||
<div class="progress"></div>
|
||||
</div>
|
||||
<div class="glow-wrapper">
|
||||
<div class="glow">
|
||||
<div class="b1"></div>
|
||||
<div class="b2"></div>
|
||||
<div class="b3"></div>
|
||||
<div class="b4"></div>
|
||||
<div class="b5"></div>
|
||||
<div class="b6"></div>
|
||||
<div class="b7"></div>
|
||||
<div class="b8"></div>
|
||||
<div class="b9"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text">
|
||||
Loading...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"*": [
|
||||
"node_modules/*",
|
||||
]
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
"name": "typescript-plugin-css-modules"
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"../core/types/*.d.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"out",
|
||||
"dist",
|
||||
"coverage",
|
||||
"binaries",
|
||||
"static"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../core"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import Webpack from "webpack";
|
||||
import WebpackDevServer from "webpack-dev-server";
|
||||
import renderer from "./renderer";
|
||||
import { buildDir, webpackDevServerPort } from "./vars";
|
||||
|
||||
/**
|
||||
* API docs:
|
||||
* @url https://webpack.js.org/configuration/dev-server/
|
||||
* @url https://github.com/chimurai/http-proxy-middleware
|
||||
*/
|
||||
const compiler = Webpack(renderer);
|
||||
|
||||
const server = new WebpackDevServer({
|
||||
setupExitSignals: true,
|
||||
headers: {
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
},
|
||||
allowedHosts: ".lens.app",
|
||||
host: "localhost",
|
||||
port: webpackDevServerPort,
|
||||
static: buildDir, // aka `devServer.contentBase` in webpack@4
|
||||
hot: "only", // use HMR only without errors
|
||||
liveReload: false,
|
||||
devMiddleware: {
|
||||
writeToDisk: true,
|
||||
index: "index.html",
|
||||
publicPath: "/build",
|
||||
},
|
||||
proxy: {
|
||||
"^/$": "/build/",
|
||||
},
|
||||
client: {
|
||||
overlay: false, // don't show warnings and errors on top of rendered app view
|
||||
logging: "error",
|
||||
},
|
||||
}, compiler);
|
||||
|
||||
console.info(`[WEBPACK-DEV-SERVER]: created with options`, server.options);
|
||||
|
||||
server.start();
|
||||
@@ -1,59 +0,0 @@
|
||||
import path from "path";
|
||||
import type webpack from "webpack";
|
||||
import { DefinePlugin } from "webpack";
|
||||
import nodeExternals from "webpack-node-externals";
|
||||
import { iconsAndImagesWebpackRules } from "./renderer";
|
||||
import { buildDir, isDevelopment, mainDir } from "./vars";
|
||||
import { platform } from "process";
|
||||
|
||||
const main: webpack.Configuration = ({
|
||||
name: "lens-app-main",
|
||||
context: __dirname,
|
||||
target: "electron-main",
|
||||
mode: isDevelopment ? "development" : "production",
|
||||
devtool: isDevelopment ? "cheap-module-source-map" : "source-map",
|
||||
cache: isDevelopment ? { type: "filesystem" } : false,
|
||||
entry: {
|
||||
main: path.resolve(mainDir, "index.ts"),
|
||||
},
|
||||
output: {
|
||||
libraryTarget: "global",
|
||||
path: buildDir,
|
||||
},
|
||||
optimization: {
|
||||
minimize: false,
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".json", ".js", ".ts"],
|
||||
},
|
||||
externals: [
|
||||
nodeExternals({ modulesFromFile: true }),
|
||||
],
|
||||
module: {
|
||||
parser: {
|
||||
javascript: {
|
||||
commonjsMagicComments: true,
|
||||
},
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
test: /\.node$/,
|
||||
use: "node-loader",
|
||||
},
|
||||
{
|
||||
test: /\.ts$/,
|
||||
loader: "ts-loader",
|
||||
options: {},
|
||||
},
|
||||
...iconsAndImagesWebpackRules(),
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new DefinePlugin({
|
||||
CONTEXT_MATCHER_FOR_NON_FEATURES: `/\\.injectable\\.tsx?$/`,
|
||||
CONTEXT_MATCHER_FOR_FEATURES: `/\\/(renderer|common)\\/.+\\.injectable\\.tsx?$/`,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
export default main;
|
||||
@@ -1,195 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import path from "path";
|
||||
import type webpack from "webpack";
|
||||
import HtmlWebpackPlugin from "html-webpack-plugin";
|
||||
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
||||
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
|
||||
import MonacoWebpackPlugin from "monaco-editor-webpack-plugin";
|
||||
import CircularDependencyPlugin from "circular-dependency-plugin";
|
||||
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
|
||||
import CopyPlugin from "copy-webpack-plugin";
|
||||
import type { WebpackPluginInstance } from "webpack";
|
||||
import { DefinePlugin } from "webpack";
|
||||
import { assetsFolderName, isDevelopment, rendererDir, buildDir, htmlTemplate, publicPath } from "./vars";
|
||||
import { platform } from "process";
|
||||
|
||||
const renderer: webpack.Configuration = {
|
||||
target: "electron-renderer",
|
||||
name: "lens-app-renderer",
|
||||
mode: isDevelopment ? "development" : "production",
|
||||
// https://webpack.js.org/configuration/devtool/ (see description of each option)
|
||||
devtool: isDevelopment ? "cheap-module-source-map" : "source-map",
|
||||
cache: isDevelopment ? { type: "filesystem" } : false,
|
||||
entry: {
|
||||
lens: path.resolve(rendererDir, "index.ts"),
|
||||
},
|
||||
output: {
|
||||
libraryTarget: "global",
|
||||
globalObject: "this",
|
||||
publicPath,
|
||||
path: buildDir,
|
||||
filename: "[name].js",
|
||||
chunkFilename: "chunks/[name].js",
|
||||
assetModuleFilename: `${assetsFolderName}/[name][ext][query]`,
|
||||
},
|
||||
watchOptions: {
|
||||
ignored: /node_modules/, // https://webpack.js.org/configuration/watch/
|
||||
},
|
||||
ignoreWarnings: [
|
||||
/Critical dependency: the request of a dependency is an expression/,
|
||||
/require.extensions is not supported by webpack./, // handlebars
|
||||
/\[ReactRefreshPlugin] .*?HMR.*? is not enabled/, // enabled in webpack.dev-server
|
||||
],
|
||||
resolve: {
|
||||
extensions: [
|
||||
".js", ".jsx", ".json",
|
||||
".ts", ".tsx",
|
||||
],
|
||||
},
|
||||
externals: [
|
||||
"npm",
|
||||
"win-ca"
|
||||
],
|
||||
optimization: {
|
||||
minimize: false,
|
||||
},
|
||||
module: {
|
||||
parser: {
|
||||
javascript: {
|
||||
commonjsMagicComments: true,
|
||||
},
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
test: /\.node$/,
|
||||
use: "node-loader",
|
||||
},
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
loader: "ts-loader",
|
||||
options: {},
|
||||
},
|
||||
cssModulesWebpackRule(),
|
||||
...iconsAndImagesWebpackRules(),
|
||||
...fontsLoaderWebpackRules(),
|
||||
],
|
||||
},
|
||||
|
||||
plugins: [
|
||||
new DefinePlugin({
|
||||
CONTEXT_MATCHER_FOR_NON_FEATURES: `/\\.injectable\\.tsx?$/`,
|
||||
CONTEXT_MATCHER_FOR_FEATURES: `/\\/(renderer|common)\\/.+\\.injectable\\.tsx?$/`,
|
||||
}),
|
||||
new ForkTsCheckerPlugin(),
|
||||
|
||||
// see also: https://github.com/Microsoft/monaco-editor-webpack-plugin#options
|
||||
new MonacoWebpackPlugin({
|
||||
// publicPath: "/",
|
||||
// filename: "[name].worker.js",
|
||||
languages: ["json", "yaml"],
|
||||
globalAPI: isDevelopment,
|
||||
}),
|
||||
|
||||
new HtmlWebpackPlugin({
|
||||
filename: "index.html",
|
||||
template: htmlTemplate,
|
||||
inject: true,
|
||||
hash: true,
|
||||
templateParameters: {
|
||||
assetPath: `${publicPath}${assetsFolderName}`,
|
||||
},
|
||||
}),
|
||||
|
||||
new CircularDependencyPlugin({
|
||||
cwd: __dirname,
|
||||
exclude: /node_modules/,
|
||||
failOnError: true,
|
||||
}) as unknown as WebpackPluginInstance,
|
||||
|
||||
new MiniCssExtractPlugin({
|
||||
filename: "[name].css",
|
||||
}),
|
||||
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
{
|
||||
// TODO: Figure out a way to access without relative path
|
||||
from: "../../node_modules/@k8slens/core/static/build/library/*.ttf",
|
||||
to: "[name][ext]",
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
||||
...(
|
||||
isDevelopment
|
||||
? [new ReactRefreshWebpackPlugin()]
|
||||
: []
|
||||
),
|
||||
],
|
||||
};
|
||||
|
||||
/**
|
||||
* Import icons and image files.
|
||||
* Read more about asset types: https://webpack.js.org/guides/asset-modules/
|
||||
*/
|
||||
export function iconsAndImagesWebpackRules(): webpack.RuleSetRule[] {
|
||||
return [
|
||||
{
|
||||
test: /\.svg$/,
|
||||
type: "asset/source", // exports the source code of the asset, so we get XML
|
||||
},
|
||||
{
|
||||
test: /\.(jpg|png|ico)$/,
|
||||
type: "asset/resource", // path to file, e.g. "/static/build/assets/*"
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Import custom fonts as URL.
|
||||
*/
|
||||
export function fontsLoaderWebpackRules(): webpack.RuleSetRule[] {
|
||||
return [
|
||||
{
|
||||
test: /\.(ttf|eot|woff2?)$/,
|
||||
type: "asset/resource",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export interface CssModulesWebpackRuleOptions {
|
||||
styleLoader?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import CSS or SASS styles with modules support (*.module.scss)
|
||||
*/
|
||||
export function cssModulesWebpackRule({ styleLoader }: CssModulesWebpackRuleOptions = {}): webpack.RuleSetRule {
|
||||
styleLoader ??= isDevelopment
|
||||
? "style-loader"
|
||||
: MiniCssExtractPlugin.loader;
|
||||
|
||||
return {
|
||||
test: /\.s?css$/,
|
||||
use: [
|
||||
styleLoader,
|
||||
{
|
||||
loader: "css-loader",
|
||||
options: {
|
||||
sourceMap: isDevelopment,
|
||||
modules: {
|
||||
auto: /\.module\./i, // https://github.com/webpack-contrib/css-loader#auto
|
||||
mode: "local", // :local(.selector) by default
|
||||
localIdentName: "[name]__[local]--[hash:base64:5]",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export default renderer;
|
||||
@@ -1,21 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import assert from "assert";
|
||||
import path from "path";
|
||||
|
||||
export const isDevelopment = process.env.NODE_ENV !== "production";
|
||||
export const mainDir = path.join(process.cwd(), "src", "main");
|
||||
export const buildDir = path.join(process.cwd(), "static", "build");
|
||||
export const assetsFolderName = "assets";
|
||||
export const rendererDir = path.join(process.cwd(), "src", "renderer");
|
||||
export const publicPath = "/build/";
|
||||
export const webpackDevServerPort = Number(process.env.WEBPACK_DEV_SERVER_PORT) || 9191;
|
||||
|
||||
// TODO: Figure out a way to access these without relative paths
|
||||
export const htmlTemplate = path.resolve(__dirname, "..", "..", "..", "node_modules", "@k8slens", "core", "src/renderer", "template.html");
|
||||
export const sassCommonVars = path.resolve(__dirname, "..", "..", "..", "node_modules", "@k8slens", "core", "src", "renderer", "components/vars.scss");
|
||||
|
||||
assert(Number.isInteger(webpackDevServerPort), "WEBPACK_DEV_SERVER_PORT environment variable must only be an integer");
|
||||
@@ -1,4 +0,0 @@
|
||||
import main from "./main";
|
||||
import renderer from "./renderer";
|
||||
|
||||
export default [main, renderer];
|
||||
Reference in new issue
Block a user