How to set WebGL build settings from code?

Hi there! I was just building a lot of manual WebGL builds and want to make an auto builder for windows.
My problem is, I cannot set remotely set (from commandline or scripts) the size of memory, data caching, and other variables such as exception level (so I could do a build with exceptions enabled once a day for testing purposes…)

You can programmatically change WebGL PlayerSettings via UnityEditor.PlayerSettings.WebGL, for example:

using namespace UnityEditor;

[...]

PlayerSettings.WebGL.compressionFormat = WebGLCompressionFormat.Brotli;
PlayerSettings.WebGL.dataCaching = true;
PlayerSettings.WebGL.debugSymbols = true;
PlayerSettings.WebGL.memorySize = 32;
PlayerSettings.WebGL.nameFilesAsHashes = true;

for more information, check out the manual.