Skip to content

Commit 8a88f66

Browse files
committed
Remove redondent file read
1 parent aba723c commit 8a88f66

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/scripts/build.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ import { assert } from "tsafe/assert";
2929

3030
const nodeModuleDirPath = pathJoin(projectRootDirPath, "node_modules");
3131

32-
const gouvFrDsfrDistDirPath = pathJoin(nodeModuleDirPath, "@gouvfr", "dsfr", "dist");
33-
34-
fs.cpSync(gouvFrDsfrDistDirPath, dsfrDirPath, {
32+
fs.cpSync(pathJoin(nodeModuleDirPath, "@gouvfr", "dsfr", "dist"), dsfrDirPath, {
3533
"recursive": true
3634
});
3735

36+
const rawDsfrCssCode = fs.readFileSync(pathJoin(dsfrDirPath, "dsfr.css")).toString("utf8");
37+
3838
fs.writeFileSync(
3939
pathJoin(dsfrDirPath, pathOfPatchedRawCssCodeForCompatWithRemixIconRelativeToDsfrDist),
4040
Buffer.from(
4141
getPatchedRawCssCodeForCompatWithRemixIcon({
42-
"rawCssCode": fs.readFileSync(pathJoin(dsfrDirPath, "dsfr.css")).toString("utf8")
42+
"rawCssCode": rawDsfrCssCode
4343
}),
4444
"utf8"
4545
)
@@ -66,9 +66,7 @@ import { assert } from "tsafe/assert";
6666
cssToTs({
6767
icons,
6868
"generatedDirPath": pathJoin(projectRootDirPath, "src", "lib", "generatedFromCss"),
69-
"rawDsfrCssCode": fs
70-
.readFileSync(pathJoin(gouvFrDsfrDistDirPath, "dsfr.css"))
71-
.toString("utf8")
69+
rawDsfrCssCode
7270
});
7371

7472
await tsc({

0 commit comments

Comments
 (0)