pulsepm / pulse

Unofficial package manager written in python.
MIT License
4 stars 0 forks source link

[ENHANCEMENT]: Add support for pawn.json for compatibility reasons #73

Closed mysy00 closed 2 months ago

mysy00 commented 2 months ago

(Text copied from Discord if you already read it there, reformatted a bit for easier reading)

Let's say I want to download a tagged release. Currently the code will always try to clone and you can't clone a release.

So I thought about adding a basic check to see if the given requirement is a release and if so download it instead of cloning. It would look like this in the package_ensure.py file:

if re.find(":"):
                git_download.download_and_unzip_github_release(
                    re_package[0],
                    re_package[1],
                    re_package[2],
                    asset_name?
                    re_package[1]
                )
            else:
                git_download.download_package(
                    re_package[0],
                    re_package[1],
                    os.path.join(PACKAGE_PATH, f"{re_package[0]}/{re_package[1]}"),
                    re_package[2],
                    is_commit=True if ":" in requirement else False,
                )

But again an issue raises, e.i. the necessity to specify an asset name. It may vary on each plugin, so that's why plugin creators using sampctl could specify everything within their pawn.json file.

We could and should use pulse.toml for that but as I've said above, we should also support pawn.json for compatibility reasons nevertheless (at least the basic options, e.i.: https://github.com/Y-Less/samp-plugin-crashdetect/blob/master/pawn.json#L4-L20).

Either we like it or not, having things work out of the box is a huge win for abandoned plugins and everyone's experience.

Another issue that could be solved by this solution is the fact that installing Y-Less/samp-plugin-crashdetect will clone the repository but it's a plugin, it obviously doesn't have any plugins in the repository and everything is in the release.

We have a similar issue with telling if the thing we want to install is whether a plugin or a component.

That leaves these options: 1) Add more options to pulse.toml and PR every project there is 2) Add support for parsing these options from pawn.json files if pulse.toml is not found: https://github.com/Y-Less/samp-plugin-crashdetect/blob/master/pawn.json#L4-L20 3) Both