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

fix migration to not include spaces and remove old folder

Signed-off-by: Sebastian Malton <smalton@mirantis.com>
This commit is contained in:
Sebastian Malton 2020-09-08 16:34:13 -04:00
parent 8d1f0efe80
commit a8291f9c74
6 changed files with 59 additions and 1 deletions

View File

@ -171,6 +171,7 @@
"@types/proper-lockfile": "^4.1.1",
"@types/react-beautiful-dnd": "^13.0.0",
"@types/tar": "^4.0.3",
"@types/triple-beam": "^1.3.2",
"array-move": "^3.0.0",
"chalk": "^4.1.0",
"conf": "^7.0.1",
@ -204,9 +205,11 @@
"semver": "^7.3.2",
"serializr": "^2.0.3",
"shell-env": "^3.0.0",
"string.ify": "^1.0.64",
"tar": "^6.0.2",
"tcp-port-used": "^1.0.1",
"tempy": "^0.5.0",
"triple-beam": "^1.3.0",
"universal-analytics": "^0.4.20",
"uuid": "^8.1.0",
"win-ca": "^3.2.0",

View File

@ -366,4 +366,9 @@ describe("pre 3.6.0-beta.1 config with an existing cluster", () => {
const { icon } = clusterStore.clustersList[0].preferences;
expect(icon.startsWith("data:;base64,")).toBe(true);
})
it("migration of icon does not have whitespace", async () => {
const { icon } = clusterStore.clustersList[0].preferences;
expect(/\s/g.exec(icon)).toBe(null);
})
})

View File

@ -1,6 +1,27 @@
import { app, remote } from "electron";
import winston from "winston"
import { isDebugging } from "../common/vars";
import { format } from "logform";
import stringify from "string.ify";
import { MESSAGE } from "triple-beam";
const debugSimple = format(info => {
const rest = Object.assign({}, info);
delete rest.level;
delete rest.message;
delete rest.splat;
const stringifiedRest = stringify.configure({ maxStringLength: 300 })(rest);
const padding = info.padding?.[info.level] || '';
if (stringifiedRest !== '{}') {
info[MESSAGE as any] = `${info.level}:${padding} ${info.message} ${stringifiedRest}`;
} else {
info[MESSAGE as any] = `${info.level}:${padding} ${info.message}`;
}
return info;
});
const consoleOptions: winston.transports.ConsoleTransportOptions = {
handleExceptions: false,
@ -20,7 +41,7 @@ const fileOptions: winston.transports.FileTransportOptions = {
const logger = winston.createLogger({
format: winston.format.combine(
winston.format.colorize(),
winston.format.simple(),
isDebugging ? debugSimple() : winston.format.simple(),
),
transports: [
new winston.transports.Console(consoleOptions),

View File

@ -12,6 +12,7 @@ export default migration({
version: "3.6.0-beta.1",
run(store, printLog) {
const userDataPath = (app || remote.app).getPath("userData")
const iconsFolder = path.join(userDataPath, "icons")
const kubeConfigBase = ClusterStore.getCustomKubeConfigPath("");
const storedClusters: ClusterModel[] = store.get("clusters") || [];
@ -61,5 +62,7 @@ export default migration({
if (migratedClusters.length > 0) {
store.set("clusters", migratedClusters)
}
fse.removeSync(iconsFolder)
}
})

1
types/mocks.d.ts vendored
View File

@ -3,6 +3,7 @@ declare module "mac-ca"
declare module "win-ca"
declare module "@hapi/call"
declare module "@hapi/subtext"
declare module "string.ify"
// Global path to static assets
declare const __static: string;

View File

@ -2199,6 +2199,11 @@
resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.0.tgz#fef1904e4668b6e5ecee60c52cc6a078ffa6697d"
integrity sha512-I99sngh224D0M7XgW1s120zxCt3VYQ3IQsuw3P3jbq5GG4yc79+ZjyKznyOGIQrflfylLgcfekeZW/vk0yng6A==
"@types/triple-beam@^1.3.2":
version "1.3.2"
resolved "https://registry.yarnpkg.com/@types/triple-beam/-/triple-beam-1.3.2.tgz#38ecb64f01aa0d02b7c8f4222d7c38af6316fef8"
integrity sha512-txGIh+0eDFzKGC25zORnswy+br1Ha7hj5cMVwKIU7+s0U2AxxJru/jZSMU6OC9MJWP6+pc/hc6ZjyZShpsyY2g==
"@types/trusted-types@*":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-1.0.4.tgz#922d092c84a776a59acb0bd6785fd82b59b9bad5"
@ -9333,6 +9338,11 @@ pretty-format@^26.0.1:
ansi-styles "^4.0.0"
react-is "^16.12.0"
printable-characters@^1.0.26, printable-characters@^1.0.42:
version "1.0.42"
resolved "https://registry.yarnpkg.com/printable-characters/-/printable-characters-1.0.42.tgz#3f18e977a9bd8eb37fcc4ff5659d7be90868b3d8"
integrity sha1-Pxjpd6m9jrN/zE/1ZZ176Qhos9g=
private@^0.1.8:
version "0.1.8"
resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"
@ -10782,6 +10792,21 @@ string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0:
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.0"
string.bullet@^1.0.12:
version "1.0.12"
resolved "https://registry.yarnpkg.com/string.bullet/-/string.bullet-1.0.12.tgz#b41fc417850a57e4042bf3cf347b6eee257ee253"
integrity sha1-tB/EF4UKV+QEK/PPNHtu7iV+4lM=
dependencies:
printable-characters "^1.0.26"
string.ify@^1.0.64:
version "1.0.64"
resolved "https://registry.yarnpkg.com/string.ify/-/string.ify-1.0.64.tgz#58de9fcc411a26bb61f83bf61a1a756da0966c3b"
integrity sha512-4Aa5yndnuOhE1GV2W3ht4rQ08XHq46JLXmSOv0jeUWEzqliBvm8lAXvt+66np+J9DkoCZikFzTzjXVLRR0F/Xw==
dependencies:
printable-characters "^1.0.42"
string.bullet "^1.0.12"
string.prototype.trimend@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz#85812a6b847ac002270f5808146064c995fb6913"