Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions packages/nuekit/src/cli.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env bun

import { styleText } from 'node:util'
import { version } from './system'

// [-npe] --> [-n, -p, -e]
Expand Down Expand Up @@ -118,18 +119,11 @@ Examples
`


const colors = {
boldwhite: str => `\x1b[1;37m${str}\x1b[0m`,
gray: str => `\x1b[90m${str}\x1b[0m`,
green: str => `\x1b[32m${str}\x1b[0m`,
cyan: str => `\x1b[36m${str}\x1b[0m`,
}

function format(line) {
return line.match(/^\w[\w ]+$/) ? colors.boldwhite(line) // titles
: '┏┃┗'.includes(line.trim()[0]) ? colors.green(line) // ascii art
: line.includes('#') ? colors.cyan(line) // comments
: colors.gray(line)
return line.match(/^\w[\w ]+$/) ? styleText(['bold', 'white'],line) // titles
: '┏┃┗'.includes(line.trim()[0]) ? styleText(['green'], line) // ascii art
: line.includes('#') ? styleText(['cyan'], line) // comments
: styleText(['gray'], line)
}

export function printHelp() {
Expand Down
8 changes: 2 additions & 6 deletions packages/nuekit/src/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@ import { mkdir, rm } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
import { join } from 'node:path'

import { version as pkgVersion } from '../package.json' with { type: 'json' }
import { compileJS } from './asset'

async function getVersion() {
const file = Bun.file(join(import.meta.dir, '../package.json'))
return (await file.json()).version
}

export const version = await getVersion()
export const version = pkgVersion

export function getClientFiles() {
return 'error hmr mount transitions'.split(' ').map(name => {
Expand Down
Loading