(bin) add tokens repo

This repo is made for the bin script that generates the tokens files,
at the moment it only generates a css file, but it is designed to be
able to generate any other file format ( Typescript, Javascript for example )
This commit is contained in:
Nathan Vasse
2022-12-01 12:03:37 +01:00
committed by NathanVss
parent 16172e7a00
commit 32a48e9e46
18 changed files with 440 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
import { program } from "commander";
import chalk from "chalk";
import figlet from "figlet";
import { getConfig } from "./ConfigLoader";
import { tokensGenerator } from "./TokensGenerator";
import { cssGenerator } from "./CssGenerator";
import { workPath } from "./Paths";
export const buildTheme = async () => {
const options = program.opts();
const config = await getConfig();
const tokens = tokensGenerator(config);
await cssGenerator(tokens, {
path: options.output,
selector: options.selector,
});
};
export const run = async (args: string[]) => {
console.log(
chalk.red(figlet.textSync("Cunningham", { horizontalLayout: "full" }))
);
program
.description("Cunningham's CLI tool.")
.option(
"-o, --output <directory>",
"Specify the output dir of generated files.",
workPath()
)
.option(
"-s, --selector <selector>",
"Specify the css root selector element.",
":root"
)
.parse(args);
await buildTheme();
};