Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unity package #156

Merged
merged 7 commits into from
Dec 14, 2023
Merged

Unity package #156

merged 7 commits into from
Dec 14, 2023

Conversation

AlonTalmi
Copy link
Contributor

@AlonTalmi AlonTalmi commented Dec 13, 2023

Unity users will be able to install Jab by importing:
https://github.com/pakrym/jab.git?path=src/Jab.Unity/Package

Tested with my fork's branch at URL:
https://github.com/AlonTalmi/jab.git?path=src/Jab.Unity/Package#UnityNpmPackage

(In Unity: Window ↝ Package Manager ↝ '+' ↝ Add package from git URL...)

I already added package.json, Dlls and meta files, until you decide to rename one of the packages this should be enough.
Do notice that *.meta files are ignored in your .gitignore, I forcefully tracked them, but maybe it would be a better idea to make a .gitignore exceptions for them?

As for the build process, I don't have a lot of experience, help will be appreciated @pakrym

Edit: I understood I might have confused you, I created an npm package using npm init, but we don't actually need to upload the package to npm, it's just the structure Unity uses, it will works straight from this repository.
If you merge this PR it's enough to be installable through Unity, we just need to make sure newly built dlls are copied to the package directory

Change name to Package
@AlonTalmi AlonTalmi marked this pull request as ready for review December 13, 2023 21:05
@AlonTalmi AlonTalmi changed the title Unity npm package Unity package Dec 14, 2023
@pakrym
Copy link
Owner

pakrym commented Dec 14, 2023

Will it be easier for users if we do upload it to NPM? We'd still need some automation to keep dll files updated so might as well publish the full package?

@pakrym
Copy link
Owner

pakrym commented Dec 14, 2023

Are you able to install https://www.npmjs.com/package/com.pakrym.jab ?

@pakrym
Copy link
Owner

pakrym commented Dec 14, 2023

Navigate to the Packages directory of your project.
Adjust the project manifest file manifest.json in a text editor.
Ensure https://registry.npmjs.org/ is part of scopedRegistries.
Ensure com.pakrym is part of scopes.
Add com.pakrym.jab to the dependencies, stating the latest version.
A minimal example ends up looking like this. Please note that the version X.Y.Z stated here is to be replaced with the latest released version, which is currently NPM Package.

{
  "scopedRegistries": [
    {
      "name": "npmjs",
      "url": "https://registry.npmjs.org/",
      "scopes": [
        "com.pakrym"
      ]
    }
  ],
  "dependencies": {
    "com.pakrym.jab": "X.Y.Z",
    ...
  }
}

@AlonTalmi
Copy link
Contributor Author

AlonTalmi commented Dec 14, 2023

Your setup works and I successfully installed the package,
From my experience, most users would prefer just installing using UPM with a git URL as it's faster.
But installing a scoped registry has some pros, like selecting a specific version, see when a new version released and see all packages created under the com.pakrym registry all straight from the Unity editor (I can take some screenshots to show you what it looks like)

But if you want to create your own registry for the Unity package I'll suggest checking out OpenUPM it has a Unity specific package library, package discovery and CLI tools

Edit: seems like it's not really one or the other, uploading to npm might help some users, git URL will always be available, and OpenUPM seems to do the import themselves so there is nothing you really have to do except raise the version number

@pakrym
Copy link
Owner

pakrym commented Dec 14, 2023

If you don't mind, let's start with an NPM package. Keeping binaries up-to-date in git is a bit tricky and grows the repo size. I'll think about automating github url publishing in the meantime.

@AlonTalmi
Copy link
Contributor Author

Np, let me know if I can help :)
But do know you'll need another meta file for the Readme file, and every file or directory you'll add to the package in the future

@pakrym
Copy link
Owner

pakrym commented Dec 14, 2023

But do know you'll need another meta file for the Readme file, and every file or directory you'll add to the package in the future

TIL :)

Do you mind helping me out with that and pushing a meta file for README into this PR?

@pakrym pakrym merged commit d80ed6e into pakrym:main Dec 14, 2023
4 checks passed
@pakrym
Copy link
Owner

pakrym commented Dec 14, 2023

Thank you so much for your help @AlonTalmi !

@AlonTalmi AlonTalmi deleted the UnityNpmPackage branch December 24, 2023 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants