Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(config): accept explicit production=false #2951

Merged
merged 1 commit into from Mar 24, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/utils/config/definitions.js
Expand Up @@ -29,6 +29,8 @@ const buildOmitList = obj => {
const only = obj.only
if (/^prod(uction)?$/.test(only) || obj.production)
omit.push('dev')
else if (obj.production === false)
include.push('dev')

if (/^dev/.test(obj.also))
include.push('dev')
Expand Down Expand Up @@ -1396,8 +1398,8 @@ define('preid', {
})

define('production', {
default: false,
type: Boolean,
default: null,
type: [null, Boolean],
deprecated: 'Use `--omit=dev` instead.',
description: 'Alias for `--omit=dev`',
flatten (key, obj, flatOptions) {
Expand Down
Expand Up @@ -1338,8 +1338,8 @@ Alias for --include=optional or --omit=optional

#### \`production\`

* Default: false
* Type: Boolean
* Default: null
* Type: null or Boolean
* DEPRECATED: Use \`--omit=dev\` instead.

Alias for \`--omit=dev\`
Expand Down
4 changes: 2 additions & 2 deletions test/lib/utils/config/definitions.js
Expand Up @@ -310,9 +310,9 @@ t.test('flatteners that populate flat.omit array', t => {
definitions.production.flatten('production', obj, flat)
t.strictSame(obj, {
production: false,
include: [],
include: ['dev'],
omit: [],
}, '--no-production has no effect')
}, '--no-production explicitly includes dev')
t.strictSame(flat, { omit: [] }, '--no-production has no effect')

obj.production = true
Expand Down