Search Unity

Empty Samples

Discussion in 'Package Manager' started by Mephesto_Khaan, Nov 2, 2020.

  1. Mephesto_Khaan

    Mephesto_Khaan

    Joined:
    Jun 2, 2013
    Posts:
    47
    I tried adding a Samples~ folder as described in several places, and got everything working fine with a local Package:

    https://gyazo.com/9590e25f0a6a35e8bb25460fdfab4f4e


    But if I download the repo as a .git directly from GitHub the `General Events` sample is 0kb and it does not get downloaded (it is not in the folder). Why? It is definitely in the repo (I am manually downloading it and placing it as a local package and that does work).


    This is my package: https://github.com/MephestoKhaan/UnityEventVisualizer
     
    MostHated likes this.
  2. Mephesto_Khaan

    Mephesto_Khaan

    Joined:
    Jun 2, 2013
    Posts:
    47
  3. luizb_unity

    luizb_unity

    Joined:
    Nov 11, 2019
    Posts:
    9
    I think I'm having the same issue.
    Let me explain better.
    I have a Verdaccio server acting as the registry where I store a bunch of packages. Most of them have Samples to showcase how to use them.

    When I upload the packages to verdaccio, I add the ~ character to the end of the Samples folder name.
    Most of the packages, when I download them in the Unity Package Manager (UPM) the Samples works as expected, this means, the UPM UI shows the correct size of the Samples, and the Samples folder is hidden inside the packages folder.

    But some packages, for no specific reason, have the ~ character missing, and I can see the folder in the packages folder. This leads to all sorts of conflicts of course.
    The fun thing is that if I just go to my verdaccio server and download the .tgz file that is the package in question, on the correct version, the folder actually contains the ~ character.

    And another fun fact. This didn't happen when my verdaccio server was totally open to the world. The only change I did was to add Authentication to it.

    Any ideas?
     
  4. UnityMaru

    UnityMaru

    Community Engagement Manager PSM

    Joined:
    Mar 16, 2016
    Posts:
    1,227
    Hey there,

    Just asking the team for you folks - will come back with a reply once I have one :)
     
    luizb_unity likes this.
  5. samuelb_unity

    samuelb_unity

    Unity Technologies

    Joined:
    Nov 13, 2017
    Posts:
    151
    Hi @Mephesto_Khaan,

    At first I thought the issue could be a missing "files" entry in your package.json because even when cloning a package from a Git URL, we do "package up" the cloned repo into a package as if you had published it on the registry and that includes going through the "files" entry to see which custom files should be included. However, I see you have a "files" entry in your package.json including the "Samples~" directory. I actually tried adding your package via the Package Manager window and can successfully see the General Events sample (size 29.65 KB) and I was able to import the samples in my project. Which version of Unity are you on? I'm on the 2021 Alpha which may include some fix (although I'm not sure what that fix would be!)
     
  6. samuelb_unity

    samuelb_unity

    Unity Technologies

    Joined:
    Nov 13, 2017
    Posts:
    151
  7. luizb_unity

    luizb_unity

    Joined:
    Nov 11, 2019
    Posts:
    9
    Hello @samuelb_unity, no I've never had this "files" property in my package.json files.
    It is not present in the documentation: https://docs.unity3d.com/2020.1/Documentation/Manual/upm-manifestPkg.html
    And it was never needed for all my 20+ packages to work before.

    Should I add this? And if so, can you explain me why would it be necessary?
     
  8. samuelb_unity

    samuelb_unity

    Unity Technologies

    Joined:
    Nov 13, 2017
    Posts:
    151
    Hi @luizb_unity,

    The "files" property is part of the npm spec https://docs.npmjs.com/cli/v6/configuring-npm/package-json#files and is similar to .npmignore file. So when you publish your package to Verdaccio with "npm publish", the "files" property and ".npmignore" files will be taken into account in determining which files end up in the .tgz archive which gets pushed to the server. What's really strange in your case is that you said you tried downloading the .tgz directly from the server and it had the correct files and folder names. To my knowledge, there is no reason those folder names should change when adding your package as a project dependency. Package Manager should download and extract the tarball as-is without any transformations. That is really weird! If you can create a consistent repro with Verdaccio, please use the Unity Bug Reporter to file a bug with the exact steps and we can take a look. Thanks!
     
  9. luizb_unity

    luizb_unity

    Joined:
    Nov 11, 2019
    Posts:
    9
  10. UnityMaru

    UnityMaru

    Community Engagement Manager PSM

    Joined:
    Mar 16, 2016
    Posts:
    1,227
    luizb_unity likes this.