import { name, version, license, url, author } from '../../package.json' import appRoot from 'app-root-path' import colors from '../palette' import Color from '../helpers/color' import { renderToFile } from '../helpers/file' const templateFile = appRoot + '/src/build/templates/yaml.hbs' const outputFile = appRoot + '/dist/palette.yml' export default async function(isVerbose = false): Promise { try { await renderToFile(templateFile, outputFile, getData(), isVerbose) return outputFile } catch (error) { throw error } } function getData(): any { return { name, version, license, url, author, colors: colors.map(getDataColors) } } function getDataColors(color: Color): any { const { nameSnakeCase } = color return { nameSnakeCase, hex: color.toHex() } }