mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Merge branch 'master' into new-resource-view-validatingwebhooks-config
This commit is contained in:
commit
e14eac57db
6
.github/workflows/daily-alpha.yml
vendored
6
.github/workflows/daily-alpha.yml
vendored
@ -23,13 +23,13 @@ jobs:
|
||||
run: |
|
||||
npm install
|
||||
sudo apt-get install -y ripgrep
|
||||
cd packages/bump-version-for-cron && npm run build
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Bump version
|
||||
id: version
|
||||
run: |
|
||||
node packages/bump-version-for-cron/dist/index.js --path packages/core/package.json
|
||||
npm run --workspace @k8slens/bump-version-for-cron build
|
||||
npm run --workspace @k8slens/bump-version-for-cron bump -- --path packages/core/package.json
|
||||
- name: Check if branch already exists
|
||||
id: check-branch
|
||||
run: git ls-remote --exit-code --tags origin v${{ steps.version.outputs.VERSION }}
|
||||
@ -77,7 +77,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: v${{ needs.create_release.outputs.version }}
|
||||
- name: Use Node.js ${{ env.NODE_VERSION }}
|
||||
- name: Use Node.js 16.x
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "16.x"
|
||||
|
||||
9
.vscode/settings.json
vendored
9
.vscode/settings.json
vendored
@ -1,3 +1,8 @@
|
||||
{
|
||||
"eslint.workingDirectories": [{ "mode": "auto" }]
|
||||
}
|
||||
"eslint.workingDirectories": [
|
||||
{
|
||||
"mode": "auto"
|
||||
}
|
||||
],
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
}
|
||||
|
||||
801
package-lock.json
generated
801
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -29,8 +29,8 @@
|
||||
"test:unit:watch": "jest --watch",
|
||||
"test:integration": "lerna run --stream test:integration --no-bail",
|
||||
"bump-version": "lerna version --no-git-tag-version --no-push",
|
||||
"precreate-release-pr": "cd packages/release-tool && npm run build",
|
||||
"create-release-pr": "node packages/release-tool/dist/index.js"
|
||||
"precreate-release-pr": "npm run --workspace @k8slens/release-tool build",
|
||||
"create-release-pr": "npm run --workspace @k8slens/release-tool create"
|
||||
},
|
||||
"overrides": {
|
||||
"underscore": "^1.12.1",
|
||||
|
||||
@ -6,12 +6,9 @@
|
||||
"scripts": {
|
||||
"clean": "rimraf dist/",
|
||||
"build": "swc ./src/index.ts -d ./dist",
|
||||
"postbuild": "run-script-os",
|
||||
"postbuild:windows": "",
|
||||
"postbuild:nix": "chmod u+x ./dist/index.js"
|
||||
"bump": "node ./dist/index.js"
|
||||
},
|
||||
"type": "module",
|
||||
"bin": "./dist/index.js",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
@ -25,11 +22,10 @@
|
||||
"semver": "^7.3.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.1.61",
|
||||
"@swc/cli": "^0.1.62",
|
||||
"@swc/core": "^1.3.44",
|
||||
"@types/node": "^16.18.11",
|
||||
"@types/semver": "^7.3.13",
|
||||
"rimraf": "^4.4.1",
|
||||
"run-script-os": "^1.1.6"
|
||||
"rimraf": "^4.4.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
"version": "6.5.0-alpha.2",
|
||||
"description": "Injection token exporter for cluster settings configuration",
|
||||
"license": "MIT",
|
||||
"type": "commonjs",
|
||||
"private": false,
|
||||
"mode": "production",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
@ -16,17 +16,9 @@
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "rimraf dist/",
|
||||
"generate-types": "tsc --d --declarationDir ./dist --declarationMap --emitDeclarationOnly",
|
||||
"build": "npm run generate-types && swc ./src/index.ts -d ./dist",
|
||||
"prepare": "npm run build",
|
||||
"prepare:dev": "npm run build",
|
||||
"prepare:test": "npm run build"
|
||||
"build": "webpack"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.1.61",
|
||||
"@swc/core": "^1.3.44",
|
||||
"@types/node": "^16.18.11",
|
||||
"@types/semver": "^7.3.13",
|
||||
"rimraf": "^4.4.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@ -1,18 +1,4 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist/",
|
||||
"paths": {
|
||||
"*": [
|
||||
"node_modules/*",
|
||||
"types/*"
|
||||
]
|
||||
},
|
||||
},
|
||||
"include": [
|
||||
"src/**/*",
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
]
|
||||
"extends": "@k8slens/typescript/config/base.json",
|
||||
"include": ["**/*.ts"]
|
||||
}
|
||||
|
||||
1
packages/cluster-settings/webpack.config.js
Normal file
1
packages/cluster-settings/webpack.config.js
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require("@k8slens/webpack").configForNode;
|
||||
@ -184,9 +184,9 @@
|
||||
"@material-ui/icons": "^4.11.2",
|
||||
"@material-ui/lab": "^4.0.0-alpha.60",
|
||||
"@sentry/types": "^6.19.7",
|
||||
"@swc/cli": "^0.1.61",
|
||||
"@swc/cli": "^0.1.62",
|
||||
"@swc/core": "^1.3.44",
|
||||
"@swc/jest": "^0.2.24",
|
||||
"@swc/jest": "^0.2.26",
|
||||
"@testing-library/dom": "^8.19.0",
|
||||
"@testing-library/jest-dom": "^5.16.5",
|
||||
"@testing-library/react": "^12.1.5",
|
||||
@ -272,8 +272,8 @@
|
||||
"memorystream": "^0.3.1",
|
||||
"mini-css-extract-plugin": "^2.7.2",
|
||||
"mock-http": "^1.1.0",
|
||||
"monaco-editor": "^0.29.1",
|
||||
"monaco-editor-webpack-plugin": "^5.0.0",
|
||||
"monaco-editor": "^0.37.1",
|
||||
"monaco-editor-webpack-plugin": "^7.0.1",
|
||||
"node-gyp": "^8.3.0",
|
||||
"node-loader": "^2.0.0",
|
||||
"nodemon": "^2.0.20",
|
||||
@ -298,7 +298,7 @@
|
||||
"ts-node": "^10.9.1",
|
||||
"type-fest": "^2.14.0",
|
||||
"typed-emitter": "^1.4.0",
|
||||
"typedoc": "^0.24.0",
|
||||
"typedoc": "^0.24.1",
|
||||
"typedoc-plugin-markdown": "^3.13.6",
|
||||
"typescript": "^4.9.5",
|
||||
"typescript-plugin-css-modules": "^3.4.0",
|
||||
@ -313,6 +313,7 @@
|
||||
"@k8slens/application": "^6.5.0-alpha.0",
|
||||
"@k8slens/application-for-electron-main": "^6.5.0-alpha.0",
|
||||
"@k8slens/cluster-settings": "^6.5.0-alpha.1",
|
||||
"@k8slens/kubectl-versions": "^1.0.0-alpha.0",
|
||||
"@k8slens/legacy-extensions": "^1.0.0-alpha.0",
|
||||
"@k8slens/messaging": "^1.0.0-alpha.1",
|
||||
"@k8slens/messaging-for-main": "^1.0.0-alpha.1",
|
||||
@ -340,7 +341,7 @@
|
||||
"@types/tcp-port-used": "^1.0.1",
|
||||
"@types/url-parse": "^1.4.8",
|
||||
"@types/uuid": "^8.3.4",
|
||||
"monaco-editor": "^0.29.1",
|
||||
"monaco-editor": "^0.37.1",
|
||||
"react-select": "^5.7.0",
|
||||
"typed-emitter": "^1.4.0",
|
||||
"xterm-addon-fit": "^0.5.0"
|
||||
|
||||
@ -34,7 +34,7 @@ const createKubectlInjectable = getInjectable({
|
||||
normalizedDownloadPlatform: di.inject(normalizedPlatformInjectable),
|
||||
kubectlBinaryName: di.inject(kubectlBinaryNameInjectable),
|
||||
bundledKubectlBinaryPath: di.inject(bundledKubectlBinaryPathInjectable),
|
||||
baseBundeledBinariesDirectory: di.inject(baseBundledBinariesDirectoryInjectable),
|
||||
baseBundledBinariesDirectory: di.inject(baseBundledBinariesDirectoryInjectable),
|
||||
bundledKubectlVersion: di.inject(bundledKubectlVersionInjectable),
|
||||
kubectlVersionMap: di.inject(kubectlVersionMapInjectable),
|
||||
logger: di.inject(loggerInjectable),
|
||||
|
||||
@ -29,7 +29,7 @@ export interface KubectlDependencies {
|
||||
readonly normalizedDownloadArch: "amd64" | "arm64" | "386";
|
||||
readonly kubectlBinaryName: string;
|
||||
readonly bundledKubectlBinaryPath: string;
|
||||
readonly baseBundeledBinariesDirectory: string;
|
||||
readonly baseBundledBinariesDirectory: string;
|
||||
readonly state: {
|
||||
readonly kubectlBinariesPath?: string;
|
||||
readonly downloadBinariesPath?: string;
|
||||
@ -302,7 +302,7 @@ export class Kubectl {
|
||||
}
|
||||
|
||||
protected async writeInitScripts() {
|
||||
const binariesDir = this.dependencies.baseBundeledBinariesDirectory;
|
||||
const binariesDir = this.dependencies.baseBundledBinariesDirectory;
|
||||
const kubectlPath = this.dependencies.state.downloadKubectlBinaries
|
||||
? this.dirname
|
||||
: this.dependencies.getDirnameOfPath(this.getPathFromPreferences());
|
||||
|
||||
@ -3,31 +3,19 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { SemVer } from "semver";
|
||||
import bundledKubectlVersionInjectable from "../../common/vars/bundled-kubectl-version.injectable";
|
||||
import { kubectlVersions } from "@k8slens/kubectl-versions";
|
||||
|
||||
const kubectlVersionMapInjectable = getInjectable({
|
||||
id: "kubectl-version-map",
|
||||
instantiate: (di) => {
|
||||
const bundledKubectlVersion = di.inject(bundledKubectlVersionInjectable);
|
||||
const bundledKubectlSemVer = new SemVer(bundledKubectlVersion);
|
||||
|
||||
return new Map([
|
||||
["1.7", "1.8.15"],
|
||||
["1.8", "1.9.10"],
|
||||
["1.9", "1.10.13"],
|
||||
["1.10", "1.11.10"],
|
||||
["1.11", "1.12.10"],
|
||||
["1.12", "1.13.12"],
|
||||
["1.13", "1.13.12"],
|
||||
["1.14", "1.14.10"],
|
||||
["1.15", "1.15.11"],
|
||||
["1.16", "1.16.15"],
|
||||
["1.17", "1.17.17"],
|
||||
["1.18", "1.18.20"],
|
||||
["1.19", "1.19.12"],
|
||||
["1.20", "1.20.8"],
|
||||
["1.21", "1.21.9"],
|
||||
["1.22", "1.22.6"],
|
||||
["1.23", bundledKubectlVersion],
|
||||
...kubectlVersions,
|
||||
[`${bundledKubectlSemVer.major}.${bundledKubectlSemVer.minor}`, bundledKubectlVersion],
|
||||
]);
|
||||
},
|
||||
});
|
||||
|
||||
@ -7,14 +7,7 @@
|
||||
"scripts": {
|
||||
"clean": "rimraf dist/",
|
||||
"build": "swc ./src/index.ts -d ./dist/",
|
||||
"postbuild": "run-script-os",
|
||||
"postbuild:windows": "",
|
||||
"postbuild:nix": "chmod u+x ./dist/index.js",
|
||||
"prepare:dev": "npm run build",
|
||||
"prepare": "npm run build"
|
||||
},
|
||||
"bin": {
|
||||
"ensure-binaries": "./dist/index.js"
|
||||
"ensure": "node ./dist/index.js"
|
||||
},
|
||||
"type": "module",
|
||||
"files": [
|
||||
@ -34,14 +27,13 @@
|
||||
"zod": "^3.20.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.1.61",
|
||||
"@swc/cli": "^0.1.62",
|
||||
"@swc/core": "^1.3.44",
|
||||
"@types/cli-progress": "^3.11.0",
|
||||
"@types/gunzip-maybe": "^1.4.0",
|
||||
"@types/node": "^16.18.11",
|
||||
"@types/semver": "^7.3.13",
|
||||
"@types/tar-stream": "^2.2.2",
|
||||
"rimraf": "^4.4.1",
|
||||
"run-script-os": "^1.1.6"
|
||||
"rimraf": "^4.4.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,16 +23,31 @@ const options = arg({
|
||||
"--base-dir": String,
|
||||
});
|
||||
|
||||
const pathToPackage = options["--package"];
|
||||
const pathToBaseDir = options["--base-dir"];
|
||||
type Options = typeof options;
|
||||
|
||||
if (typeof pathToPackage !== "string") {
|
||||
throw new Error("--package is required");
|
||||
}
|
||||
const assertOption = <Key extends keyof Options>(key: Key): NonNullable<Options[Key]> => {
|
||||
const raw = options[key];
|
||||
|
||||
if (typeof pathToBaseDir !== "string") {
|
||||
throw new Error("--base-dir is required");
|
||||
}
|
||||
if (raw === undefined) {
|
||||
console.error(`missing ${key} option`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
return raw;
|
||||
};
|
||||
|
||||
const joinWithInitCwd = (relativePath: string): string => {
|
||||
const { INIT_CWD } = process.env;
|
||||
|
||||
if (!INIT_CWD) {
|
||||
return relativePath;
|
||||
}
|
||||
|
||||
return path.join(INIT_CWD, relativePath);
|
||||
};
|
||||
|
||||
const pathToPackage = joinWithInitCwd(assertOption("--package"));
|
||||
const pathToBaseDir = joinWithInitCwd(assertOption("--base-dir"));
|
||||
|
||||
function setTimeoutFor(controller: AbortController, timeout: number): void {
|
||||
const handle = setTimeout(() => controller.abort(), timeout);
|
||||
|
||||
@ -22,8 +22,7 @@
|
||||
"scripts": {
|
||||
"build": "webpack --config webpack/extensions.ts",
|
||||
"build:docs": "typedoc",
|
||||
"clean": "rimraf dist/",
|
||||
"prepare:dev": "npm run build"
|
||||
"clean": "rimraf dist/"
|
||||
},
|
||||
"dependencies": {
|
||||
"@k8slens/core": "^6.5.0-alpha.6"
|
||||
@ -40,7 +39,7 @@
|
||||
"ts-loader": "^9.4.2",
|
||||
"ts-node": "^10.9.1",
|
||||
"typed-emitter": "^2.1.0",
|
||||
"typedoc": "0.23.25",
|
||||
"typedoc": "0.24.1",
|
||||
"typedoc-plugin-markdown": "^3.13.6",
|
||||
"typescript": "^4.9.5",
|
||||
"typescript-plugin-css-modules": "^4.1.1",
|
||||
|
||||
@ -6,14 +6,7 @@
|
||||
"scripts": {
|
||||
"clean": "rimraf dist/",
|
||||
"build": "swc ./src/index.ts -d ./dist/",
|
||||
"postbuild": "run-script-os",
|
||||
"postbuild:windows": "",
|
||||
"postbuild:nix": "chmod u+x ./dist/index.js",
|
||||
"prepare:dev": "npm run build",
|
||||
"prepare": "npm run build"
|
||||
},
|
||||
"bin": {
|
||||
"generate-tray-icons": "./dist/index.js"
|
||||
"generate": "node ./dist/index.js"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
@ -25,13 +18,12 @@
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.1.61",
|
||||
"@swc/cli": "^0.1.62",
|
||||
"@swc/core": "^1.3.44",
|
||||
"@types/jsdom": "^20.0.1",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/sharp": "^0.31.1",
|
||||
"rimraf": "^4.4.1",
|
||||
"run-script-os": "^1.1.6"
|
||||
"rimraf": "^4.4.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"arg": "^5.0.2",
|
||||
|
||||
@ -23,7 +23,7 @@ type Options = typeof options;
|
||||
const assertOption = <Key extends keyof Options>(key: Key): NonNullable<Options[Key]> => {
|
||||
const raw = options[key];
|
||||
|
||||
if (!raw) {
|
||||
if (raw === undefined) {
|
||||
console.error(`missing ${key} option`);
|
||||
process.exit(1);
|
||||
}
|
||||
@ -31,11 +31,21 @@ const assertOption = <Key extends keyof Options>(key: Key): NonNullable<Options[
|
||||
return raw;
|
||||
};
|
||||
|
||||
const joinWithInitCwd = (relativePath: string): string => {
|
||||
const { INIT_CWD } = process.env;
|
||||
|
||||
if (!INIT_CWD) {
|
||||
return relativePath;
|
||||
}
|
||||
|
||||
return path.join(INIT_CWD, relativePath);
|
||||
};
|
||||
|
||||
const size = options["--output-size"] ?? 16;
|
||||
const inputFile = assertOption("--input");
|
||||
const outputFolder = assertOption("--output");
|
||||
const noticeFile = assertOption("--notice-icon");
|
||||
const spinnerFile = assertOption("--spinner-icon");
|
||||
const inputFile = joinWithInitCwd(assertOption("--input"));
|
||||
const outputFolder = joinWithInitCwd(assertOption("--output"));
|
||||
const noticeFile = joinWithInitCwd(assertOption("--notice-icon"));
|
||||
const spinnerFile = joinWithInitCwd(assertOption("--spinner-icon"));
|
||||
|
||||
const getSvgStyling = (colouring: "dark" | "light") => (
|
||||
`
|
||||
|
||||
@ -20,8 +20,6 @@
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/lensapp/lens",
|
||||
"dependencies": {
|
||||
"@swc/core": "^1.3.44",
|
||||
"@swc/jest": "^0.2.23",
|
||||
"@testing-library/jest-dom": "^5.16.5",
|
||||
"@testing-library/react": "^12.1.5",
|
||||
"@types/jest": "^29.2.2",
|
||||
@ -32,5 +30,10 @@
|
||||
"jest-watch-typeahead": "^2.2.1",
|
||||
"lodash": "^4.17.21",
|
||||
"ts-jest": "^29.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.1.62",
|
||||
"@swc/core": "^1.3.44",
|
||||
"@swc/jest": "^0.2.26"
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ exports[`get-multi-export-config given maximal package.json, when creating confi
|
||||
output: {
|
||||
path: '/some-working-directory/dist',
|
||||
filename: [Function: filename],
|
||||
libraryTarget: 'commonjs2'
|
||||
library: { type: 'commonjs2' }
|
||||
},
|
||||
externalsPresets: { node: true },
|
||||
node: { __dirname: true, __filename: true },
|
||||
@ -64,7 +64,7 @@ exports[`get-multi-export-config given maximal package.json, when creating confi
|
||||
output: {
|
||||
path: '/some-working-directory/dist/some-entrypoint',
|
||||
filename: [Function: filename],
|
||||
libraryTarget: 'commonjs2'
|
||||
library: { type: 'commonjs2' }
|
||||
},
|
||||
externalsPresets: { node: true },
|
||||
node: { __dirname: true, __filename: true },
|
||||
@ -113,7 +113,7 @@ exports[`get-multi-export-config given maximal package.json, when creating confi
|
||||
output: {
|
||||
path: '/some-working-directory/dist/some-other-entrypoint',
|
||||
filename: [Function: filename],
|
||||
libraryTarget: 'commonjs2'
|
||||
library: { type: 'commonjs2' }
|
||||
},
|
||||
externalsPresets: { node: true },
|
||||
node: { __dirname: true, __filename: true },
|
||||
|
||||
@ -2,6 +2,10 @@ const ForkTsCheckerPlugin = require("fork-ts-checker-webpack-plugin");
|
||||
const { MakePeerDependenciesExternalPlugin } = require("./plugins/make-peer-dependencies-external");
|
||||
const { ProtectFromImportingNonDependencies } = require("./plugins/protect-from-importing-non-dependencies");
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {import("webpack").Configuration}
|
||||
*/
|
||||
module.exports = ({ entrypointFilePath, outputDirectory }) => ({
|
||||
name: entrypointFilePath,
|
||||
entry: { index: entrypointFilePath },
|
||||
@ -45,7 +49,9 @@ module.exports = ({ entrypointFilePath, outputDirectory }) => ({
|
||||
? "index.js"
|
||||
: `${pathData.chunk.name}/index.js`,
|
||||
|
||||
libraryTarget: "commonjs2",
|
||||
library: {
|
||||
type: "commonjs2"
|
||||
}
|
||||
},
|
||||
|
||||
externalsPresets: { node: true },
|
||||
|
||||
1
packages/kubectl-versions/.gitignore
vendored
Normal file
1
packages/kubectl-versions/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
build/*.mjs
|
||||
8
packages/kubectl-versions/README.md
Normal file
8
packages/kubectl-versions/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# @k8slens/kubectl-versions
|
||||
|
||||
This package contains a JSON array of entries of the format ["MAJOR.MINOR", "MAJOR.MINOR.PATCH"].
|
||||
|
||||
This object represents the current (at time of building each release of this package)
|
||||
greatest PATCH version for each "MAJOR.MINOR" version of `kubectl`.
|
||||
This is done at compile time so that we don't have to worry about being able to access this data on user machines.
|
||||
Furthermore, this is dynamic in that the previous method was to update the table by hand.
|
||||
63
packages/kubectl-versions/build/compute-versions.ts
Normal file
63
packages/kubectl-versions/build/compute-versions.ts
Normal file
@ -0,0 +1,63 @@
|
||||
import fetch from "node-fetch";
|
||||
import { TypedRegEx } from "typed-regex";
|
||||
import { XMLParser } from "fast-xml-parser";
|
||||
import semver from "semver";
|
||||
import { writeFile } from "fs/promises";
|
||||
import path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const { SemVer } = semver;
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const expectedResponseForm = TypedRegEx("v(?<version>\\d+\\.\\d+\\.\\d+)");
|
||||
|
||||
async function requestGreatestKubectlPatchVersion(majorMinor: string): Promise<string | undefined> {
|
||||
const response = await fetch(`https://dl.k8s.io/release/stable-${majorMinor}.txt`);
|
||||
|
||||
if (response.status !== 200) {
|
||||
try {
|
||||
const parser = new XMLParser();
|
||||
const errorBody = parser.parse(await response.text());
|
||||
|
||||
throw new Error(`failed to get stable version for ${majorMinor}: ${errorBody?.Error?.Message ?? response.statusText}`);
|
||||
} catch {
|
||||
throw new Error(`failed to get stable version for ${majorMinor}: ${response.statusText}`);
|
||||
}
|
||||
}
|
||||
|
||||
const body = await response.text();
|
||||
const match = expectedResponseForm.captures(body);
|
||||
|
||||
if (!match) {
|
||||
throw new Error(`failed to get stable version for ${majorMinor}: unexpected response shape. body="${body}"`);
|
||||
}
|
||||
|
||||
return match.version;
|
||||
}
|
||||
|
||||
async function requestAllVersions(): Promise<[string, string][]> {
|
||||
const greatestVersion = await requestGreatestKubectlPatchVersion("1");
|
||||
|
||||
if (!greatestVersion) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const greatestSemVer = new SemVer(greatestVersion);
|
||||
const majorMinorRequests = new Array<string>(greatestSemVer.minor + 1)
|
||||
.fill("")
|
||||
.map((value, index) => `1.${index}`)
|
||||
.map(async (majorMinor) => [majorMinor, await requestGreatestKubectlPatchVersion(majorMinor)] as const);
|
||||
|
||||
return (await Promise.all(majorMinorRequests))
|
||||
.filter((entry): entry is [string, string] => !!entry[1]);
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const versions = await requestAllVersions();
|
||||
|
||||
await writeFile(path.join(__dirname, "versions.json"), JSON.stringify(versions, null, 4));
|
||||
}
|
||||
|
||||
await main();
|
||||
114
packages/kubectl-versions/build/versions.json
Normal file
114
packages/kubectl-versions/build/versions.json
Normal file
@ -0,0 +1,114 @@
|
||||
[
|
||||
[
|
||||
"1.0",
|
||||
"1.0.7"
|
||||
],
|
||||
[
|
||||
"1.1",
|
||||
"1.1.8"
|
||||
],
|
||||
[
|
||||
"1.2",
|
||||
"1.2.7"
|
||||
],
|
||||
[
|
||||
"1.3",
|
||||
"1.3.10"
|
||||
],
|
||||
[
|
||||
"1.4",
|
||||
"1.4.12"
|
||||
],
|
||||
[
|
||||
"1.5",
|
||||
"1.5.8"
|
||||
],
|
||||
[
|
||||
"1.6",
|
||||
"1.6.13"
|
||||
],
|
||||
[
|
||||
"1.7",
|
||||
"1.7.16"
|
||||
],
|
||||
[
|
||||
"1.8",
|
||||
"1.8.15"
|
||||
],
|
||||
[
|
||||
"1.9",
|
||||
"1.9.11"
|
||||
],
|
||||
[
|
||||
"1.10",
|
||||
"1.10.13"
|
||||
],
|
||||
[
|
||||
"1.11",
|
||||
"1.11.10"
|
||||
],
|
||||
[
|
||||
"1.12",
|
||||
"1.12.10"
|
||||
],
|
||||
[
|
||||
"1.13",
|
||||
"1.13.12"
|
||||
],
|
||||
[
|
||||
"1.14",
|
||||
"1.14.10"
|
||||
],
|
||||
[
|
||||
"1.15",
|
||||
"1.15.12"
|
||||
],
|
||||
[
|
||||
"1.16",
|
||||
"1.16.15"
|
||||
],
|
||||
[
|
||||
"1.17",
|
||||
"1.17.17"
|
||||
],
|
||||
[
|
||||
"1.18",
|
||||
"1.18.20"
|
||||
],
|
||||
[
|
||||
"1.19",
|
||||
"1.19.16"
|
||||
],
|
||||
[
|
||||
"1.20",
|
||||
"1.20.15"
|
||||
],
|
||||
[
|
||||
"1.21",
|
||||
"1.21.14"
|
||||
],
|
||||
[
|
||||
"1.22",
|
||||
"1.22.17"
|
||||
],
|
||||
[
|
||||
"1.23",
|
||||
"1.23.17"
|
||||
],
|
||||
[
|
||||
"1.24",
|
||||
"1.24.13"
|
||||
],
|
||||
[
|
||||
"1.25",
|
||||
"1.25.9"
|
||||
],
|
||||
[
|
||||
"1.26",
|
||||
"1.26.4"
|
||||
],
|
||||
[
|
||||
"1.27",
|
||||
"1.27.1"
|
||||
]
|
||||
]
|
||||
3
packages/kubectl-versions/index.ts
Normal file
3
packages/kubectl-versions/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import raw from "./build/versions.json";
|
||||
|
||||
export const kubectlVersions = raw as [string, string][];
|
||||
1
packages/kubectl-versions/jest.config.js
Normal file
1
packages/kubectl-versions/jest.config.js
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require("@k8slens/jest").monorepoPackageConfig(__dirname).configForReact;
|
||||
40
packages/kubectl-versions/package.json
Normal file
40
packages/kubectl-versions/package.json
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "@k8slens/kubectl-versions",
|
||||
"private": false,
|
||||
"version": "1.0.0-alpha.0",
|
||||
"description": "Package of kubectl versions at build time",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"main": "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": {
|
||||
"precompute-versions": "swc ./build/compute-versions.ts -o ./build/compute-versions.mjs",
|
||||
"compute-versions": "node ./build/compute-versions.mjs",
|
||||
"prebuild": "npm run compute-versions",
|
||||
"build": "webpack",
|
||||
"dev": "webpack --mode=development --watch",
|
||||
"test": "jest --coverage --runInBand"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@ogre-tools/injectable": "^15.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.1.62",
|
||||
"@swc/core": "^1.3.44",
|
||||
"fast-xml-parser": "^4.1.2",
|
||||
"semver": "^7.3.8",
|
||||
"ts-node": "^10.9.1",
|
||||
"typed-regex": "^0.0.8"
|
||||
}
|
||||
}
|
||||
3
packages/kubectl-versions/tsconfig.json
Normal file
3
packages/kubectl-versions/tsconfig.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "@k8slens/typescript/config/base.json"
|
||||
}
|
||||
1
packages/kubectl-versions/webpack.config.js
Normal file
1
packages/kubectl-versions/webpack.config.js
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require("@k8slens/webpack").configForNode;
|
||||
@ -8,29 +8,20 @@
|
||||
"access": "public",
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"main": "./dist/index.cjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"type": "module",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "rimraf dist/",
|
||||
"build": "webpack --config webpack.ts",
|
||||
"lint": "exit 0",
|
||||
"prepare": "npm run build",
|
||||
"prepare:dev": "npm run build",
|
||||
"prepare:test": "npm run build"
|
||||
"build": "webpack"
|
||||
},
|
||||
"dependencies": {
|
||||
"node-fetch": "^3.3.0",
|
||||
"rimraf": "^4.4.1"
|
||||
"node-fetch": "^3.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^4.4.1",
|
||||
"ts-loader": "^9.4.2",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.9.5",
|
||||
"webpack": "^5.77.0",
|
||||
"webpack-cli": "^5.0.1"
|
||||
"rimraf": "^4.4.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,18 +1,4 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist/",
|
||||
"paths": {
|
||||
"*": [
|
||||
"node_modules/*",
|
||||
"types/*"
|
||||
]
|
||||
},
|
||||
},
|
||||
"include": [
|
||||
"src/**/*",
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
]
|
||||
"extends": "@k8slens/typescript/config/base.json",
|
||||
"include": ["**/*.ts"]
|
||||
}
|
||||
|
||||
@ -1,14 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import path from "path";
|
||||
|
||||
export default {
|
||||
entry: "./src/index.ts",
|
||||
entry: "./index.ts",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
filename: "index.js",
|
||||
path: path.resolve("dist"),
|
||||
filename: "index.cjs",
|
||||
library: {
|
||||
type: "commonjs",
|
||||
},
|
||||
@ -26,8 +22,8 @@ export default {
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(ts|tsx)$/,
|
||||
{
|
||||
test: /\.(ts|tsx)$/,
|
||||
loader: "ts-loader",
|
||||
options: {
|
||||
compilerOptions: {
|
||||
@ -41,5 +37,5 @@ export default {
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".ts"],
|
||||
},
|
||||
}
|
||||
};
|
||||
@ -33,8 +33,8 @@
|
||||
"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": "generate-tray-icons --output ./static/build/tray --input ../../node_modules/@k8slens/core/src/renderer/components/icon/logo-lens.svg --notice-icon ../../node_modules/@k8slens/core/src/renderer/components/icon/notice.svg --spinner-icon ../../node_modules/@k8slens/core/src/renderer/components/icon/arrow-spinner.svg",
|
||||
"download:binaries": "ensure-binaries --package ./package.json --base-dir ./binaries/client",
|
||||
"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": {
|
||||
@ -191,6 +191,7 @@
|
||||
"@k8slens/ensure-binaries": "^6.5.0-alpha.2",
|
||||
"@k8slens/feature-core": "^6.5.0-alpha.2",
|
||||
"@k8slens/keyboard-shortcuts": "^1.0.0-alpha.2",
|
||||
"@k8slens/kubectl-versions": "^1.0.0-alpha.0",
|
||||
"@k8slens/legacy-extension-example": "^1.0.0-alpha.4",
|
||||
"@k8slens/legacy-extensions": "^1.0.0-alpha.2",
|
||||
"@k8slens/messaging": "^1.0.0-alpha.2",
|
||||
@ -214,9 +215,9 @@
|
||||
"@k8slens/generate-tray-icons": "^6.5.0-alpha.2",
|
||||
"@k8slens/test-utils": "^1.0.0-alpha.2",
|
||||
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
||||
"@swc/cli": "^0.1.61",
|
||||
"@swc/cli": "^0.1.62",
|
||||
"@swc/core": "^1.3.44",
|
||||
"@swc/jest": "^0.2.24",
|
||||
"@swc/jest": "^0.2.26",
|
||||
"@types/byline": "^4.2.33",
|
||||
"@types/chart.js": "^2.9.36",
|
||||
"@types/color": "^3.0.3",
|
||||
@ -253,8 +254,8 @@
|
||||
"jest-environment-jsdom": "^28.1.3",
|
||||
"jsonfile": "^6.1.0",
|
||||
"mini-css-extract-plugin": "^2.7.1",
|
||||
"monaco-editor": "^0.29.1",
|
||||
"monaco-editor-webpack-plugin": "^5.0.0",
|
||||
"monaco-editor": "^0.37.1",
|
||||
"monaco-editor-webpack-plugin": "^7.0.1",
|
||||
"node-loader": "^2.0.0",
|
||||
"nodemon": "^2.0.20",
|
||||
"playwright": "^1.32.1",
|
||||
|
||||
@ -8,22 +8,16 @@
|
||||
"scripts": {
|
||||
"clean": "rimraf dist/",
|
||||
"build": "swc ./src/index.ts -d ./dist",
|
||||
"postbuild": "run-script-os",
|
||||
"postbuild:windows": "",
|
||||
"postbuild:nix": "chmod u+x ./dist/index.js"
|
||||
},
|
||||
"bin": {
|
||||
"create-release-pr": "./dist/index.js"
|
||||
"create": "node ./dist/index.js"
|
||||
},
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.1.61",
|
||||
"@swc/cli": "^0.1.62",
|
||||
"@swc/core": "^1.3.44",
|
||||
"@types/inquirer": "^9.0.3",
|
||||
"@types/node": "^16.18.11",
|
||||
"@types/semver": "^7.3.13",
|
||||
"rimraf": "^4.4.1",
|
||||
"run-script-os": "^1.1.6"
|
||||
"rimraf": "^4.4.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": "^5.2.0",
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
"semver": "^7.3.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.1.61",
|
||||
"@swc/cli": "^0.1.62",
|
||||
"@swc/core": "^1.3.44",
|
||||
"@types/command-line-args": "^5.2.0",
|
||||
"@types/node": "^16.18.11",
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable prettier/prettier */
|
||||
import { getInjectable, getInjectionToken } from "@ogre-tools/injectable";
|
||||
import { runManyFor } from "@k8slens/run-many";
|
||||
import * as timeSlots from "./time-slots";
|
||||
|
||||
@ -34,9 +34,9 @@
|
||||
"@k8slens/application": "^6.5.0-alpha.0",
|
||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||
"@k8slens/messaging": "^1.0.0-alpha.1",
|
||||
"@ogre-tools/fp": "^15.1.2",
|
||||
"@ogre-tools/injectable": "^15.3.1",
|
||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.3.0",
|
||||
"@ogre-tools/fp": "^15.1.2",
|
||||
"electron": "^22.3.3",
|
||||
"lodash": "^4.17.21"
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user