Skip to content

Commit d2dcb34

Browse files
committed
Stom needlessly using aync
1 parent a5d8519 commit d2dcb34

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

src/bin/copy_dsfr_dist_to_root.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ fs.cpSync(pathJoin(projectRootDirPath, "node_modules", "@gouvfr", "dsfr", "dist"
1818
"recursive": true
1919
});
2020

21-
(async () => {
22-
fs.writeFileSync(
23-
pathJoin(dsfrDirPath, pathOfPatchedRawCssCodeForCompatWithRemixIconRelativeToDsfrDist),
24-
Buffer.from(
25-
await getPatchedRawCssCodeForCompatWithRemixIcon({
26-
"rawCssCode": fs.readFileSync(pathJoin(dsfrDirPath, "dsfr.css")).toString("utf8")
27-
}),
28-
"utf8"
29-
)
30-
);
31-
})();
21+
fs.writeFileSync(
22+
pathJoin(dsfrDirPath, pathOfPatchedRawCssCodeForCompatWithRemixIconRelativeToDsfrDist),
23+
Buffer.from(
24+
getPatchedRawCssCodeForCompatWithRemixIcon({
25+
"rawCssCode": fs.readFileSync(pathJoin(dsfrDirPath, "dsfr.css")).toString("utf8")
26+
}),
27+
"utf8"
28+
)
29+
);

src/bin/css_to_ts/icons.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Icon } from "./css_to_ts";
22
import { exclude } from "tsafe/exclude";
33
import { join as pathJoin, sep } from "path";
4+
import * as css from "css";
45

56
type IconLike = Icon.Dsfr | Omit<Icon.Remixicon, "rawSvgCode">;
67

@@ -62,11 +63,9 @@ export const pathOfPatchedRawCssCodeForCompatWithRemixIconRelativeToDsfrDist = p
6263
"dsfr_remixicon.css"
6364
);
6465

65-
export async function getPatchedRawCssCodeForCompatWithRemixIcon(params: { rawCssCode: string }) {
66+
export function getPatchedRawCssCodeForCompatWithRemixIcon(params: { rawCssCode: string }) {
6667
const { rawCssCode } = params;
6768

68-
const css = await import("css");
69-
7069
const parsedCss = css.parse(rawCssCode);
7170

7271
const prefixRegExp = /fr-icon-[^-]/;

test/integration/next/pages/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default function App() {
1515
<span className="fr-icon-ancient-gate-fill" aria-hidden="true"></span>
1616
<i className="fr-icon-ancient-gate-fill" aria-hidden="true"/>
1717

18-
<button className={fr.cx("fr-btn", "ri-amazon-fill", "fr-btn--icon-left")}>
18+
<button className={fr.cx("fr-btn", "ri-arrow-left-s-fill", "fr-btn--icon-left")}>
1919
Download
2020
</button>
2121

test/runtime/bin/icons/getPatchedRawCssCodeForCompatWithRemixIcon.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { it, expect } from "vitest";
22
import { getPatchedRawCssCodeForCompatWithRemixIcon } from "../../../../src/bin/css_to_ts/icons";
33

4-
it("Successfully generates patched css for remixicon support", async () => {
4+
it("Successfully generates patched css for remixicon support", () => {
55
const rawCssCode = `
66
[target=_blank]::after {
77
flex: 0 0 auto;
@@ -142,7 +142,7 @@ it("Successfully generates patched css for remixicon support", async () => {
142142
}
143143
}`.replace(/^\n/, "");
144144

145-
const got = await getPatchedRawCssCodeForCompatWithRemixIcon({ rawCssCode });
145+
const got = getPatchedRawCssCodeForCompatWithRemixIcon({ rawCssCode });
146146

147147
expect(got).toEqual(expected);
148148
});

0 commit comments

Comments
 (0)