From 1c7071a8d6167ddf86a0dae48895dcac2073aa7d Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Tue, 22 Oct 2024 10:45:12 -0700 Subject: [PATCH] Adjust resolution of package root directory --- packages/core/globals.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/packages/core/globals.ts b/packages/core/globals.ts index 2b67f3b..098f36a 100644 --- a/packages/core/globals.ts +++ b/packages/core/globals.ts @@ -1,7 +1,6 @@ // Built-In Modules import { join, resolve } from "node:path"; import { dirname } from 'node:path'; -import { fileURLToPath } from 'node:url'; import { existsSync, readFileSync, rmSync } from "node:fs"; import { createRequire } from 'node:module'; @@ -108,13 +107,7 @@ export const ensureTargetConsistent = async (target: TargetType, allow = []) => } // Get Configuration File and Path -const knownPath = join('packages', 'core', 'dist') - -const __dirname = resolve(dirname(fileURLToPath(import.meta.url))) - -// Swap resolved root directories when the library is imported (e.g. from the distributed cli) -const inKnownPath = __dirname.slice(-knownPath.length) === knownPath -export const rootDir = inKnownPath ? __dirname : dirname(require.resolve('@commoners/solidarity')) +export const rootDir = dirname(require.resolve(__filename)) export const templateDir = join(rootDir, 'assets') export const getBuildConfig = (): WritableElectronBuilderConfig => yaml.load(readFileSync(join(templateDir, 'electron', 'electron-builder.yml')).toString())