mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix using this in a plain function
Signed-off-by: Sebastian Malton <smalton@mirantis.com>
This commit is contained in:
parent
df77e959a5
commit
9cbb842199
@ -161,7 +161,7 @@ export async function getKubeConfigLocal(): Promise<string> {
|
||||
}
|
||||
return yaml.safeDump(obj);
|
||||
} catch (err) {
|
||||
logger.debug(`Cannot read local kube-config: ${err}`)
|
||||
logger.debug("Cannot read local kube-config: ", err)
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ export class Cluster implements ClusterModel {
|
||||
this.failureReason = null
|
||||
return ClusterStatus.AccessGranted;
|
||||
} catch (error) {
|
||||
logger.error(`Failed to connect cluster "${this.contextName}": ${error}`)
|
||||
logger.error(`Failed to connect cluster "${this.contextName}": `, error)
|
||||
if (error.statusCode) {
|
||||
if (error.statusCode >= 400 && error.statusCode < 500) {
|
||||
this.failureReason = "Invalid credentials";
|
||||
|
||||
@ -21,7 +21,7 @@ import logger from "./logger"
|
||||
|
||||
const workingDir = path.join(app.getPath("appData"), appName);
|
||||
app.setName(appName);
|
||||
if(!process.env.CICD) {
|
||||
if (!process.env.CICD) {
|
||||
app.setPath("userData", workingDir);
|
||||
}
|
||||
|
||||
|
||||
@ -100,7 +100,7 @@ elif test -f "$HOME/.bash_login"; then
|
||||
elif test -f "$HOME/.profile"; then
|
||||
. "$HOME/.profile"
|
||||
fi
|
||||
export PATH="${this.dirname}:${helmPath}:$PATH"
|
||||
export PATH="${dirname}:${helmPath}:$PATH"
|
||||
export KUBECONFIG="$tempkubeconfig"
|
||||
unset tempkubeconfig
|
||||
`;
|
||||
@ -128,7 +128,7 @@ test -f "$OLD_ZDOTDIR/.zlogin" && . "$OLD_ZDOTDIR/.zlogin"
|
||||
test -f "$OLD_ZDOTDIR/.zshrc" && . "$OLD_ZDOTDIR/.zshrc"
|
||||
|
||||
# voodoo to replace any previous occurences of kubectl path in the PATH
|
||||
kubectlpath="${this.dirname}"
|
||||
kubectlpath="${dirname}"
|
||||
helmpath="${helmPath}"
|
||||
p=":$kubectlpath:"
|
||||
d=":$PATH:"
|
||||
@ -245,7 +245,7 @@ export class Kubectl {
|
||||
|
||||
return true
|
||||
} catch (err) {
|
||||
logger.error(`Could not copy the bundled kubectl to app-data: ${err}`)
|
||||
logger.error("Could not copy the bundled kubectl to app-data: ", err)
|
||||
return false
|
||||
}
|
||||
}
|
||||
@ -262,25 +262,22 @@ export class Kubectl {
|
||||
try {
|
||||
await this.downloadKubectl();
|
||||
} catch (err) {
|
||||
logger.error("Failed to write init scripts");
|
||||
logger.error(err);
|
||||
logger.error("Failed to download kubectl: ", err);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
await this.ensureLatestInitScripts();
|
||||
} catch (err) {
|
||||
logger.error("Failed to write init scripts");
|
||||
logger.error(err)
|
||||
logger.error("Failed to write init scripts: ", err);
|
||||
}
|
||||
|
||||
logger.debug(`Releasing lock for ${this.kubectlVersion}`)
|
||||
await release()
|
||||
|
||||
return true
|
||||
} catch (e) {
|
||||
logger.error(`Failed to get a lock for ${this.kubectlVersion}`)
|
||||
logger.error(e)
|
||||
} catch (err) {
|
||||
logger.error(`Failed to get a lock for ${this.kubectlVersion}: `, err)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { app } from "electron";
|
||||
import winston from "winston"
|
||||
import { isDebugging } from "../common/vars";
|
||||
import logform from "logform"
|
||||
|
||||
const options = {
|
||||
colorize: true,
|
||||
@ -8,8 +10,22 @@ const options = {
|
||||
level: isDebugging ? "debug" : "info",
|
||||
}
|
||||
|
||||
function ignoreInRenderer<T>(...args: (() => T)[]): T[] {
|
||||
return app ? args.map(f => f()) : [];
|
||||
}
|
||||
|
||||
const logger = winston.createLogger({
|
||||
format: winston.format.combine(
|
||||
...ignoreInRenderer(
|
||||
() => winston.format.errors({ stack: true }),
|
||||
() => winston.format(function (info: logform.TransformableInfo, opts?: any): boolean | logform.TransformableInfo {
|
||||
if (info.stack) {
|
||||
info.message += `\n\t${(info.stack as string).replace(/\n/g, "\n\t")}`;
|
||||
delete info.stack
|
||||
}
|
||||
return info
|
||||
})(),
|
||||
),
|
||||
winston.format.colorize(),
|
||||
winston.format.simple(),
|
||||
),
|
||||
|
||||
@ -79,7 +79,7 @@ export class ThemeStore {
|
||||
}
|
||||
return existingTheme;
|
||||
} catch (err) {
|
||||
logger.error(`Can't load theme "${themeId}": ${err}`);
|
||||
logger.error(`Can't load theme "${themeId}": `, err);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ export const packages = [
|
||||
];
|
||||
|
||||
export default function (): webpack.Configuration {
|
||||
return {
|
||||
const res: webpack.Configuration = {
|
||||
context: path.dirname(manifestPath),
|
||||
mode: isDevelopment ? "development" : "production",
|
||||
cache: isDevelopment,
|
||||
@ -31,4 +31,6 @@ export default function (): webpack.Configuration {
|
||||
})
|
||||
],
|
||||
}
|
||||
console.info('WEBPACK:dll', res)
|
||||
return res
|
||||
}
|
||||
|
||||
@ -3,14 +3,14 @@ import webpack from "webpack";
|
||||
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin"
|
||||
import { isDevelopment, isProduction, mainDir, buildDir } from "./src/common/vars";
|
||||
import nodeExternals from "webpack-node-externals";
|
||||
import TerserPlugin from "terser-webpack-plugin";
|
||||
|
||||
export default function (): webpack.Configuration {
|
||||
console.info('WEBPACK:main', require("./src/common/vars"))
|
||||
return {
|
||||
const res: webpack.Configuration = {
|
||||
context: __dirname,
|
||||
target: "electron-main",
|
||||
mode: isProduction ? "production" : "development",
|
||||
devtool: isProduction ? "source-map" : "cheap-eval-source-map",
|
||||
devtool: "source-map",
|
||||
cache: isDevelopment,
|
||||
entry: {
|
||||
main: path.resolve(mainDir, "index.ts"),
|
||||
@ -49,6 +49,12 @@ export default function (): webpack.Configuration {
|
||||
},
|
||||
plugins: [
|
||||
new ForkTsCheckerPlugin(),
|
||||
]
|
||||
],
|
||||
optimization: {
|
||||
minimize: isProduction,
|
||||
minimizer: isProduction ? undefined : [new TerserPlugin()]
|
||||
}
|
||||
}
|
||||
console.info('WEBPACK:main', res)
|
||||
return res
|
||||
}
|
||||
|
||||
@ -7,8 +7,7 @@ import TerserPlugin from "terser-webpack-plugin";
|
||||
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin"
|
||||
|
||||
export default function (): webpack.Configuration {
|
||||
console.info('WEBPACK:renderer', require("./src/common/vars"))
|
||||
return {
|
||||
const res: webpack.Configuration = {
|
||||
context: __dirname,
|
||||
target: "electron-renderer",
|
||||
devtool: "source-map", // todo: optimize in dev-mode with webpack.SourceMapDevToolPlugin
|
||||
@ -157,4 +156,6 @@ export default function (): webpack.Configuration {
|
||||
}),
|
||||
],
|
||||
}
|
||||
console.info('WEBPACK:renderer', res)
|
||||
return res
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user