web-ext icon indicating copy to clipboard operation
web-ext copied to clipboard

`run.target: ["chromium"]` ignored in config

Open fregante opened this issue 1 year ago • 7 comments

Is this a feature request or a bug?

bug

What is the current behavior?

A plain $ web-ext run will read/validate webExt.run.target from my package.json, but then it ignores it.

// package.json
{
  "webExt": {
    "run": {
      "target": ["chromium"]
    }
  }
}

This verbose log line explains why: the CLI parser is providing its own defaults before merging with the config file.

[web-ext/lib/config.js][debug] Favoring CLI: target=firefox-desktop over configuration: target=chromium

What is the expected or desired behavior?

The config file should be respected by applying the defaults after reading the config file.

Version information (for bug reports)

  • Your OS and version: macOS 15.1.1
node --version && npm --version && web-ext --version
v23.1.0
10.9.0
8.3.0

fregante avatar Nov 28 '24 05:11 fregante

This message is emitted from https://github.com/mozilla/web-ext/blob/958e1d414fb5fe9938a2aeab297c655f8125fc88/src/config.js#L121-L124 . We probably have a bug there that we should fix.

Rob--W avatar Dec 05 '24 13:12 Rob--W

the CLI parser is providing its own defaults before merging with the config file.

Likely here:

https://github.com/mozilla/web-ext/blob/64ad32f5005b5b83ba4af8bf0ac8fad638e59805/src/program.js#L583

Yargs is passing the default the same way it would pass a user-provided flag, therefore overriding any config that is found later.

I'd review other such defaults in the file. If they're all ignored the same way, they should probably all be removed.

Yargs' own docs/bugtracker probably detail how to deal with configuration vs flag overrides.

fregante avatar Dec 07 '24 16:12 fregante

Are you interested in contributing a patch?

Rob--W avatar Jan 30 '25 13:01 Rob--W

I have two PRs open for 5 months over in the addons-linter repo, I'm not excited about opening more

fregante avatar Jan 30 '25 14:01 fregante

I have two PRs open for 5 months over in the addons-linter repo, I'm not excited about opening more

Apologies for that. They fell through the cracks and we missed them. We regularly triage any issues and pull requests, but sometimes an issue or PR accidentally falls off the radar. To make sure that we don't miss them again, I'll put the following tickets in the agenda for the next triage meeting (in 2 weeks):

  • https://github.com/mozilla/addons-linter/pull/5415
  • https://github.com/mozilla/addons-linter/pull/5426

One of them is in a draft, which usually signals that a PR is not ready for review. Did you intend to keep it a draft?

Rob--W avatar Jan 30 '25 19:01 Rob--W

The draft is a proposal that hasn't been accepted yet

fregante avatar Jan 30 '25 23:01 fregante

@fregante We just triaged the two pull requests, thanks for raising attention to them!

Rob--W avatar Feb 13 '25 13:02 Rob--W