Unify build fs layout (#6717)

* unify build fs layout

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* use currentApp path for static files

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* lint fix

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* absolute override path for tests

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen authored and GitHub committed 2022-12-12 11:23:45 -05:00
1 parent fe0c13424a
commit 4ac47fa795
14 files changed
+46 -45

No files matched your search

+2 -1
View File
@@ -4,9 +4,10 @@
*/
import type { app as electronApp } from "electron";
export type PathName = Parameters<typeof electronApp["getPath"]>[0];
export type PathName = Parameters<typeof electronApp["getPath"]>[0] | "currentApp";
export const pathNames: PathName[] = [
"currentApp",
"home",
"appData",
"userData",
+3
View File
@@ -19,6 +19,7 @@ describe("app-paths", () => {
builder = getApplicationBuilder();
const defaultAppPathsStub: AppPaths = {
currentApp: "some-current-app",
appData: "some-app-data",
cache: "some-cache",
crashDumps: "some-crash-dumps",
@@ -70,6 +71,7 @@ describe("app-paths", () => {
const actual = windowDi.inject(appPathsInjectionToken);
expect(actual).toEqual({
currentApp: "some-current-app",
appData: "some-app-data",
cache: "some-cache",
crashDumps: "some-crash-dumps",
@@ -93,6 +95,7 @@ describe("app-paths", () => {
const actual = mainDi.inject(appPathsInjectionToken);
expect(actual).toEqual({
currentApp: "some-current-app",
appData: "some-app-data",
cache: "some-cache",
crashDumps: "some-crash-dumps",
@@ -0,0 +1,9 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getGlobalOverride } from "../test-utils/get-global-override";
import staticFilesDirectoryInjectable from "./static-files-directory.injectable";
export default getGlobalOverride(staticFilesDirectoryInjectable, () => "/some-static-directory");
@@ -3,17 +3,17 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import appPathsInjectable from "../app-paths/app-paths.injectable";
import joinPathsInjectable from "../path/join-paths.injectable";
import lensResourcesDirInjectable from "./lens-resources-dir.injectable";
const staticFilesDirectoryInjectable = getInjectable({
id: "static-files-directory",
instantiate: (di) => {
const joinPaths = di.inject(joinPathsInjectable);
const lensResourcesDir = di.inject(lensResourcesDirInjectable);
const currentAppDir = di.inject(appPathsInjectable).currentApp;
return joinPaths(lensResourcesDir, "static");
return joinPaths(currentAppDir, "static");
},
});