electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.72k stars 1.74k forks source link

`FlatpakOptions.files` has inconsistent type #8160

Closed rotu closed 1 month ago

rotu commented 8 months ago

Type FlatpakOptions is incompatible with PlatformSpecificBuildOptions due to conflicting types of the files property.

PlatformSpecificBuildOptions: https://github.com/electron-userland/electron-builder/blob/8e36be113489c1afa6ce5ee6cdda73049bc619a6/packages/app-builder-lib/src/options/PlatformSpecificBuildOptions.ts#L53

whereas FlatpakOptions: https://github.com/electron-userland/electron-builder/blob/8e36be113489c1afa6ce5ee6cdda73049bc619a6/packages/app-builder-lib/src/options/linuxOptions.ts#L219-L224

These two objects are merged together in FlatpakTarget but the type incompatibility is obscured behind an as any cast.

https://github.com/electron-userland/electron-builder/blob/8e36be113489c1afa6ce5ee6cdda73049bc619a6/packages/app-builder-lib/src/targets/FlatpakTarget.ts#L12-L16

rotu commented 8 months ago

Found during development on macOS. I'm not sure the actual runtime implications of this since I'm not on Linux.

github-actions[bot] commented 6 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

rotu commented 6 months ago

not stale

github-actions[bot] commented 4 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

rotu commented 4 months ago

not stale

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

rotu commented 1 month ago

Has this been fixed?

mmaietta commented 1 month ago

I took a look at this and am not sure what's wrong in the code. To remove the any, the code can just be changed to this

  readonly options: FlatpakOptions = {
    ...this.packager.platformSpecificBuildOptions,
    ...this.packager.config.flatpak,
    files: this.packager.config.flatpak?.files,
  }

The previous code should work as-is though as this.name = flatpak so it's overriding the platformSpecificBuildOptions.files already

...(this.packager.config as any)[this.name]

Can you post an error log of what's not working for you? Are you unable to configure the flatpak -> files property in the electron-builder configuration?

rotu commented 1 month ago

Can you post an error log of what's not working for you?

I don't quite remember. I think I was just trying to figure out "what should I put in this config object?" and it looked funny to me that the files property can't accept a list of strings.

If this is not actionable, feel free to close.

mmaietta commented 1 month ago

Going to close this as it's correctly rendered in the documentation site as well https://www.electron.build/flatpak#files