Skip to content

Commit

Permalink
Adjust resolution of package root directory
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettmflynn committed Oct 22, 2024
1 parent 0a298a7 commit 1c7071a
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions packages/core/globals.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 1c7071a

Please sign in to comment.