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
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?
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!)
@luizb_unity does your package.json include a "files" property like the one posted by @Mephesto_Khaan ? See here https://github.com/MephestoKhaan/UnityEventVisualizer/blob/master/package.json#L31
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?
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!
Hi @samuelb_unity I've filled a bug report quite sometime ago. I though @okcompute_unity was looking at it, but maybe i should have said it in here before, but it is case number: 1292552 I also posted on this thread: https://forum.unity.com/threads/npm-registry-authentication.836308/
Thank you We'll make sure that it gets looked at. Do let me know if you don't get a response in the next week or so.