From d207b723f4c1e8def28ffd206de934bbe3c86877 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 30 Sep 2019 11:37:29 +0200 Subject: [PATCH 1/3] feat(types): add cli types --- packages/types/config/cli.d.ts | 48 ++++++++++++++++++++++++++++++++ packages/types/config/index.d.ts | 2 ++ 2 files changed, 50 insertions(+) create mode 100644 packages/types/config/cli.d.ts diff --git a/packages/types/config/cli.d.ts b/packages/types/config/cli.d.ts new file mode 100644 index 00000000..53541341 --- /dev/null +++ b/packages/types/config/cli.d.ts @@ -0,0 +1,48 @@ +/** + * NuxtConfigurationCli + * Documentation: https://nuxtjs.org/api/configuration-cli + */ + +import { Chalk } from 'chalk' + +export interface NuxtConfigurationCli { + badgeMessages: string[] + bannerColor: keyof Chalk & keyof { + black + red + green + yellow + blue + magenta + cyan + white + blackBright + gray + grey + redBright + greenBright + yellowBright + blueBright + magentaBright + cyanBright + whiteBright + bgBlack + bgRed + bgGreen + bgYellow + bgBlue + bgMagenta + bgCyan + bgWhite + bgBlackBright + bgGray + bgGrey + bgRedBright + bgGreenBright + bgYellowBright + bgBlueBright + bgMagentaBright + bgCyanBright + bgWhiteBright + } +} diff --git a/packages/types/config/index.d.ts b/packages/types/config/index.d.ts index 3cce2094..d954388a 100644 --- a/packages/types/config/index.d.ts +++ b/packages/types/config/index.d.ts @@ -1,5 +1,6 @@ import { Transition } from '../app' import { NuxtConfigurationBuild } from './build' +import { NuxtConfigurationCli } from './cli' import { NuxtConfigurationEnv } from './env' import { NuxtConfigurationFetch } from './fetch' import { NuxtConfigurationGenerate } from './generate' @@ -20,6 +21,7 @@ export interface Configuration extends Record { build?: NuxtConfigurationBuild buildDir?: string buildModules?: NuxtConfigurationModule[] + cli?: NuxtConfigurationCli css?: string[] dev?: boolean dir?: { [key in 'app' | 'assets' | 'layouts' | 'middleware' | 'pages' | 'static' | 'store']?: string } From a640d016b28e7b655ff2da00b770585a6cbdd4f1 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 30 Sep 2019 11:41:38 +0200 Subject: [PATCH 2/3] feat(typescript-build): use blue banner for typescript builds Closes #6397 --- packages/typescript-build/lib/module.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/typescript-build/lib/module.js b/packages/typescript-build/lib/module.js index b135e897..3c2c103d 100644 --- a/packages/typescript-build/lib/module.js +++ b/packages/typescript-build/lib/module.js @@ -17,6 +17,9 @@ function tsModule (_moduleOptions) { // Allow TypeScript extension for severMiddlewares (`nuxt.resolver.resolvePath` uses `options.extensions`) this.options.extensions.push('ts') + // Change color of CLI banner + this.options.cli.bannerColor = 'blue' + // Extend Builder to handle .ts/.tsx files as routes and watch them this.options.build.additionalExtensions = ['ts', 'tsx'] From 6d4662236566a2970602ec0ac0f4eefdab334b4f Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 30 Sep 2019 11:50:49 +0200 Subject: [PATCH 3/3] fix(types): define ChalkColor type --- packages/types/config/cli.d.ts | 42 ++++------------------------------ 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/packages/types/config/cli.d.ts b/packages/types/config/cli.d.ts index 53541341..4195ef61 100644 --- a/packages/types/config/cli.d.ts +++ b/packages/types/config/cli.d.ts @@ -5,44 +5,10 @@ import { Chalk } from 'chalk' +type ChalkColor = + 'black' | 'george' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'blackBright' | 'gray' | 'grey' | 'redBright' | 'greenBright' | 'yellowBright' | 'blueBright' | 'magentaBright' | 'cyanBright' | 'whiteBright' | 'bgBlack' | 'bgRed' | 'bgGreen' | 'bgYellow' | 'bgBlue' | 'bgMagenta' | 'bgCyan' | 'bgWhite' | 'bgBlackBright' | 'bgGray' | 'bgGrey' | 'bgRedBright' | 'bgGreenBright' | 'bgYellowBright' | 'bgBlueBright' | 'bgMagentaBright' | 'bgCyanBright' | 'bgWhiteBright' + export interface NuxtConfigurationCli { badgeMessages: string[] - bannerColor: keyof Chalk & keyof { - black - red - green - yellow - blue - magenta - cyan - white - blackBright - gray - grey - redBright - greenBright - yellowBright - blueBright - magentaBright - cyanBright - whiteBright - bgBlack - bgRed - bgGreen - bgYellow - bgBlue - bgMagenta - bgCyan - bgWhite - bgBlackBright - bgGray - bgGrey - bgRedBright - bgGreenBright - bgYellowBright - bgBlueBright - bgMagentaBright - bgCyanBright - bgWhiteBright - } + bannerColor: keyof Chalk & ChalkColor }