-
Notifications
You must be signed in to change notification settings - Fork 115
Description
According to npm/cli#8071 (which adds a warning), npm will change the way arguments are parsed in a way that will break the way wireit looks for the --watch environment variable.
Previously, npm run build --foo would set the npm_config_foo environment variable, and we relied upon that fact for detecting when the --watch flag had been sent.
In npm 12, this will be an error about "watch" being an unrecognized npm argument. This seems like a good change for npm (silently eating arguments does seem bad), but I don't believe we currently have another way to enable wireit watch mode.
Proposals:
- Add a
WIREIT_WATCH=1environment variable. - Special case
--wireit-watch(and perhaps reserve--wireit-prefixed flag) to be extracted from the additional arguments that are usually passed down to the actual command (e.g.npm run build -- --wireit-watch --flag-for-build) - Solve for [discussion] add —watch to the wireit command as an option #553 to allow a script to be configured as intrinsically watching (e.g. a
{"watch":true}config setting), so that people can easily define e.g.build:watchscripts instead of using flags in the first place.
I'm leaning towards doing 1 in the short term, because we already handle all other runtime wireit settings with WIREIT_ environment variables and it's very easy, and 3 as a followup.