🐛(tokens) fix windows generate tokens

The tokens generation was failing on windows because
of the path separator.
This commit fixes this issue.
This commit is contained in:
ALC Consulting
2023-02-17 14:17:33 +01:00
committed by NathanVss
parent 722b66b3ae
commit 479e0777b6
2 changed files with 7 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@openfun/cunningham-tokens": patch
---
fix windows generate tokens

View File

@@ -1,9 +1,10 @@
import fs from "fs"; import fs from "fs";
import pathHelper from "path";
import chalk from "chalk"; import chalk from "chalk";
export const put = (path: string, content: string) => { export const put = (path: string, content: string) => {
console.log("Generating tokens file to " + path + " ..."); console.log("Generating tokens file to " + path + " ...");
const dir = path.substring(0, path.lastIndexOf("/")); const dir = pathHelper.dirname(path);
if (!fs.existsSync(dir)) { if (!fs.existsSync(dir)) {
fs.mkdirSync(dir); fs.mkdirSync(dir);
} }