Search Unity

Custom package registry for open source projects

Discussion in 'Package Manager' started by BenMoore, Mar 4, 2019.

  1. BenMoore

    BenMoore

    Joined:
    Nov 23, 2014
    Posts:
    3
    Hi there.
    We are working on a public registry of open source packages for Unity https://xcrew.dev/
    We will welcome any projects.
    You can suggest any packages you know, or if you are working on one yourself, then contact me here or via the contacts below.

    For maintainers:
    1. Create a pair login:hash on the site http://www.htaccesstools.com/htpasswd-generator/
    2. Select the scope in which your packages will be placed. (For example it is com.neuecc or com.cysharp or both)
    3. PM me it and I will add your account
    4. Install npm
    5. Start the terminal and enter `npm set registry http://xcrew.dev`
    6. Enter `npm login`
    7. Go to the root of your package in the terminal and enter `npm publish`


    All dependencies are resolved automatically by the package manager.
    It is necessary to specify the dependencies for additional packages like so
    Code (JavaScript):
    1.  
    2. {
    3.    "name": "com.modesttree.zenject.reflectionbaking",
    4.    "author": "Modest Tree",
    5.    "displayName": "Zenject.ReflectionBaking",
    6.    "unity": "2018.1",
    7.    "version": "8.0.0",
    8.    "keywords": [
    9.        "IoC",
    10.        "DI",
    11.        "Dependency Injection",
    12.        "Zenject"
    13.    ],
    14.    "dependencies": {
    15.        "com.modesttree.zenject": "8.0.0"
    16.    },
    17.    "repository": {
    18.        "type": "git",
    19.        "url": "https://github.com/modesttree/Zenject.git"
    20.    }
    21. }
    22.  
    To add registry support to the project, add the following lines to the `manifest.json`
    Code (JavaScript):
    1.  
    2. {
    3.   "dependencies": {
    4.   },
    5.   "scopedRegistries": [
    6.     {
    7.       "name": "Unity",
    8.       "url": "https://packages.unity.com",
    9.       "scopes": [
    10.         "com.unity"
    11.       ]
    12.     },
    13.     {
    14.       "name": "XCrew",
    15.       "url": "http://xcrew.dev",
    16.       "scopes": [
    17.         "com"
    18.       ]
    19.     }
    20.   ]
    21. }
    22.  
    In the editor it looks like this


    My Contacts:

    - Email: benjminmoore@gmail.com
    - Telegram: https://t.me/benjminmoore
    - Skype: benjminmoore

    Regards, Oleg
     
    mobuni5 and M_R like this.
  2. benoitv_unity

    benoitv_unity

    Unity Technologies

    Joined:
    Aug 3, 2017
    Posts:
    40
    Hi @BenMoore,

    First off, kudos for your initiative. However, we would advise not relegating "https://packages.unity.com" to a scoped registry. Doing so will cause problems in the future when we start integrating Asset store APIs or other Unity specific features. Scoped registries were intended to limit the scope of a registry and not the other way around.

    You should instead document the list of scopes your registry supports and let your users opt into the scopes they're interested in. This will prevent breaking changes in the future and in light of what you have posted, we may not even allow configuring 1-part scopes like "com" :)

    Regards,
    Benoit
     
  3. BenMoore

    BenMoore

    Joined:
    Nov 23, 2014
    Posts:
    3

    Hello benoitv_unity

    Thanks for the answer.
    I think it would be more convenient if in the manifest the attribute "registry" was not a string, but an array of strings, then I would not have to use scopedRegistries.
    There are too many different scopes on my registry to enter them all by hand in the manifest and their number will increase.
    I can of course make them children of the scope "com.xcrew", but this doesn’t really change anything.

    I tried to configure my registry to proxy packages through itself.
    Packages were displayed on the link
    https://xcrew.dev/-/all
    But UPM, unfortunately, does not accept this.
    So I had to use scopedRegistries.

    I really hope that in the future, categorization by scopes will appear in the package manager window and there will be easier ways to use third-party registries.

    Regards,
    Oleg
     
    mobuni5 and JakHussain like this.