Skip to content

Commit 2276f45

Browse files
committed
#47: Fix gitignore edition Vite windows
1 parent a452690 commit 2276f45

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/bin/copy-dsfr-to-public.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
#!/usr/bin/env node
22
/* eslint-disable @typescript-eslint/no-unused-vars */
33

4-
import { join as pathJoin, relative as pathRelative } from "path";
4+
import {
5+
join as pathJoin,
6+
relative as pathRelative,
7+
sep as pathSep,
8+
posix as pathPosix
9+
} from "path";
510
import * as fs from "fs";
611
import { getProjectRoot } from "./tools/getProjectRoot";
712
import { assert } from "tsafe/assert";
@@ -93,7 +98,13 @@ import type { Equals } from "tsafe";
9398

9499
const gitignoreRaw = fs.readFileSync(gitignoreFilePath).toString("utf8");
95100

96-
const pathToIgnore = `/${pathJoin(pathRelative(projectDirPath, publicDirPath), "dsfr")}/`;
101+
const pathToIgnore = `/${pathJoin(
102+
pathRelative(projectDirPath, publicDirPath).replace(
103+
new RegExp(`\\${pathSep}`, "g"),
104+
pathPosix.sep
105+
),
106+
"dsfr"
107+
)}/`;
97108

98109
if (gitignoreRaw.split("\n").find(line => line.startsWith(pathToIgnore)) !== undefined) {
99110
break edit_gitignore;

0 commit comments

Comments
 (0)