1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Resolve pr comments

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-08-19 10:18:00 -04:00
parent 32a8425052
commit 10d3149613
3 changed files with 6 additions and 8 deletions

View File

@ -31,7 +31,9 @@ const logLevel = process.env.LOG_LEVEL
? process.env.LOG_LEVEL
: isDebugging
? "debug"
: "info";
: isTestEnv
? "error"
: "info";
const transports: Transport[] = [
new SentryTransport("error")

View File

@ -22,6 +22,7 @@
import semver, { coerce, SemVer } from "semver";
import * as iter from "./iter";
import type { RawHelmChart } from "../k8s-api/endpoints/helm-charts.api";
import logger from "../logger";
export function sortCompare<T>(left: T, right: T): -1 | 0 | 1 {
if (left < right) {
@ -58,7 +59,7 @@ export function sortCompareChartVersions(left: ChartVersion, right: ChartVersion
export function sortCharts(charts: RawHelmChart[], log?: (...args: any[]) => void) {
export function sortCharts(charts: RawHelmChart[]) {
interface ExtendedHelmChart extends RawHelmChart {
__version: SemVer;
}
@ -70,7 +71,7 @@ export function sortCharts(charts: RawHelmChart[], log?: (...args: any[]) => voi
const __version = coerce(chart.version, { includePrerelease: true, loose: true });
if (!__version) {
log?.(`[HELM-SERVICE]: Version from helm chart is not loosely coercable to semver.`, { name: chart.name, version: chart.version, repo: chart.repo });
logger.warn(`[HELM-SERVICE]: Version from helm chart is not loosely coercable to semver.`, { name: chart.name, version: chart.version, repo: chart.repo });
}
(chart as ExtendedHelmChart).__version = __version;

View File

@ -101,16 +101,11 @@ export class HelmChartManager {
created: Date.parse(chart.created).toString(),
repo: this.repo.name,
})),
logger.warn,
),
] as const)
.filter(([, charts]) => !charts.every(chart => chart.deprecated))
);
if (this.repo.name === "grafana") {
console.log(JSON.stringify(normalized));
}
HelmChartManager.#cache.set(this.repo.name, v8.serialize(normalized));
}