Open
Description
The npm run build
command is affected by the environment variable CI
, but it is not well documented.
This is what the existing documentation says about it:
When creating a build of your application with npm run build linter warnings are not checked by default. Like npm test, you can force the build to perform a linter warning check by setting the environment variable CI. If any warnings are encountered then the build fails.
By looking at the source code or playing with the command, there are several side effects:
- Some errors are silenced:
- There is no color in the output anymore
- Another side effect here
I believe it would be a good choice to have no undocumented side effect.
Use cases where it is a problem:
- I want to master my CI pipeline: I can't just set an environment variable without knowing exactly what it does.
- I want to treat warnings as errors locally and the only option seems to be to set the
CI
option (this is a problem in intslef): I would also like to know what it does and keep the colors in the output. - The usage of
npm build
don't talk about the envinroment variables, neither doesnpm help build
, it is then confusing to see the behavior change between computers.
$ npm build -h
npm build [<folder>]
Thank you for reading this.
Best,
Simon