Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow providing properties (such as unpack) in ordering input file #350

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mmaietta
Copy link
Contributor

@mmaietta mmaietta commented Jan 27, 2025

Part 1 for fixing electron/universal#117

This implementation achieves proposal 2b
Excerpt below:

Bypass minimatch with more explicit control over packaging options, similar as to asar ordering logic.
b. Leverage options.ordering configuration of electron/asar to pass in stringified JSON config for each file to be unpacked

In allowing more explicit control within the ordering file, advanced usage of electron/asar is provided (and kind of needed for electron/universal's current auto-unpack logic) to bypass limitations of the minimatch package


Right now, the "ordering" file is simply of format:

<file path>:<anything>

Right now, electron/asar only pulls the filename value before the :

asar/src/asar.ts

Lines 92 to 95 in 121efeb

.map((line) => {
if (line.includes(':')) {
line = line.split(':').pop()!;
}

This proposal is to leverage <anything> to be JSON.stringify of Type:

{
	unpack: boolean
	// allows for future properties to be added for advanced usage without a breaking change
}

Notes:

  • Retains the same logic as before for --ordering property, just extracted to a separate function
  • Adds helper function to the symlinked test app "generator" to easily allow generating ordering file sets for any test that wants to leverage it.
  • Taking this approach allows future configuration options to be allowed on a per-file basis should electron/asar need/desire to support more advanced usage

@mmaietta mmaietta changed the title feat: allow custom per-file configuration feat: allow providing properties (such as unpack) in ordering input file Jan 27, 2025
@mmaietta mmaietta marked this pull request as ready for review January 27, 2025 01:14
@mmaietta mmaietta requested a review from a team as a code owner January 27, 2025 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant