31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
import appRoot from 'app-root-path'
|
|
import { rmFile, mkFilePath, appendToFile } from "../../../src/helpers/file"
|
|
import { headerInfo, colorsBasic, colorsURLs, colorsCursor, colorsMarks, colorsTabBar, colorsBordersAndAlerts, colorsBasic16 } from './data'
|
|
|
|
const file = appRoot + '/ports/kitty/dist/kitty.conf'
|
|
|
|
const appendToKittyConf = async (content: string) => await appendToFile(file, content)
|
|
|
|
export default async function(isVerbose = false): Promise<string> {
|
|
if (isVerbose) console.info('Kitty: Removing previous build', file)
|
|
try {
|
|
await rmFile(file)
|
|
} catch (error) {
|
|
console.info('Kitty: Previous build already removed')
|
|
}
|
|
if (isVerbose) console.info('Kitty: Ensuring path and file exist', file)
|
|
await mkFilePath(file)
|
|
if (isVerbose) console.info('Kitty: Writing header info to file', file)
|
|
await appendToKittyConf(headerInfo())
|
|
if (isVerbose) console.info('Kitty: Writing color palette into file', file)
|
|
await appendToKittyConf(colorsBasic())
|
|
await appendToKittyConf(colorsCursor())
|
|
await appendToKittyConf(colorsURLs())
|
|
await appendToKittyConf(colorsMarks())
|
|
await appendToKittyConf(colorsTabBar())
|
|
await appendToKittyConf(colorsBordersAndAlerts())
|
|
await appendToKittyConf(colorsBasic16())
|
|
|
|
return file
|
|
}
|
|
|