Skip to content

Enable bundling of mixin scripts#240

Merged
rpatters1 merged 2 commits intomasterfrom
bundle-mixin
Jul 11, 2022
Merged

Enable bundling of mixin scripts#240
rpatters1 merged 2 commits intomasterfrom
bundle-mixin

Conversation

@Nick-Mazuk
Copy link
Member

This PR enables the bundling of the mixin scripts. To do so, it replaces the custom bundler I wrote with https://github.com/Benjamin-Dobell/luabundle. Additionally, since it results in larger file sizes in general, I minified the resulting bundles using https://github.com/mathiasbynens/luamin.

Some things to note:

  • The majority of the bundling now depends on 3rd-party dependencies, so if there are bugs we'd need to fix them in the upstream repos
  • The mixins (e.g., things located in src/mixin) are not included unless the mixin library is required (e.g., require("library.mixin"). The exact heuristic is that if the text library.mixin is used anywhere in the file, all the mixins will be bundled.
    • This means we don't need to statically determine which mixins are used, which is a much more complex issue
    • It also means that anytime you use a mixin, you must put library.mixin somewhere in the file (usually the require statement is sufficient).
  • Imported lua files are no longer required to be located in src/library. They can now be located in any subfoler inside the src folder (including folders added in the future).
  • I cannot entirely test things out locally, so it's possible there will be build errors when this PR is merged

Overall, I think this is a net win.

Allows the merging of #183.

Feel free to merge this PR when approved.

@Nick-Mazuk Nick-Mazuk requested a review from rpatters1 July 10, 2022 22:46
Copy link
Collaborator

@rpatters1 rpatters1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really qualified to review this. If you are comfortable with merging it, go for it. We can always address any issues with another PR.

@rpatters1
Copy link
Collaborator

rpatters1 commented Jul 11, 2022

One reason I'm punting on merging is the merge conflicts with the dist files. I'm wondering if they should even be tracked.

* master:
  chore: autopublish 2022-07-11T00:00:36Z
  chore: autopublish 2022-07-10T23:59:42Z
  chore: autopublish 2022-07-10T23:50:28Z
  update lua docs generator
  chore: autopublish 2022-07-10T23:43:42Z
  update lua docs generator
  add get_smufl_font_list library function
  adds general_library.calc_script_name. not sure if we'll really use it, though.

# Conflicts:
#	dist/UI_switch_to_selected_part.lua
#	dist/expression_add_opaque_background.lua
#	dist/expression_remove_enclosure.lua
#	dist/expression_reset_positioning.lua
#	dist/expression_set_to_parts_only.lua
#	dist/expression_set_to_score_only.lua
#	dist/measure_create_movement_break.lua
#	dist/measure_numbers_adjust_for_leadin.lua
#	dist/measure_numbers_move_down.lua
#	dist/measure_numbers_move_up.lua
#	dist/measure_numbers_reset_vertical.lua
#	dist/mmrest_widen_to_tempo_mark.lua
#	dist/note_automatic_jete.lua
#	dist/pitch_transform_harmonics_fifth.lua
#	dist/pitch_transform_harmonics_fourth.lua
#	dist/pitch_transform_harmonics_major_third.lua
#	dist/prefs_reset_group_abbreviated_name_fonts.lua
#	dist/prefs_reset_group_full_name_fonts.lua
#	dist/prefs_reset_staff_abbreviated_name_fonts.lua
#	dist/prefs_reset_staff_full_name_fonts.lua
#	dist/score_create_double_wind_orchestra_score.lua
#	dist/score_create_string_orchestra_score.lua
#	dist/score_create_trombone_choir_score.lua
#	dist/smufl_load_engraving_defaults.lua
#	dist/staff_groups_copy_score_to_part.lua
#	dist/staff_groups_reset.lua
#	dist/standalone_hairpin_adjustment.lua
#	dist/system_fix_indent.lua
@rpatters1 rpatters1 merged commit c89218a into master Jul 11, 2022
@Nick-Mazuk Nick-Mazuk deleted the bundle-mixin branch July 11, 2022 03:27
@Nick-Mazuk
Copy link
Member Author

One reason I'm punting on merging is the merge conflicts with the dist files. I'm wondering if they should even be tracked.

Right now they should be tracked.

When someone clicks "Download" on the website, they download the bundled file directly from GitHub. For instance, if someone wants to download the "simplify accidentals" script, they are essentially doing the following:

<a download href="https://raw.githubusercontent.com/finale-lua/lua-scripts/master/dist/accidental_simplify.lua">Download</a>

It's slightly more complex than that to meet more edge cases, but that's the idea.

I'm open to not checking in these bundled files. It just means we'll need to figure out another place to store the bundled scripts.

Nick-Mazuk added a commit that referenced this pull request Jul 11, 2022
@Nick-Mazuk Nick-Mazuk mentioned this pull request Jul 11, 2022
Nick-Mazuk added a commit that referenced this pull request Jul 11, 2022
@rpatters1
Copy link
Collaborator

I figured there might be an issue that they couldn't be on github if not tracked. I see removing them as very low priority.

rpatters1 added a commit to rpatters1/lua-scripts that referenced this pull request Jul 11, 2022
* master:
  rollback PR finale-lua#240
  chore: autopublish 2022-07-11T03:27:27Z
  chore: autopublish 2022-07-11T03:20:01Z
  chore: autopublish 2022-07-11T02:36:42Z
  chore: autopublish 2022-07-11T02:32:32Z
  update system nudgers to use SpaceAbove and consolidate to a single script.
  Update cue_notes_create.lua
  Update cross_staff_offset.lua
  update comments in `tie.lua` to produce better html.
  Update cross_staff_offset.lua
  Update cross_staff_offset.lua
  Update cross_staff_offset.lua
  Update cue_notes_create.lua
This was referenced Jul 16, 2022
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.

2 participants