Skip to content

Commit

Permalink
refactor: rename a type
Browse files Browse the repository at this point in the history
  • Loading branch information
KSXGitHub committed May 7, 2024
1 parent 0f64507 commit 6385291
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions hooks/read-package-hook/src/createVersionsOverrider.ts
Expand Up @@ -45,14 +45,14 @@ function tryParseOverrides (overrides: Record<string, string>): VersionOverrideB
}
}

interface Target {
interface LocalTarget {
absolutePath: string
wasRelative: boolean
}

type LocalPrefix = 'link:' | 'file:'

function createLocalTarget (override: VersionOverrideBase, prefix: LocalPrefix, rootDir: string): Target | undefined {
function createLocalTarget (override: VersionOverrideBase, prefix: LocalPrefix, rootDir: string): LocalTarget | undefined {
if (!override.newPref.startsWith(prefix)) return undefined
const pkgPath = override.newPref.substring(prefix.length)
const wasRelative = !path.isAbsolute(pkgPath)
Expand All @@ -61,8 +61,8 @@ function createLocalTarget (override: VersionOverrideBase, prefix: LocalPrefix,
}

interface VersionOverride extends VersionOverrideBase {
linkTarget?: Target
linkFileTarget?: Target
linkTarget?: LocalTarget
linkFileTarget?: LocalTarget
}

interface VersionOverrideWithParent extends VersionOverride {
Expand Down Expand Up @@ -117,7 +117,7 @@ function overrideDeps (
}
}

function resolveLocalOverride ({ wasRelative, absolutePath }: Target, pkgDir?: string): string {
function resolveLocalOverride ({ wasRelative, absolutePath }: LocalTarget, pkgDir?: string): string {
return wasRelative && pkgDir
? normalizePath(path.relative(pkgDir, absolutePath))
: absolutePath
Expand Down

0 comments on commit 6385291

Please sign in to comment.