Is it possible to create a "package manager"?

Hello DevForum!

I’ve been working really hard on a project called lua.console, it’s a console plugin for roblox studio. I’ve recently gotten the idea of a way for people to create their own custom commands. The way I set up lua.console, it’s very modular and easy to create new commands with the source files, but installing the commands are a bit tricky.

I might go for a system that requires people to submit a github repo of their command so I can verify and check the source files to make sure there isn’t anything malicious, but the real question is is it possible to “install” these module scripts from different games/comps?

I don’t want them already in the plugin, rather a person can run glass i [NAMEHERE] kind of like npm (glass being the name of my package manager)

Small note, the console system is already done I’m not looking for help doing that :wink:

I’ve looked into loadstring() but it seems dangerous and some games may have it disabled. This might be possible using HTTPService but as far as I know, you can’t.

I can’t use loadasset() because I believe you can only use that for things you have created yourself or ROBLOX has created.

I’m not looking for a full script, rather just a point to a service or system to achieve this.

Any help would be greatly appreciated!

Yea you’d have to set their commands to the environment with like setfenv()

Thanks but when testing it it seems to only work locally, if someone else wanted to install the inquered command, they’d have to copy the source code and run the dev installer.

Is there anyway to avoid this?

You could take the node js approach and basically have a library of all these packages which just contain the source code of it. We can’t do it directly for (obvious) security reasons. (think of why exploiters use set function environment)

Hm yeah, but depending on amount of plugins that folder could be tremendously large, also I’d need to push out updates every time I wan’t to add a command for people to install, but I guess I have to if there is no other way…

Yes it would be possible. You would have to use HttpService to download the packages, and then store their content in a folder somewhere in server storage or replicated storage, depending on the use cases.

Uh, what would I make the call too? As far as I know I can’t really install anything from anywhere, or read code from a repo in github.

You could look at github’s api to see how to get the content of a github repository
This is how you can achieve it

"https://api.github.com/repos/${owner}/${repo}/contents/${directory: optional}"

It will list the files that are present in a repository. You can then look at the download_url field to know where to find a file’s source.

If the download_url is null, it probably means that it’s a folder so you can proceed with a deep search

2 Likes

I’ve been working on this sort of idea. I have managed to have a require-able module with a child module containing current registered ‘libraries’, but that must be updated manually.

I came across a tutorial on making APIs, which would be the optimal solution, but if it could be accessed directly by GitHub API then I would go for that.

…a competitor… :anguished:

Lol, but yes githubs API allows you to pull code from a repo, I’m working on the system right now!

1 Like

Existing package managers should be a testimony to the fact that yes you can. They aren’t exactly like npm but the principles are relatively the same. NevermoreEngine takes all packages in a GitHub repository and installs them, RoStrap is probably closer to npm (the plugin component at least).

NevermoreEngine:

RoStrap: