fix: path handling inconsistencies (#2482)

This commit is contained in:
Marvin Hagemeister
2024-06-03 15:03:48 +02:00
committed by GitHub
parent 9347b84cba
commit 2fb8606e9e
7 changed files with 49 additions and 17 deletions
+6 -2
View File
@@ -39,9 +39,11 @@ export interface ResolvedFreshConfig {
mode: Mode;
}
export function parseRootPath(root: string): string {
export function parseRootPath(root: string, cwd: string): string {
if (root.startsWith("file://")) {
root = path.fromFileUrl(root);
} else if (!path.isAbsolute(root)) {
root = path.join(cwd, root);
}
const ext = path.extname(root);
@@ -56,7 +58,9 @@ export function parseRootPath(root: string): string {
}
export function normalizeConfig(options: FreshConfig): ResolvedFreshConfig {
const root = options.root ? parseRootPath(options.root) : Deno.cwd();
const root = options.root
? parseRootPath(options.root, Deno.cwd())
: Deno.cwd();
return {
root,