Skip to content

Commit 103062f

Browse files
committed
ensure content files are available in config
If you use the cli with the `--content` option, then we first resolve the config (empty), then add the `content` to the config. The issue is that this means that the content will be empty when you resolve it initially. This results in a warning in your terminal. Now, we will make sure to merge 2 configs if you have the `--content` data passed. We will also make sure to override the final `config.content.files` to whatever you passed in to make sure that this is the same behaviour as before.
1 parent 490c9dc commit 103062f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/cli.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,6 @@ async function build() {
437437

438438
function resolveConfig() {
439439
let config = configPath ? require(configPath) : {}
440-
let resolvedConfig = resolveConfigInternal(config)
441440

442441
if (args['--purge']) {
443442
log.warn('purge-flag-deprecated', [
@@ -450,10 +449,13 @@ async function build() {
450449
}
451450

452451
if (args['--content']) {
453-
resolvedConfig.content.files = args['--content'].split(/(?<!{[^}]+),/)
452+
let files = args['--content'].split(/(?<!{[^}]+),/)
453+
let resolvedConfig = resolveConfigInternal(config, { content: { files } })
454+
resolvedConfig.content.files = files
455+
return resolvedConfig
454456
}
455457

456-
return resolvedConfig
458+
return resolveConfigInternal(config)
457459
}
458460

459461
function extractFileGlobs(config) {

0 commit comments

Comments
 (0)