Beispiel #1
0
 │ shoal-node │ Shoal node utilities
 ╰────────────┴───────────────────────────────────────────────────────────────── */

import {resolve} from 'path'
import updateNotifier from 'update-notifier'
import terminalFeatures from 'term-ng'
import {truwrap, createImage} from 'truwrap'
import {createConsole} from 'verbosity'
import meta from '@thebespokepixel/meta'
import {box} from '@thebespokepixel/string'
import readPkg from 'read-pkg'
import {stripIndent} from 'common-tags'
import {colorReplacer} from './lib/colour'

export const console = createConsole({outStream: process.stderr})
export const metadata = meta(__dirname)
export const pkg = readPkg.sync(resolve(__dirname, '..'))

const boxSettings = {
	borderColor: 'green',
	margin: {
		bottom: 1,
		top: 1
	},
	padding: {
		bottom: 0,
		top: 0,
		left: 2,
		right: 2
	}
}
Beispiel #2
0
}

let metadata = {}
let expectation = 0
const local = (argv.name && 1) + (argv.moduleVersion && 2) + (argv.moduleVersionBuild && 2) + (argv.description && 4)
const external = (argv.latest && 8) + (argv.list && 16)
const global = argv.tools && 32
const gestalt = local + external + global

console.info(`Gestalt: ${gestalt}`)

if (gestalt < 32) {
	try {
		const path = join(argv._[0] ? argv._[0] : process.cwd(), 'package.json')
		console.info(`Path: ${path}`)
		metadata = meta(path)
	} catch (err) {
		process.stderr.write(`package.json not found. (${err})`)
		process.exit(1)
	}
	if (local > 0) {
		if (argv.name) {
			localOutput.push(metadata.name)
		}
		if (argv.moduleVersion) {
			localOutput.push(metadata.version(4))
		}
		if (argv.moduleVersionBuild) {
			localOutput.push(metadata.version(2))
		}
		if (argv.description) {