Repository: jiahaog/nativefier
File: src/build/prepareElectronApp.ts (TypeScript)

Code before:
    height: options.nativefier.height,
    hideWindowFrame: options.nativefier.hideWindowFrame,
    ignoreCertificate: options.nativefier.ignoreCertificate,
    ignoreGpuBlacklist: options.nativefier.ignoreGpuBlacklist,
    insecure: options.nativefier.insecure,
    internalUrls: options.nativefier.internalUrls,
    blockExternalUrls: options.nativefier.blockExternalUrls,
    maxHeight: options.nativefier.maxHeight,
    maximize: options.nativefier.maximize,
    maxWidth: options.nativefier.maxWidth,
    minHeight: options.nativefier.minHeight,
    minWidth: options.nativefier.minWidth,
    name: options.packager.name,
    nativefierVersion: options.nativefier.nativefierVersion,
    processEnvs: options.nativefier.processEnvs,
    proxyRules: options.nativefier.proxyRules,
    showMenuBar: options.nativefier.showMenuBar,
    singleInstance: options.nativefier.singleInstance,
    targetUrl: options.packager.targetUrl,
    titleBarStyle: options.nativefier.titleBarStyle,
    tray: options.nativefier.tray,
    userAgent: options.nativefier.userAgent,
    versionString: options.nativefier.versionString,
    width: options.nativefier.width,
    win32metadata: options.packager.win32metadata,
    disableOldNativefieryesiknowitisinsecure:
      options.nativefier.disableOldNativefierWarningyesiknowitisinsecure,
    x: options.nativefier.x,
    y: options.nativefier.y,
    zoom: options.nativefier.zoom,
    buildDate: Math.floor(new Date().getTime() / 1000),
  };
}

async function maybeCopyScripts(srcs: string[], dest: string): Promise<void> {
  if (!srcs || srcs.length === 0) {
    log.debug('No files to inject, skipping copy.');
    return;
  }

  log.debug(`Copying ${srcs.length} files to inject in app.`);
  for (const src of srcs) {
    if (!fs.existsSync(src)) {
      throw new Error(
        `File ${src} not found. Note that Nativefier expects *local* files, not URLs.`,
      );
    }

    let destFileName: string;
    if (path.extname(src) === '.js') {
      destFileName = 'inject.js';

Review comment (suggestion):
I was opinionated to have a horribly long param to pass, to force user understanding, but please use a shorter name in the internal variable 😄. `disableOldBuildWarning` will be more pleasant to work with.

Code after:
    height: options.nativefier.height,
    hideWindowFrame: options.nativefier.hideWindowFrame,
    ignoreCertificate: options.nativefier.ignoreCertificate,
    ignoreGpuBlacklist: options.nativefier.ignoreGpuBlacklist,
    insecure: options.nativefier.insecure,
    internalUrls: options.nativefier.internalUrls,
    blockExternalUrls: options.nativefier.blockExternalUrls,
    maxHeight: options.nativefier.maxHeight,
    maximize: options.nativefier.maximize,
    maxWidth: options.nativefier.maxWidth,
    minHeight: options.nativefier.minHeight,
    minWidth: options.nativefier.minWidth,
    name: options.packager.name,
    nativefierVersion: options.nativefier.nativefierVersion,
    processEnvs: options.nativefier.processEnvs,
    proxyRules: options.nativefier.proxyRules,
    showMenuBar: options.nativefier.showMenuBar,
    singleInstance: options.nativefier.singleInstance,
    targetUrl: options.packager.targetUrl,
    titleBarStyle: options.nativefier.titleBarStyle,
    tray: options.nativefier.tray,
    userAgent: options.nativefier.userAgent,
    versionString: options.nativefier.versionString,
    width: options.nativefier.width,
    win32metadata: options.packager.win32metadata,
    disableOldBuildWarning: options.nativefier.disableOldBuildWarning,
    x: options.nativefier.x,
    y: options.nativefier.y,
    zoom: options.nativefier.zoom,
    buildDate: new Date().getTime(),
  };
}

async function maybeCopyScripts(srcs: string[], dest: string): Promise<void> {
  if (!srcs || srcs.length === 0) {
    log.debug('No files to inject, skipping copy.');
    return;
  }

  log.debug(`Copying ${srcs.length} files to inject in app.`);
  for (const src of srcs) {
    if (!fs.existsSync(src)) {
      throw new Error(
        `File ${src} not found. Note that Nativefier expects *local* files, not URLs.`,
      );
    }

    let destFileName: string;
    if (path.extname(src) === '.js') {
      destFileName = 'inject.js';
    } else if (path.extname(src) === '.css') {