Compare commits
No commits in common. "8b70f735fc5dc1f3914b0a284b1366c503a59278" and "b10c13285736257d5896d59afcbba507969eaeb8" have entirely different histories.
8b70f735fc
...
b10c132857
12 changed files with 26 additions and 178 deletions
|
@ -1,2 +1,2 @@
|
||||||
[tools]
|
[tools]
|
||||||
bun = "1.2.22"
|
bun = "latest"
|
||||||
|
|
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
14
dist/palette.toml
vendored
14
dist/palette.toml
vendored
|
@ -1,12 +1,12 @@
|
||||||
name = "verdigris"
|
name = verdigris
|
||||||
version = "0.0.1"
|
version = 0.0.1
|
||||||
license = "GPL-3.0-only"
|
license = GPL-3.0-only
|
||||||
sourcecode = "https://git.basking.monster/gaiety/verdigris"
|
sourcecode = https://git.basking.monster/gaiety/verdigris
|
||||||
|
|
||||||
[author]
|
[author]
|
||||||
name = "Gaiety"
|
name = Gaiety
|
||||||
email = "ava+verdigris@gaiety.me"
|
email = ava+verdigris@gaiety.me
|
||||||
url = "https://gaiety.me"
|
url = https://gaiety.me
|
||||||
|
|
||||||
[colors]
|
[colors]
|
||||||
|
|
||||||
|
|
22
dist/palette.yml
vendored
22
dist/palette.yml
vendored
|
@ -1,22 +0,0 @@
|
||||||
name: "verdigris"
|
|
||||||
version: "0.0.1"
|
|
||||||
license: "GPL-3.0-only"
|
|
||||||
sourcecode: "https://git.basking.monster/gaiety/verdigris"
|
|
||||||
|
|
||||||
author:
|
|
||||||
name: "Gaiety"
|
|
||||||
email: "ava+verdigris@gaiety.me"
|
|
||||||
url: "https://gaiety.me"
|
|
||||||
|
|
||||||
common:
|
|
||||||
pit: "#00040B"
|
|
||||||
depths: "#19323B"
|
|
||||||
stope: "#4E6872"
|
|
||||||
text: "#C6E4F0"
|
|
||||||
orange: "#FF9F6F"
|
|
||||||
teal: "#23DBC1"
|
|
||||||
red: "#E8ADA9"
|
|
||||||
yellow: "#E1B392"
|
|
||||||
green: "#98CCAC"
|
|
||||||
blue: "#8CC8E0"
|
|
||||||
purple: "#BEB6E8"
|
|
2
index.ts
2
index.ts
|
@ -4,7 +4,6 @@ import { timerToSeconds } from './src/helpers/math';
|
||||||
import previewList from './src/preview/cli-list'
|
import previewList from './src/preview/cli-list'
|
||||||
import previewSnippet from './src/preview/cli-snippet'
|
import previewSnippet from './src/preview/cli-snippet'
|
||||||
import buildTOML from './src/build/toml'
|
import buildTOML from './src/build/toml'
|
||||||
import buildYAML from './src/build/yaml'
|
|
||||||
import buildKitty from './ports/kitty/src/build'
|
import buildKitty from './ports/kitty/src/build'
|
||||||
|
|
||||||
const program = new Command();
|
const program = new Command();
|
||||||
|
@ -42,7 +41,6 @@ program
|
||||||
|
|
||||||
if (options.verbose) console.info('Building Direct Exports...')
|
if (options.verbose) console.info('Building Direct Exports...')
|
||||||
log(options.verbose, await buildTOML(), timer)
|
log(options.verbose, await buildTOML(), timer)
|
||||||
log(options.verbose, await buildYAML(), timer)
|
|
||||||
|
|
||||||
if (options.verbose) console.info('Building Ports...')
|
if (options.verbose) console.info('Building Ports...')
|
||||||
log(options.verbose, await buildKitty(), timer)
|
log(options.verbose, await buildKitty(), timer)
|
||||||
|
|
|
@ -15,8 +15,7 @@
|
||||||
"app-root-path": "^3.1.0",
|
"app-root-path": "^3.1.0",
|
||||||
"chalk": "^5.6.2",
|
"chalk": "^5.6.2",
|
||||||
"color-convert": "^3.1.2",
|
"color-convert": "^3.1.2",
|
||||||
"commander": "^14.0.1",
|
"commander": "^14.0.1"
|
||||||
"estilo": "^2.1.3",
|
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": "^5.0.0"
|
"typescript": "^5.0.0"
|
||||||
|
|
|
@ -3,18 +3,13 @@ import appRoot from 'app-root-path'
|
||||||
import { rmFile, mkFilePath, appendToFile } from "../helpers/file"
|
import { rmFile, mkFilePath, appendToFile } from "../helpers/file"
|
||||||
import colors from '../palette'
|
import colors from '../palette'
|
||||||
import type color from '../helpers/color'
|
import type color from '../helpers/color'
|
||||||
import { toSnakeCase } from '../helpers/string'
|
|
||||||
|
|
||||||
const file = appRoot + '/dist/palette.toml'
|
const file = appRoot + '/dist/palette.toml'
|
||||||
const appendToTOML = async (content: string) => await appendToFile(file, content)
|
const appendToTOML = async (content: string) => await appendToFile(file, content)
|
||||||
|
|
||||||
export default async function(isVerbose = false): Promise<string> {
|
export default async function(isVerbose = false): Promise<string> {
|
||||||
if (isVerbose) console.info('Removing previous build', file)
|
if (isVerbose) console.info('Removing previous build', file)
|
||||||
try {
|
await rmFile(file)
|
||||||
await rmFile(file)
|
|
||||||
} catch (error) {
|
|
||||||
console.info('TOML: Previous build already removed')
|
|
||||||
}
|
|
||||||
if (isVerbose) console.info('Ensuring path and file exist', file)
|
if (isVerbose) console.info('Ensuring path and file exist', file)
|
||||||
await mkFilePath(file)
|
await mkFilePath(file)
|
||||||
if (isVerbose) console.info('Writing header info to file', file)
|
if (isVerbose) console.info('Writing header info to file', file)
|
||||||
|
@ -33,10 +28,10 @@ export default async function(isVerbose = false): Promise<string> {
|
||||||
}
|
}
|
||||||
|
|
||||||
function headerTOML(): string {
|
function headerTOML(): string {
|
||||||
return `name = "${name}"
|
return `name = ${name}
|
||||||
version = "${version}"
|
version = ${version}
|
||||||
license = "${license}"
|
license = ${license}
|
||||||
sourcecode = "${url}"
|
sourcecode = ${url}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,12 +40,11 @@ function authorTOML(): string {
|
||||||
|
|
||||||
return `
|
return `
|
||||||
[author]
|
[author]
|
||||||
name = "${name}"
|
name = ${name}
|
||||||
email = "${email}"
|
email = ${email}
|
||||||
url = "${url}"
|
url = ${url}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
function colorHeaderTOML(): string {
|
function colorHeaderTOML(): string {
|
||||||
return `
|
return `
|
||||||
[colors]
|
[colors]
|
||||||
|
@ -60,7 +54,7 @@ function colorHeaderTOML(): string {
|
||||||
function colorTOML(color: color): string {
|
function colorTOML(color: color): string {
|
||||||
const { name, l, c, h } = color
|
const { name, l, c, h } = color
|
||||||
return `
|
return `
|
||||||
[colors.${toSnakeCase(name)}]
|
[colors.${name.replaceAll(' ', '_').toLowerCase()}]
|
||||||
name = "${name}"
|
name = "${name}"
|
||||||
l = ${l}
|
l = ${l}
|
||||||
c = ${c}
|
c = ${c}
|
||||||
|
@ -68,3 +62,11 @@ h = ${h}
|
||||||
hex = "${color.toHex()}"
|
hex = "${color.toHex()}"
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// [colors]
|
||||||
|
//
|
||||||
|
// [colors.bg]
|
||||||
|
// l = 0.2
|
||||||
|
// c = 0.02
|
||||||
|
// h =
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
import { name, version, license, url, author } from '../../package.json'
|
|
||||||
import appRoot from 'app-root-path'
|
|
||||||
import { rmFile, mkFilePath, appendToFile } from "../helpers/file"
|
|
||||||
import { toSnakeCase } from '../helpers/string'
|
|
||||||
import colors from '../palette'
|
|
||||||
import type color from '../helpers/color'
|
|
||||||
|
|
||||||
const file = appRoot + '/dist/palette.yml'
|
|
||||||
const appendToYAML = async (content: string) => await appendToFile(file, content)
|
|
||||||
|
|
||||||
export default async function(isVerbose = false): Promise<string> {
|
|
||||||
if (isVerbose) console.info('Removing previous build', file)
|
|
||||||
try {
|
|
||||||
await rmFile(file)
|
|
||||||
} catch (error) {
|
|
||||||
console.info('YAML: Previous build already removed')
|
|
||||||
}
|
|
||||||
if (isVerbose) console.info('Ensuring path and file exist', file)
|
|
||||||
await mkFilePath(file)
|
|
||||||
if (isVerbose) console.info('Writing header info to file', file)
|
|
||||||
await appendToYAML(headerYAML())
|
|
||||||
if (isVerbose) console.info('Writing author info to file', file)
|
|
||||||
await appendToYAML(authorYAML())
|
|
||||||
if (isVerbose) console.info('Writing color palette to file', file)
|
|
||||||
await appendToYAML(colorHeaderYAML())
|
|
||||||
for (let index = 0; index < colors.length; index++) {
|
|
||||||
const color = colors[index]
|
|
||||||
if (isVerbose) console.info(`${color.name}…`, file)
|
|
||||||
await appendToYAML(colorYAML(color))
|
|
||||||
}
|
|
||||||
|
|
||||||
return file
|
|
||||||
}
|
|
||||||
|
|
||||||
function headerYAML(): string {
|
|
||||||
return `name: "${name}"
|
|
||||||
version: "${version}"
|
|
||||||
license: "${license}"
|
|
||||||
sourcecode: "${url}"
|
|
||||||
`
|
|
||||||
}
|
|
||||||
|
|
||||||
function authorYAML(): string {
|
|
||||||
const { name, email, url } = author
|
|
||||||
|
|
||||||
return `
|
|
||||||
author:
|
|
||||||
name: "${name}"
|
|
||||||
email: "${email}"
|
|
||||||
url: "${url}"
|
|
||||||
`
|
|
||||||
}
|
|
||||||
|
|
||||||
function colorHeaderYAML(): string {
|
|
||||||
return `
|
|
||||||
common:`
|
|
||||||
}
|
|
||||||
|
|
||||||
function colorYAML(color: color): string {
|
|
||||||
return `
|
|
||||||
${toSnakeCase(color.name)}: "${color.toHex()}"`
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
export function toSnakeCase(str: string): string {
|
|
||||||
return str.replaceAll(' ', '_').toLowerCase()
|
|
||||||
}
|
|
30
tests/dist/toml.test.ts
vendored
30
tests/dist/toml.test.ts
vendored
|
@ -1,30 +0,0 @@
|
||||||
import { name, version, license, url, author } from '../../package.json'
|
|
||||||
import { expect, test } from 'bun:test'
|
|
||||||
import data from '../../dist/palette.toml'
|
|
||||||
import colors from '../../src/palette'
|
|
||||||
import { toSnakeCase } from '../../src/helpers/string'
|
|
||||||
|
|
||||||
test('has header info', () => {
|
|
||||||
expect(data.name).toBe(name)
|
|
||||||
expect(data.version).toBe(version)
|
|
||||||
expect(data.license).toBe(license)
|
|
||||||
expect(data.sourcecode).toBe(url)
|
|
||||||
|
|
||||||
expect(data.author.name).toBe(author.name)
|
|
||||||
expect(data.author.email).toBe(author.email)
|
|
||||||
expect(data.author.url).toBe(author.url)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('has expected colors', () => {
|
|
||||||
colors.forEach(color => {
|
|
||||||
const { name, l, c, h } = color
|
|
||||||
const dataColor = data.colors[toSnakeCase(name)]
|
|
||||||
|
|
||||||
expect(dataColor.name).toBe(name)
|
|
||||||
expect(dataColor.l).toBe(l)
|
|
||||||
expect(dataColor.c).toBe(c)
|
|
||||||
expect(dataColor.h).toBe(h)
|
|
||||||
expect(dataColor.hex).toBe(color.toHex())
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
25
tests/dist/yaml.test.ts
vendored
25
tests/dist/yaml.test.ts
vendored
|
@ -1,25 +0,0 @@
|
||||||
import { name, version, license, url, author } from '../../package.json'
|
|
||||||
import { expect, test } from 'bun:test'
|
|
||||||
import colors from '../../src/palette'
|
|
||||||
import { toSnakeCase } from '../../src/helpers/string'
|
|
||||||
import data from '../../dist/palette.yml'
|
|
||||||
|
|
||||||
test('has header info', () => {
|
|
||||||
expect(data.name).toBe(name)
|
|
||||||
expect(data.version).toBe(version)
|
|
||||||
expect(data.license).toBe(license)
|
|
||||||
expect(data.sourcecode).toBe(url)
|
|
||||||
|
|
||||||
expect(data.author.name).toBe(author.name)
|
|
||||||
expect(data.author.email).toBe(author.email)
|
|
||||||
expect(data.author.url).toBe(author.url)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('has expected colors', () => {
|
|
||||||
colors.forEach(color => {
|
|
||||||
const dataColor = data.common[toSnakeCase(color.name)]
|
|
||||||
|
|
||||||
expect(dataColor).toBe(color.toHex())
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
import { expect, test } from 'bun:test'
|
|
||||||
import { toSnakeCase } from '../../src/helpers/string'
|
|
||||||
|
|
||||||
test('can convert a string to snake case', () => {
|
|
||||||
expect(
|
|
||||||
toSnakeCase('Very Cool Beans')
|
|
||||||
).toBe('very_cool_beans')
|
|
||||||
})
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue