From cf765d2269d8a4391355b7f6a6dffe580c69e1c2 Mon Sep 17 00:00:00 2001 From: uncenter <47499684+uncenter@users.noreply.github.com> Date: Fri, 13 Sep 2024 10:41:55 -0400 Subject: [PATCH] feat(palettes): prefix filenames with "Catppuccin" (#92) --- scripts/build_palettes.ts | 89 ++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/scripts/build_palettes.ts b/scripts/build_palettes.ts index c59875a..57a54b8 100644 --- a/scripts/build_palettes.ts +++ b/scripts/build_palettes.ts @@ -21,53 +21,56 @@ await Promise.all( ); Promise.all( - Object.entries(flavors).flatMap(async ([identifier, { name, colors }]) => { - const fname = identifier.charAt(0).toUpperCase() + identifier.slice(1); + Object.entries(flavors).flatMap( + async ([identifier, { name: nameWithAccent, colors }]) => { + const nameWithoutAccent = identifier.charAt(0).toUpperCase() + + identifier.slice(1); - await Deno.writeFile( - join(ROOT, `ase/${fname}.ase`), - generateAse(fname, colors), - ); - await Deno.writeFile( - join(ROOT, `png/${fname}.png`), - generatePng(fname, colors), - ); - await Deno.writeFile( - join(ROOT, `procreate/${fname}.swatches`), - await generateProcreate(fname, colors), - ); - await Deno.writeTextFile( - join(ROOT, `gimp/${fname}.gpl`), - generateGimp(fname, colors), - ); - await Deno.writeTextFile( - join(ROOT, `sip/${fname}.palette`), - generateSip(fname, colors), - ); - - if (Deno.env.get("COMPILE_APPLE_COLOR_LIST") === "1") { - const clrJson = join(ROOT, `clr/${fname}.json`); + await Deno.writeFile( + join(ROOT, `ase/Catppuccin ${nameWithoutAccent}.ase`), + generateAse(nameWithoutAccent, colors), + ); + await Deno.writeFile( + join(ROOT, `png/Catppuccin ${nameWithoutAccent}.png`), + generatePng(nameWithoutAccent, colors), + ); + await Deno.writeFile( + join(ROOT, `procreate/Catppuccin ${nameWithoutAccent}.swatches`), + await generateProcreate(nameWithoutAccent, colors), + ); await Deno.writeTextFile( - clrJson, - generateClrJson(fname, colors), + join(ROOT, `gimp/Catppuccin ${nameWithoutAccent}.gpl`), + generateGimp(nameWithoutAccent, colors), + ); + await Deno.writeTextFile( + join(ROOT, `sip/Catppuccin ${nameWithoutAccent}.palette`), + generateSip(nameWithoutAccent, colors), ); - const cmd = new Deno.Command("swift", { - args: [ - join(import.meta.dirname!, "./builders/palettes/json-to-clr.swift"), + if (Deno.env.get("COMPILE_APPLE_COLOR_LIST") === "1") { + const clrJson = join(ROOT, `clr/${nameWithoutAccent}.json`); + await Deno.writeTextFile( clrJson, - join(ROOT, `clr/${name}.clr`), - ], - }); - const { code, stderr, stdout } = await cmd.output(); - const td = new TextDecoder(); - if (code === 0) { - console.log(td.decode(stdout).trim()); - } else { - throw new Error(td.decode(stderr)); - } + generateClrJson(nameWithoutAccent, colors), + ); - await Deno.remove(clrJson); - } - }), + const cmd = new Deno.Command("swift", { + args: [ + join(import.meta.dirname!, "./builders/palettes/json-to-clr.swift"), + clrJson, + join(ROOT, `clr/Catppuccin ${nameWithAccent}.clr`), + ], + }); + const { code, stderr, stdout } = await cmd.output(); + const td = new TextDecoder(); + if (code === 0) { + console.log(td.decode(stdout).trim()); + } else { + throw new Error(td.decode(stderr)); + } + + await Deno.remove(clrJson); + } + }, + ), ).then(() => Deno.exit(0));