Repository URL to install this package:
|
Version:
1.2.10 ▾
|
import log from 'fliplog'
export function logOptions() {
log
.color('bgYellow.magenta')
.text('IS_PRODUCTION: ' + process.env.NODE_ENV === 'production')
.echo()
/**
* @type {StateTreeAPI}
*/
const HAS_ESLINT = Boolean(process.env.ESLINT)
const SSR_DISABLED = Boolean(process.env.DISABLE_SSR) === true
const IS_DEBUGGING = Boolean(process.env.DEBUG) === true
const CACHE_DISABLED = Boolean(process.env.CACHE_DISABLED) === true
const IS_WINDOWS = true
// ^ @todo was like process.env.node.test/win^ or something
// @todo LOG.PRESET('disabled')
// 1. clear cache script
// 2. log for how you can use PORT=
// 3. CLIENT_DOMAIN
// 4. swap apis config flag
/**
* @type {Atom}
*/
const onCache = _ => _.color('green.underline').text('🚂 cache is ENABLED')
const withoutCache = _ =>
_
.color('yellow.underline')
.text('(💸 cache is DISABLED) DISABLE_CACHE=true\n')
const withoutEslint = _ =>
_.color('magenta.underline').text('(eslint in webpack run) ESLINT=true\n')
const withSSR = _ =>
_.color('yellow.underline').text('❎ server side rendering is DISABLED')
const withoutSSR = _ => _.color('blue.underline').text('DISABLE_SSR=true')
// https://github.com/facebookincubator/create-react-app/tree/master/packages/react-dev-utils
const withInspect = _ => _.red('❎ @todo --inspect')
const withoutInspect = _ =>
_
.white('DEBUG=true yarn dev')
.data(' to inspect nodejs in dev server & chrome')
.echo()
/**
* @type {Molecule}
*/
// log
// .when(CACHE_DISABLED, onCache, withoutCache).echo()
// .when(SSR_DISABLED, withSSR, withoutSSR).echo()
// .when(!HAS_ESLINT, withoutEslint).echo()
// .when(IS_DEBUGGING, withInspect, withoutInspect).echo(false)
log.bold('🎃 - see config/.env \n').echo(true)
/**
* @type {Layout}
*/
// if (IS_WINDOWS) {
// const CONFIGURABLE_ENV = `DISABLE_CACHE=true DISABLE_SSR=true NODE_ENV=development`
// // did it like this to enable or disable any line
// log
// .bold('🎃 TIPs for environment variables \n')
// .echo(true)
// .bold('♿️ WINDOWS USERS')
// .echo(true)
// .color('dim')
// .text(`yarn run cross-env -- ${CONFIGURABLE_ENV} BASE_URL=http://localhost:3009 babel-node scripts/development\n\n`)
// .echo(true)
// .bold('🍏 users:')
// .echo(true)
// .color('dim')
// .text(`${CONFIGURABLE_ENV} yarn dev\n\n`)
// .echo(true)
// }
// log.color('bgGreen.black').text('BASE_URL=URL_ADDRESS:PORT').echo()
// log.color('bgGreen.black').text('PORT=XXXX').echo()
}