From f06cde41df315be21d1dcd7cd28618fe9d590b29 Mon Sep 17 00:00:00 2001 From: Iku-turso Date: Thu, 24 Nov 2022 10:34:53 +0200 Subject: [PATCH] Migrate to appPaths-Feature Co-authored-by: Janne Savolainen Signed-off-by: Iku-turso --- .idea/prettier.xml | 2 +- package.json | 7 ++--- .../app-paths/app-path-injection-token.ts | 12 --------- src/common/app-paths/app-path-names.ts | 26 ------------------- src/common/app-paths/app-paths-channel.ts | 2 +- .../app-paths/app-paths-state.injectable.ts | 2 +- src/common/app-paths/app-paths.injectable.ts | 2 +- src/common/app-paths/app-paths.test.ts | 5 ++-- .../directory-for-downloads.injectable.ts | 2 +- .../directory-for-exes.injectable.ts | 2 +- .../directory-for-temp.injectable.ts | 2 +- .../directory-for-user-data.injectable.ts | 2 +- src/main/app-paths/get-app-paths.ts | 5 ++-- .../get-electron-app-path.ts | 2 +- .../set-electron-app-path.injectable.ts | 2 +- .../app-paths/setup-app-paths.injectable.ts | 4 +-- yarn.lock | 5 ++++ 17 files changed, 25 insertions(+), 59 deletions(-) delete mode 100644 src/common/app-paths/app-path-injection-token.ts delete mode 100644 src/common/app-paths/app-path-names.ts diff --git a/.idea/prettier.xml b/.idea/prettier.xml index 8004cebd99..357044a920 100644 --- a/.idea/prettier.xml +++ b/.idea/prettier.xml @@ -3,4 +3,4 @@ - \ No newline at end of file + diff --git a/package.json b/package.json index 0d0ef0282d..5f0d850dc3 100644 --- a/package.json +++ b/package.json @@ -293,14 +293,15 @@ "winston-transport-browserconsole": "^1.0.5", "ws": "^8.11.0", "xterm-link-provider": "^1.3.1", + "@lensapp/app-paths": "^0.1.1", + "@lensapp/aws-clusters": "^0.1.0", "@lensapp/cluster": "^0.1.5", "@lensapp/feature-core": "^0.1.6", "@lensapp/fs": "^0.2.0", "@lensapp/logging": "^0.1.5", - "@lensapp/shell": "^0.1.6", - "@lensapp/utils": "^0.2.4", "@lensapp/preferences": "^0.1.6", - "@lensapp/aws-clusters": "^0.1.0" + "@lensapp/shell": "^0.1.6", + "@lensapp/utils": "^0.2.4" }, "devDependencies": { "@async-fn/jest": "1.6.4", diff --git a/src/common/app-paths/app-path-injection-token.ts b/src/common/app-paths/app-path-injection-token.ts deleted file mode 100644 index e29bcdbebf..0000000000 --- a/src/common/app-paths/app-path-injection-token.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { getInjectionToken } from "@ogre-tools/injectable"; -import type { PathName } from "./app-path-names"; - -export type AppPaths = Record; - -export const appPathsInjectionToken = getInjectionToken({ id: "app-paths-token" }); - - diff --git a/src/common/app-paths/app-path-names.ts b/src/common/app-paths/app-path-names.ts deleted file mode 100644 index 211901dd7a..0000000000 --- a/src/common/app-paths/app-path-names.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import type { app as electronApp } from "electron"; - -export type PathName = Parameters[0]; - -export const pathNames: PathName[] = [ - "home", - "appData", - "userData", - "cache", - "temp", - "exe", - "module", - "desktop", - "documents", - "downloads", - "music", - "pictures", - "videos", - "logs", - "crashDumps", - "recent", -]; diff --git a/src/common/app-paths/app-paths-channel.ts b/src/common/app-paths/app-paths-channel.ts index 4502569d3b..af593cccdf 100644 --- a/src/common/app-paths/app-paths-channel.ts +++ b/src/common/app-paths/app-paths-channel.ts @@ -2,7 +2,7 @@ * Copyright (c) OpenLens Authors. All rights reserved. * Licensed under MIT License. See LICENSE in root directory for more information. */ -import type { AppPaths } from "./app-path-injection-token"; +import type { AppPaths } from "@lensapp/app-paths"; import type { RequestChannel } from "../utils/channel/request-channel-listener-injection-token"; export type AppPathsChannel = RequestChannel; diff --git a/src/common/app-paths/app-paths-state.injectable.ts b/src/common/app-paths/app-paths-state.injectable.ts index 5487d428b2..f9afc7a0e2 100644 --- a/src/common/app-paths/app-paths-state.injectable.ts +++ b/src/common/app-paths/app-paths-state.injectable.ts @@ -3,7 +3,7 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import type { AppPaths } from "./app-path-injection-token"; +import type { AppPaths } from "@lensapp/app-paths"; const appPathsStateInjectable = getInjectable({ id: "app-paths-state", diff --git a/src/common/app-paths/app-paths.injectable.ts b/src/common/app-paths/app-paths.injectable.ts index 803f9e1380..ba51aed907 100644 --- a/src/common/app-paths/app-paths.injectable.ts +++ b/src/common/app-paths/app-paths.injectable.ts @@ -3,7 +3,7 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import { appPathsInjectionToken } from "./app-path-injection-token"; +import { appPathsInjectionToken } from "@lensapp/app-paths"; import appPathsStateInjectable from "./app-paths-state.injectable"; const appPathsInjectable = getInjectable({ diff --git a/src/common/app-paths/app-paths.test.ts b/src/common/app-paths/app-paths.test.ts index ff4bd88988..392817f46c 100644 --- a/src/common/app-paths/app-paths.test.ts +++ b/src/common/app-paths/app-paths.test.ts @@ -2,10 +2,9 @@ * Copyright (c) OpenLens Authors. All rights reserved. * Licensed under MIT License. See LICENSE in root directory for more information. */ -import type { AppPaths } from "./app-path-injection-token"; -import { appPathsInjectionToken } from "./app-path-injection-token"; +import type { AppPaths, PathName } from "@lensapp/app-paths"; +import { appPathsInjectionToken } from "@lensapp/app-paths"; import getElectronAppPathInjectable from "../../main/app-paths/get-electron-app-path/get-electron-app-path.injectable"; -import type { PathName } from "./app-path-names"; import setElectronAppPathInjectable from "../../main/app-paths/set-electron-app-path/set-electron-app-path.injectable"; import directoryForIntegrationTestingInjectable from "../../main/app-paths/directory-for-integration-testing/directory-for-integration-testing.injectable"; import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder"; diff --git a/src/common/app-paths/directory-for-downloads/directory-for-downloads.injectable.ts b/src/common/app-paths/directory-for-downloads/directory-for-downloads.injectable.ts index 944c8a656a..67e9090f91 100644 --- a/src/common/app-paths/directory-for-downloads/directory-for-downloads.injectable.ts +++ b/src/common/app-paths/directory-for-downloads/directory-for-downloads.injectable.ts @@ -3,7 +3,7 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import { appPathsInjectionToken } from "../app-path-injection-token"; +import { appPathsInjectionToken } from "@lensapp/app-paths"; const directoryForDownloadsInjectable = getInjectable({ id: "directory-for-downloads", diff --git a/src/common/app-paths/directory-for-exes/directory-for-exes.injectable.ts b/src/common/app-paths/directory-for-exes/directory-for-exes.injectable.ts index 1bd245daa4..8ae7e99767 100644 --- a/src/common/app-paths/directory-for-exes/directory-for-exes.injectable.ts +++ b/src/common/app-paths/directory-for-exes/directory-for-exes.injectable.ts @@ -3,7 +3,7 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import { appPathsInjectionToken } from "../app-path-injection-token"; +import { appPathsInjectionToken } from "@lensapp/app-paths"; const directoryForExesInjectable = getInjectable({ id: "directory-for-exes", diff --git a/src/common/app-paths/directory-for-temp/directory-for-temp.injectable.ts b/src/common/app-paths/directory-for-temp/directory-for-temp.injectable.ts index b51e8e0489..b83a66b086 100644 --- a/src/common/app-paths/directory-for-temp/directory-for-temp.injectable.ts +++ b/src/common/app-paths/directory-for-temp/directory-for-temp.injectable.ts @@ -3,7 +3,7 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import { appPathsInjectionToken } from "../app-path-injection-token"; +import { appPathsInjectionToken } from "@lensapp/app-paths"; const directoryForTempInjectable = getInjectable({ id: "directory-for-temp", diff --git a/src/common/app-paths/directory-for-user-data/directory-for-user-data.injectable.ts b/src/common/app-paths/directory-for-user-data/directory-for-user-data.injectable.ts index bff067b7e5..ed20a19303 100644 --- a/src/common/app-paths/directory-for-user-data/directory-for-user-data.injectable.ts +++ b/src/common/app-paths/directory-for-user-data/directory-for-user-data.injectable.ts @@ -3,7 +3,7 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import { appPathsInjectionToken } from "../app-path-injection-token"; +import { appPathsInjectionToken } from "@lensapp/app-paths"; const directoryForUserDataInjectable = getInjectable({ id: "directory-for-user-data", diff --git a/src/main/app-paths/get-app-paths.ts b/src/main/app-paths/get-app-paths.ts index 00aeff540c..e0ef16e227 100644 --- a/src/main/app-paths/get-app-paths.ts +++ b/src/main/app-paths/get-app-paths.ts @@ -3,9 +3,8 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { fromPairs } from "lodash/fp"; -import type { PathName } from "../../common/app-paths/app-path-names"; -import { pathNames } from "../../common/app-paths/app-path-names"; -import type { AppPaths } from "../../common/app-paths/app-path-injection-token"; +import type { AppPaths, PathName } from "@lensapp/app-paths"; +import { pathNames } from "@lensapp/app-paths"; interface Dependencies { getAppPath: (name: PathName) => string; diff --git a/src/main/app-paths/get-electron-app-path/get-electron-app-path.ts b/src/main/app-paths/get-electron-app-path/get-electron-app-path.ts index f7531b89b1..ab39d8b5b2 100644 --- a/src/main/app-paths/get-electron-app-path/get-electron-app-path.ts +++ b/src/main/app-paths/get-electron-app-path/get-electron-app-path.ts @@ -3,7 +3,7 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import type { App } from "electron"; -import type { PathName } from "../../../common/app-paths/app-path-names"; +import type { PathName } from "@lensapp/app-paths"; interface Dependencies { app: App; diff --git a/src/main/app-paths/set-electron-app-path/set-electron-app-path.injectable.ts b/src/main/app-paths/set-electron-app-path/set-electron-app-path.injectable.ts index 73090956d3..4b5ff58848 100644 --- a/src/main/app-paths/set-electron-app-path/set-electron-app-path.injectable.ts +++ b/src/main/app-paths/set-electron-app-path/set-electron-app-path.injectable.ts @@ -3,7 +3,7 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import type { PathName } from "../../../common/app-paths/app-path-names"; +import type { PathName } from "@lensapp/app-paths"; import electronAppInjectable from "../../electron-app/electron-app.injectable"; const setElectronAppPathInjectable = getInjectable({ diff --git a/src/main/app-paths/setup-app-paths.injectable.ts b/src/main/app-paths/setup-app-paths.injectable.ts index 54bc0ea2ba..072de16a71 100644 --- a/src/main/app-paths/setup-app-paths.injectable.ts +++ b/src/main/app-paths/setup-app-paths.injectable.ts @@ -3,12 +3,12 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import type { AppPaths } from "../../common/app-paths/app-path-injection-token"; +import type { AppPaths } from "@lensapp/app-paths"; import getElectronAppPathInjectable from "./get-electron-app-path/get-electron-app-path.injectable"; import setElectronAppPathInjectable from "./set-electron-app-path/set-electron-app-path.injectable"; import directoryForIntegrationTestingInjectable from "./directory-for-integration-testing/directory-for-integration-testing.injectable"; import appPathsStateInjectable from "../../common/app-paths/app-paths-state.injectable"; -import { pathNames } from "../../common/app-paths/app-path-names"; +import { pathNames } from "@lensapp/app-paths"; import { fromPairs, map } from "lodash/fp"; import { pipeline } from "@ogre-tools/fp"; import joinPathsInjectable from "../../common/path/join-paths.injectable"; diff --git a/yarn.lock b/yarn.lock index 80469fd793..1d55fdec4f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1101,6 +1101,11 @@ resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz#b2ac626d6cb9c8718ab459166d4bb405b8ffa78b" integrity sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A== +"@lensapp/app-paths@^0.1.1": + version "0.1.1" + resolved "http://localhost:53093/@lensapp%2fapp-paths/-/app-paths-0.1.1.tgz#b70237b63ee50c24fede036852b421ecae0c9475" + integrity sha512-4/pK8MgXq1/ltFf9DjmC/PFjiJ9vKPx7d69RAjEApKB0+7SO9T0/Y4Hu8jfGOz8sUFdofjxlkmhMYGFWGuqihA== + "@lensapp/aws-clusters@^0.1.0": version "0.1.0" resolved "http://localhost:53093/@lensapp%2faws-clusters/-/aws-clusters-0.1.0.tgz#4b10554d910f8909d793e15b7c6c605d8dd1ca4e"