Repository: jiahaog/nativefier
File: src/options/optionsMain.ts (TypeScript)

Code before:
    },
  };

  if (options.nativefier.verbose) {
    log.setLevel('trace');
    try {
      // eslint-disable-next-line @typescript-eslint/no-var-requires
      require('debug').enable('electron-packager');
    } catch (err) {
      log.debug(
        'Failed to enable electron-packager debug output. This should not happen,',
        'and suggests their internals changed. Please report an issue.',
      );
    }

    log.debug(
      'Running in verbose mode! This will produce a mountain of logs and',
      'is recommended only for troubleshooting or if you like Shakespeare.',
    );
  } else {
    log.setLevel('info');
  }

  if (rawOptions.wvvmp) {
      process.env.ELECTRON_MIRROR = 'https://github.com/castlabs/electron-releases/releases/download/';
      options.packager.electronVersion = '11.0.0-wvvmp';
  }

  if (rawOptions.electronVersion) {
    const requestedVersion: string = rawOptions.electronVersion;
    if (!SEMVER_VERSION_NUMBER_REGEX.exec(requestedVersion)) {
      throw `Invalid Electron version number "${requestedVersion}". Aborting.`;
    }
    const requestedMajorVersion = parseInt(requestedVersion.split('.')[0], 10);
    if (requestedMajorVersion < ELECTRON_MAJOR_VERSION) {
      log.warn(
        `\nATTENTION: Using **old** Electron version ${requestedVersion} as requested.`,
        "\nIt's untested, bugs and horror will happen, you're on your own.",
        `\nSimply abort & re-run without passing the version flag to default to ${DEFAULT_ELECTRON_VERSION}`,
      );
    }
  }

  if (options.nativefier.flashPluginDir) {
    options.nativefier.insecure = true;
  }

  if (rawOptions.honest) {
    options.nativefier.userAgent = null;
  }


Review comment (suggestion):
Rather than override the version, what about building the wvvmp version from the actually-requested version (or default if not passed), appending `-wvvmp`.

Something like

```ts
const wvvmpString = rawOptions.wvvmp ? '-wvvmp' : '';
options.packager.electronVersion = ${electronVersion}${wvvmpString}`
```

This way, a call becomes `nativefier -e 11.0.1 -wvvmp netflix.com`, de-hardcoding the version, keeping Electron version number and wvvmp-enablement orthogonal.

Code after:
      zoom: rawOptions.zoom || 1.0,
    },
  };

  if (options.nativefier.verbose) {
    log.setLevel('trace');
    try {
      // eslint-disable-next-line @typescript-eslint/no-var-requires
      require('debug').enable('electron-packager');
    } catch (err) {
      log.debug(
        'Failed to enable electron-packager debug output. This should not happen,',
        'and suggests their internals changed. Please report an issue.',
      );
    }

    log.debug(
      'Running in verbose mode! This will produce a mountain of logs and',
      'is recommended only for troubleshooting or if you like Shakespeare.',
    );
  } else {
    log.setLevel('info');
  }

  if (rawOptions.electronVersion) {
    const requestedVersion: string = rawOptions.electronVersion;
    if (!SEMVER_VERSION_NUMBER_REGEX.exec(requestedVersion)) {
      throw `Invalid Electron version number "${requestedVersion}". Aborting.`;
    }
    const requestedMajorVersion = parseInt(requestedVersion.split('.')[0], 10);
    if (requestedMajorVersion < ELECTRON_MAJOR_VERSION) {
      log.warn(
        `\nATTENTION: Using **old** Electron version ${requestedVersion} as requested.`,
        "\nIt's untested, bugs and horror will happen, you're on your own.",
        `\nSimply abort & re-run without passing the version flag to default to ${DEFAULT_ELECTRON_VERSION}`,
      );
    }
  }

  if (rawOptions.widevine) {
    const widevineElectronVersion = `${options.packager.electronVersion}-wvvmp`;
    try {
      await axios.get(
        `https://github.com/castlabs/electron-releases/releases/tag/v${widevineElectronVersion}`,
      );
    } catch (error) {
      throw `\nERROR: castLabs Electron version "${widevineElectronVersion}" does not exist. \nVerify versions at https://github.com/castlabs/electron-releases/releases. \nAborting.`;
    }

    options.packager.electronVersion = widevineElectronVersion;
    process.env.ELECTRON_MIRROR =