Skip to content

Commit

Permalink
feat(cli, config): cli.bannerColor option (#6399)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored and pi0 committed Sep 30, 2019
1 parent 578d5d4 commit 46a7a67
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/cli/src/utils/banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export function showBanner (nuxt, showMemoryUsage = true) {
const messageLines = []

// Name and version
titleLines.push(`${chalk.green.bold('Nuxt.js')} ${nuxt.constructor.version}`)
const { bannerColor } = nuxt.options.cli
titleLines.push(`${chalk[bannerColor].bold('Nuxt.js')} ${nuxt.constructor.version}`)

// Running mode
titleLines.push(`Running in ${nuxt.options.dev ? chalk.bold.blue('development') : chalk.bold.green('production')} mode (${chalk.bold(nuxt.options.mode)})`)
Expand Down
4 changes: 3 additions & 1 deletion packages/cli/test/unit/utils-minimalcli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ describe('cli/utils', () => {

showBanner({
options: {
cli: {}
cli: {
bannerColor: 'green'
}
},
server: {
listeners
Expand Down
7 changes: 5 additions & 2 deletions packages/cli/test/unit/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ describe('cli/utils', () => {
jest.spyOn(fmt, 'successBox').mockImplementation(successBox)

const badgeMessages = [ 'badgeMessage' ]
const bannerColor = 'green'
const listeners = [
{ url: 'first' },
{ url: 'second' }
Expand All @@ -137,7 +138,8 @@ describe('cli/utils', () => {
showBanner({
options: {
cli: {
badgeMessages
badgeMessages,
bannerColor
}
},
server: {
Expand All @@ -163,7 +165,8 @@ describe('cli/utils', () => {
showBanner({
options: {
cli: {
badgeMessages: []
badgeMessages: [],
bannerColor: 'green'
}
},
server: {
Expand Down
3 changes: 2 additions & 1 deletion packages/config/src/config/cli.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export default () => ({
badgeMessages: []
badgeMessages: [],
bannerColor: 'green'
})
1 change: 1 addition & 0 deletions packages/config/test/__snapshots__/options.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ Object {
"buildModules": Array [],
"cli": Object {
"badgeMessages": Array [],
"bannerColor": "green",
},
"css": Array [],
"debug": false,
Expand Down
2 changes: 2 additions & 0 deletions packages/config/test/config/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ Object {
"buildModules": Array [],
"cli": Object {
"badgeMessages": Array [],
"bannerColor": "green",
},
"css": Array [],
"debug": undefined,
Expand Down Expand Up @@ -480,6 +481,7 @@ Object {
"buildModules": Array [],
"cli": Object {
"badgeMessages": Array [],
"bannerColor": "green",
},
"css": Array [],
"debug": undefined,
Expand Down

0 comments on commit 46a7a67

Please sign in to comment.