mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
revert back to syncronous migrations. Use make-syncronous to use file-type package
Signed-off-by: Sebastian Malton <smalton@mirantis.com>
This commit is contained in:
parent
37d9681fee
commit
e5a7f9fa39
@ -185,6 +185,7 @@
|
|||||||
"jsonpath": "^1.0.2",
|
"jsonpath": "^1.0.2",
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
"mac-ca": "^1.0.4",
|
"mac-ca": "^1.0.4",
|
||||||
|
"make-synchronous": "^0.1.0",
|
||||||
"marked": "^1.1.0",
|
"marked": "^1.1.0",
|
||||||
"md5-file": "^5.0.0",
|
"md5-file": "^5.0.0",
|
||||||
"mobx": "^5.15.5",
|
"mobx": "^5.15.5",
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { migration } from "../migration-wrapper";
|
|||||||
|
|
||||||
export default migration({
|
export default migration({
|
||||||
version: "2.0.0-beta.2",
|
version: "2.0.0-beta.2",
|
||||||
async run(store, log) {
|
run(store, log) {
|
||||||
for (const value of store) {
|
for (const value of store) {
|
||||||
const contextName = value[0];
|
const contextName = value[0];
|
||||||
// Looping all the keys gives out the store internal stuff too...
|
// Looping all the keys gives out the store internal stuff too...
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { migration } from "../migration-wrapper";
|
|||||||
|
|
||||||
export default migration({
|
export default migration({
|
||||||
version: "2.4.1",
|
version: "2.4.1",
|
||||||
async run(store, log) {
|
run(store, log) {
|
||||||
for (const value of store) {
|
for (const value of store) {
|
||||||
const contextName = value[0];
|
const contextName = value[0];
|
||||||
if (contextName === "__internal__") continue;
|
if (contextName === "__internal__") continue;
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { migration } from "../migration-wrapper";
|
|||||||
|
|
||||||
export default migration({
|
export default migration({
|
||||||
version: "2.6.0-beta.2",
|
version: "2.6.0-beta.2",
|
||||||
async run(store, log) {
|
run(store, log) {
|
||||||
for (const value of store) {
|
for (const value of store) {
|
||||||
const clusterKey = value[0];
|
const clusterKey = value[0];
|
||||||
if (clusterKey === "__internal__") continue
|
if (clusterKey === "__internal__") continue
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import yaml from "js-yaml"
|
|||||||
|
|
||||||
export default migration({
|
export default migration({
|
||||||
version: "2.6.0-beta.3",
|
version: "2.6.0-beta.3",
|
||||||
async run(store, log) {
|
run(store, log) {
|
||||||
for (const value of store) {
|
for (const value of store) {
|
||||||
const clusterKey = value[0];
|
const clusterKey = value[0];
|
||||||
if (clusterKey === "__internal__") continue
|
if (clusterKey === "__internal__") continue
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { migration } from "../migration-wrapper";
|
|||||||
|
|
||||||
export default migration({
|
export default migration({
|
||||||
version: "2.7.0-beta.0",
|
version: "2.7.0-beta.0",
|
||||||
async run(store, log) {
|
run(store, log) {
|
||||||
for (const value of store) {
|
for (const value of store) {
|
||||||
const clusterKey = value[0];
|
const clusterKey = value[0];
|
||||||
if (clusterKey === "__internal__") continue
|
if (clusterKey === "__internal__") continue
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { v4 as uuid } from "uuid"
|
|||||||
|
|
||||||
export default migration({
|
export default migration({
|
||||||
version: "2.7.0-beta.1",
|
version: "2.7.0-beta.1",
|
||||||
async run(store, log) {
|
run(store, log) {
|
||||||
const clusters: any[] = []
|
const clusters: any[] = []
|
||||||
for (const value of store) {
|
for (const value of store) {
|
||||||
const clusterKey = value[0];
|
const clusterKey = value[0];
|
||||||
|
|||||||
@ -8,10 +8,11 @@ import fse from "fs-extra"
|
|||||||
import fileType from "file-type";
|
import fileType from "file-type";
|
||||||
import { ClusterModel } from "../../common/cluster-store";
|
import { ClusterModel } from "../../common/cluster-store";
|
||||||
import { loadConfig, saveConfigToAppFiles } from "../../common/kube-helpers";
|
import { loadConfig, saveConfigToAppFiles } from "../../common/kube-helpers";
|
||||||
|
import makeSynchronous from "make-synchronous"
|
||||||
|
|
||||||
export default migration({
|
export default migration({
|
||||||
version: "3.6.0-beta.1",
|
version: "3.6.0-beta.1",
|
||||||
async run(store, printLog) {
|
run(store, printLog) {
|
||||||
const kubeConfigBase = path.join((app || remote.app).getPath("userData"), "kubeconfigs")
|
const kubeConfigBase = path.join((app || remote.app).getPath("userData"), "kubeconfigs")
|
||||||
const storedClusters: ClusterModel[] = store.get("clusters") || [];
|
const storedClusters: ClusterModel[] = store.get("clusters") || [];
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ export default migration({
|
|||||||
|
|
||||||
printLog("Number of clusters to migrate: ", storedClusters.length)
|
printLog("Number of clusters to migrate: ", storedClusters.length)
|
||||||
const migratedClusters = storedClusters
|
const migratedClusters = storedClusters
|
||||||
.map(async cluster => {
|
.map(cluster => {
|
||||||
/**
|
/**
|
||||||
* migrate kubeconfig
|
* migrate kubeconfig
|
||||||
*/
|
*/
|
||||||
@ -40,8 +41,8 @@ export default migration({
|
|||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
if (cluster.preferences.icon) {
|
if (cluster.preferences.icon) {
|
||||||
const fileData = await fse.readFile(cluster.preferences.icon);
|
const fileData = fse.readFileSync(cluster.preferences.icon);
|
||||||
const { mime } = await fileType.fromBuffer(fileData);
|
const { mime } = makeSynchronous(() => fileType.fromBuffer(fileData))();
|
||||||
|
|
||||||
if (!mime) {
|
if (!mime) {
|
||||||
throw "unknown icon file type, deleting...";
|
throw "unknown icon file type, deleting...";
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { isTestEnv } from "../common/vars";
|
|||||||
|
|
||||||
export interface MigrationOpts {
|
export interface MigrationOpts {
|
||||||
version: string;
|
version: string;
|
||||||
run(storeConfig: Config<any>, log: (...args: any[]) => void): Promise<void>;
|
run(storeConfig: Config<any>, log: (...args: any[]) => void): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
function infoLog(...args: any[]) {
|
function infoLog(...args: any[]) {
|
||||||
@ -15,7 +15,7 @@ export function migration<S = any>({ version, run }: MigrationOpts) {
|
|||||||
return {
|
return {
|
||||||
[version]: async (storeConfig: Config<S>) => {
|
[version]: async (storeConfig: Config<S>) => {
|
||||||
infoLog(`STORE MIGRATION (${storeConfig.path}): ${version}`,);
|
infoLog(`STORE MIGRATION (${storeConfig.path}): ${version}`,);
|
||||||
await run(storeConfig, infoLog);
|
run(storeConfig, infoLog);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { migration } from "../migration-wrapper";
|
|||||||
|
|
||||||
export default migration({
|
export default migration({
|
||||||
version: "2.1.0-beta.4",
|
version: "2.1.0-beta.4",
|
||||||
async run(store) {
|
run(store) {
|
||||||
store.set("lastSeenAppVersion", "0.0.0");
|
store.set("lastSeenAppVersion", "0.0.0");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
28
yarn.lock
28
yarn.lock
@ -7640,6 +7640,14 @@ make-plural@^6.2.1:
|
|||||||
resolved "https://registry.yarnpkg.com/make-plural/-/make-plural-6.2.1.tgz#2790af1d05fb2fc35a111ce759ffdb0aca1339a3"
|
resolved "https://registry.yarnpkg.com/make-plural/-/make-plural-6.2.1.tgz#2790af1d05fb2fc35a111ce759ffdb0aca1339a3"
|
||||||
integrity sha512-AmkruwJ9EjvyTv6AM8MBMK3TAeOJvhgTv5YQXzF0EP2qawhpvMjDpHvsdOIIT0Vn+BB0+IogmYZ1z+Ulm/m0Fg==
|
integrity sha512-AmkruwJ9EjvyTv6AM8MBMK3TAeOJvhgTv5YQXzF0EP2qawhpvMjDpHvsdOIIT0Vn+BB0+IogmYZ1z+Ulm/m0Fg==
|
||||||
|
|
||||||
|
make-synchronous@^0.1.0:
|
||||||
|
version "0.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/make-synchronous/-/make-synchronous-0.1.0.tgz#d117ef54364130775e900bd52726293cda420c0d"
|
||||||
|
integrity sha512-KgHpheDCBClcMtPN9EKB+BXyL7cAM8zrRVq8FbJBZzPbXgWlJqRAPMNU6NyJ05kEp4pmMOEgvftK7Jnaxpz2bA==
|
||||||
|
dependencies:
|
||||||
|
subsume "^3.0.0"
|
||||||
|
type-fest "^0.16.0"
|
||||||
|
|
||||||
makeerror@1.0.x:
|
makeerror@1.0.x:
|
||||||
version "1.0.11"
|
version "1.0.11"
|
||||||
resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c"
|
resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c"
|
||||||
@ -10685,6 +10693,21 @@ style-loader@^1.2.1:
|
|||||||
loader-utils "^2.0.0"
|
loader-utils "^2.0.0"
|
||||||
schema-utils "^2.6.6"
|
schema-utils "^2.6.6"
|
||||||
|
|
||||||
|
subsume@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/subsume/-/subsume-3.0.0.tgz#22c92730f441ad72ee9af4bdad42dc4ff830cfaf"
|
||||||
|
integrity sha512-6n/UfV8UWKwJNO8OAOiKntwEMihuBeeoJfzpL542C+OuvT4iWG9SwjrXkOmsxjb4SteHUsos9SvrdqZ9+ICwTQ==
|
||||||
|
dependencies:
|
||||||
|
escape-string-regexp "^2.0.0"
|
||||||
|
unique-string "^2.0.0"
|
||||||
|
|
||||||
|
sumchecker@^2.0.2:
|
||||||
|
version "2.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/sumchecker/-/sumchecker-2.0.2.tgz#0f42c10e5d05da5d42eea3e56c3399a37d6c5b3e"
|
||||||
|
integrity sha1-D0LBDl0F2l1C7qPlbDOZo31sWz4=
|
||||||
|
dependencies:
|
||||||
|
debug "^2.2.0"
|
||||||
|
|
||||||
sumchecker@^3.0.1:
|
sumchecker@^3.0.1:
|
||||||
version "3.0.1"
|
version "3.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/sumchecker/-/sumchecker-3.0.1.tgz#6377e996795abb0b6d348e9b3e1dfb24345a8e42"
|
resolved "https://registry.yarnpkg.com/sumchecker/-/sumchecker-3.0.1.tgz#6377e996795abb0b6d348e9b3e1dfb24345a8e42"
|
||||||
@ -11187,6 +11210,11 @@ type-fest@^0.13.1:
|
|||||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.13.1.tgz#0172cb5bce80b0bd542ea348db50c7e21834d934"
|
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.13.1.tgz#0172cb5bce80b0bd542ea348db50c7e21834d934"
|
||||||
integrity sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==
|
integrity sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==
|
||||||
|
|
||||||
|
type-fest@^0.16.0:
|
||||||
|
version "0.16.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.16.0.tgz#3240b891a78b0deae910dbeb86553e552a148860"
|
||||||
|
integrity sha512-eaBzG6MxNzEn9kiwvtre90cXaNLkmadMWa1zQMs3XORCXNbsH/OewwbxC5ia9dCxIxnTAsSxXJaa/p5y8DlvJg==
|
||||||
|
|
||||||
type-fest@^0.6.0:
|
type-fest@^0.6.0:
|
||||||
version "0.6.0"
|
version "0.6.0"
|
||||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b"
|
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user