Skip to content

Commit 9913264

Browse files
committed
Made generate importmap windows compatible
1 parent 6847a84 commit 9913264

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tasks/generate-importmap.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#!/usr/bin/env -S deno run --allow-read --allow-write
22

33
import { expandGlob } from "@std/fs";
4+
import { fromFileUrl } from "@std/path";
45

56
interface DenoConfig {
67
name?: string;
78
exports?: string | Record<string, string>;
89
imports?: Record<string, string>;
910
}
1011

11-
const rootDir = new URL("..", import.meta.url).pathname;
12+
const rootDir = fromFileUrl(new URL("..", import.meta.url));
1213
const imports = new Map<string, string>();
1314
const workspacePackages = new Map<string, string>();
1415

@@ -33,8 +34,12 @@ for await (
3334
}
3435

3536
// Get package directory relative to root
36-
const packageDir = file.path.replace(rootDir, "").replace("/deno.json", "");
37-
const fullExportPath = `./${packageDir}/${exportPath.replace("./", "")}`;
37+
const packageDir = file.path.replace(rootDir, "").replace(
38+
/[\/\\]deno\.json$/,
39+
"",
40+
);
41+
const fullExportPath = `./${packageDir}/${exportPath.replace("./", "")}`
42+
.replace(/\\/g, "/");
3843

3944
workspacePackages.set(config.name, fullExportPath);
4045
}

0 commit comments

Comments
 (0)