TurboWarp/packager-extras

TurboWarp Packager Extras Breaks when Version Number is empty when packaging at TurboWarp Packager

Closed this issue · 4 comments

Expected Behavior

TurboWarp Packager Extras should work properly.

Actual Behavior

app.py will raise an error, the traceback is down below ↓ (Z:\packager-extras\ is the place where I clone this repo to)

Traceback (most recent call last):
  File "Z:\packager-extras\app.py", line 313, in run
    self._run()
  File "Z:\packager-extras\app.py", line 434, in _run
    generated_installer_path = create_installer(self.extracted_contents)
  File "Z:\packager-extras\app.py", line 190, in create_installer
    version = get_version_from_package_json(package_json)
  File "Z:\packager-extras\app.py", line 45, in get_version_from_package_json
    major, minor, patch = parse_version(raw_version)
  File "Z:\packager-extras\app.py", line 445, in parse_version
    parts = [int(i) for i in version_number.split('.')]
  File "Z:\packager-extras\app.py", line 445, in <listcomp>
    parts = [int(i) for i in version_number.split('.')]
ValueError: invalid literal for int() with base 10: ''

Steps to Reproduce

  1. Open TurboWarp Desktop, then click File -> Package project
  2. Click 'Import Settings' and import this file → turbowarp-packager-settings.json
  3. Package the project.
  4. Open TurboWarp Packager Extras, either run the app.py or the exe.
  5. Select or drop the .zip file that has just generated by the packager.
  6. Select 'Create installer' and press 'Continue'.
  7. Ba-boom!
    屏幕截图 2024-02-08 182718

Possible Solutions

  • Add these 2 lines below Line 442 in app.py:
  if version_number == '':
    return [1, 0, 0]

It does the same thing as Line 48 do.

  • Change the behavior of TurboWarp Packager when Version Number is empty.

Operating System and Browser

Windows 11 23H2 22631.3007
TurboWarp Desktop 1.10.1
TurboWarp Packager Standalone v1.10.0 (2024-02-04)
https://github.com/TurboWarp/packager-extras 2c0a496
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] on win32

your version number really just should not be blank

why do you want an empty version number anyways? the error message can be improved but really this is a case of garbage-in-garbage-out

why do you want an empty version number anyways? the error message can be improved but really this is a case of garbage-in-garbage-out

So if a version number should not be blank, then why not to stop it becoming empty at TurboWarp Packager?

If you leave it empty now, the packager will suggest that you did it wrong, and also we will make Extras have a better error message for this