Minimalistic open source cross-platform package registry server by DeepDreamGames, intended primarily to be used with the Unity Package Manager to share packages between projects.
Reads metadata (package.json) of GZipped package Tarballs from a folder and serves them to clients via npm protocol.
Packages is a great way to share code and assets between Unity projects, but with all due respect - installing, setting up, running and maintaining node.js, npm and Verdaccio may sometimes be an overkill for such purpose.
- Cross-platform (tested on Windows, Linux and Mac)
- Low memory consumption (consumes less than 15 MB of RAM with 60 active packages).
- References only
mscorlib.dll,System.dllandSystem.Core.dll(contains custom implementations for Tar, Json Reader, Json Writer and (non-allocating!) Semantic Version value parsing and comparison) - Basic command line interface for interactivity and logging which can be extended as necessary (see
RegisterCommands()inApplication.cs). Available commands:help- list available commmandsclear- clear consolestart- start server (in case it was stopped)stop- stop serverrestart- restart serverlist- list registered packages and their versionsscan- rescan packages in folder (server will be stopped and restarted if it was running)shutdownquitexit- shutdown serververbosity- change verbosity level of a running application, to override value defined in config
- Probably insecure, since it was intended for use only in controlled networks and security is of no concern (but let me know if there's anything I can do to make it more secure).
- Has no graceful exeptions handling. If something will fail - you'll see it in console and the server will not start. However, you have all the source code so you can see what went wrong and fix it.
- Have not been tested with multiple clients simultaneously making requests to the server.
-
Download the latest release and extract it.
-
Allow executable through Firewall and open port
80for inbound connections. -
Put your packages into the
Packagesfolder. -
Launch server executable.
- Create or edit configuration file (
config.json) in the same folder as server executable (or specify relative path to config file as first command line argument). You can assign multiple endpoints there and specify port (e.g.http://other.url:4873):
{
"endpoints": [ "http://packages.local" ], // Comma-separated list of endpoints which server will be listening to
"path": "Packages", // Relative path to the folder with packages
"extensions": [ ".tgz", ".tar.gz", ".taz" ], // Comma-separated list of package file extensions (not formats! Since only GZipped Tarballs are supported). Leading '.' is optional
"verbosity": "Log" // Logging verbosity level: "None", "Exception", "Error", "Warning", "Log", "Info", "Debug" (or 0 to 6 correspondingly). Default - "Log"
}
2.1 If you plan to access registry from the same device where the server is running - add the following line to the end of your C:\Windows\System32\drivers\etc\hosts file (you'll need to run your text editor as an administrator in order to be able to change this file in Windows):
127.0.0.1 packages.local
2.2 If you want to access the server from another device in your network - you can setup DNS forwarding in your router. E.g. for Zyxel routers - access http://192.168.0.1/a and type the following commands:
ip host packages.local 192.168.0.105wherepackages.localis the endpoint (without port number) you've specified inconfig.jsonand192.168.0.105is an IP address of your server (make sure to assign static IP to your server first to make sure that it won't change).system configuration save- to save this configuration (so you won't have to type the command above each time after router restart).
-
Allow an app through Firewall and open port you've specified in
config.json(80by default forhttpurl endpoints). -
Put your packages into the folder you've specified in
config.json(e.g.Packages). -
Launch server executable.
In your project, add the following lines to your Packages/manifest.json file just before "dependencies" section and change url and scopes as necessary:
"scopedRegistries": [
{
"name": "My Local Registry",
"url": "http://localhost",
"scopes": [
"com.deepdreamgames"
]
}
],
- 1.0.0 - initial release