Files
cunningham/packages/tokens/src/bin/Utils/Files.ts
Nathan Vasse 2876d29025 (tokens) add JS generator and re-organize the repo
Added JsGenerator which to implied to reorganize a bit the
repo in order to extract generator-specific test into specific
standalone files.
2023-01-11 11:01:56 +01:00

15 lines
412 B
TypeScript

import fs from "fs";
import chalk from "chalk";
export const put = (path: string, content: string) => {
console.log("Generating tokens file to " + path + " ...");
const dir = path.substring(0, path.lastIndexOf("/"));
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
fs.writeFileSync(path, content);
console.log(
chalk.bgGreen(chalk.white("File " + path + " generated successfully."))
);
};