TurboWarp / packager

Converts Scratch projects into HTML files, zip archives, or executable programs for Windows, macOS, and Linux.
https://packager.turbowarp.org/
Mozilla Public License 2.0
228 stars 136 forks source link

Allow exporting/importing packager settings #480

Closed joshpinto6 closed 2 years ago

joshpinto6 commented 2 years ago

A useful feature that could be added to the Turbowarp Packager would be the ability to export/import a JSON file, similar to how the ScratchAddons Chrome Extension allows exporting addon settings.

When developing a game for GMTK game jam, I used the Turbowarp Packager to make several executables for my game. The biggest hurdle I came across was the lack of an import/export feature, as, every time I wished to make a new build of my project, I had to refill out all of the packager options.

I believe have developed a working concept for this feature (probably not very well πŸ˜‰) in my packager fork. I developed it for my own personal use, but you can test/see it in action in the Github Pages site here.

I am fairly proficient in front-end development, but this was my first project using Svelte. I have added a section with a button to download the content of $options as a .json file. The import button subsequently opens a file dialogue and sets the $options variable based on the selected file's content.

I have seen that issues #310 and #309 discuss a similar issue, but I haven't seen the development of the feature being discussed anywhere.

I am wondering what I need to do or fix before creating a pull request for this feature. Do I need to update the offline packager first? Have I forgotten to include any options in the JSON schema? I am also asking for feedback on other improvements I can make to the feature before creating a pull request for it.

I'm very interested in how I can help and contribute to the development of the Turbowarp Packager. Any feedback would be very welcome. πŸ˜„

joshpinto6 commented 2 years ago

Just realized that in my fork, I do not check that the schema of the selected JSON file matches the required schema. Some error handling would also be nice. I think I'll work on that next.

GarboMuffin commented 2 years ago

Send a pull request and I'll take a look. There's already a mechanism for making sure that some unknown object has vaguely the correct schema.

I am wondering what I need to do or fix before creating a pull request for this feature. Do I need to update the offline packager first?

You shouldn't have to touch the offline packager

joshpinto6 commented 2 years ago

Thanks for the speedy response! Here's the pull request: #481

GarboMuffin commented 2 years ago

every time I wished to make a new build of my project, I had to refill out all of the packager options.

As long as the file name or project ID is the same, the packager will try to remember your old settings, by the way

joshpinto6 commented 2 years ago

Oh, I see! I didn't realize, because I was saving a new project with an incremental (1) or (2) at the end of the string each time.