Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thundernerd/unity3d-packagemanifesteditor
A utility to edit package manifests through code
https://github.com/thundernerd/unity3d-packagemanifesteditor
manifest npm package package-manager unity3d upm
Last synced: about 2 months ago
JSON representation
A utility to edit package manifests through code
- Host: GitHub
- URL: https://github.com/thundernerd/unity3d-packagemanifesteditor
- Owner: Thundernerd
- License: mit
- Created: 2021-01-06T19:52:42.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-05-03T13:41:30.000Z (over 3 years ago)
- Last Synced: 2023-02-27T19:12:05.120Z (almost 2 years ago)
- Topics: manifest, npm, package, package-manager, unity3d, upm
- Language: C#
- Homepage:
- Size: 53.7 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# Package Manifest Editor
Package Manifest Editor is a utility to edit package manifests through code.
## Installation
1. The package is available on the [openupm registry](https://openupm.com). You can install it via [openupm-cli](https://github.com/openupm/openupm-cli).
```
openupm add net.tnrd.packagemanifesteditor
```
2. Installing through a [Unity Package](http://package-installer.glitch.me/v1/installer/package.openupm.com/net.tnrd.packagemanifesteditor?registry=https://package.openupm.com) created by the [Package Installer Creator](https://package-installer.glitch.me) from [Needle](https://needle.tools)[](http://package-installer.glitch.me/v1/installer/package.openupm.com/net.tnrd.packagemanifesteditor?registry=https://package.openupm.com)
## Usage
Before you can do anything you'll have to open a manifest for editing like so
```c#
private void Foo()
{
ManifestEditor editor = ManifestEditor.OpenById("Package Folder Name");
}
```
I personally put my packages in folders with the reverse domain name notation so I would use something along the lines of
```ManifestEditor.OpenById("tld.domain.packagename");```### Supported attributes
This package follows Unity's manifest definition which can be found here: [https://docs.unity3d.com/Manual/upm-manifestPkg.html](https://docs.unity3d.com/Manual/upm-manifestPkg.html)The odd one out are is the dependencies attribute. This one can only be read by using the `Dependencies` property on the `ManifestEditor`.
To add a dependency one can use the `AddDependency` method like so
```c#
private void Foo()
{
ManifestEditor editor = ManifestEditor.OpenById("tld.domain.packagename");
editor.AddDependency("tld.domain.packagedependency", "1.0.0");
}
```
The second parameter requires a version number according to the Semantic Versioning spec using [Artees' SemVer](https://github.com/Artees/Unity-SemVer).Removing a dependency is done using the `RemoveDependency` method like so
```c#
private void Foo()
{
ManifestEditor editor = ManifestEditor.OpenById("tld.domain.packagename");
editor.RemoveDependency("tld.domain.packagedependency");
}
```### Saving
Once you're done with your changes you can save the manifest file. It will overwrite the existing one on disk.
```c#
private void Foo()
{
ManifestEditor editor = ManifestEditor.OpenById("tld.domain.packagename");
// Do some changes
editor.Save();
}
```### Undoing your changes
If you want to undo your changes you can simply reload the manifest from disk like so
```c#
private void Foo()
{
ManifestEditor editor = ManifestEditor.OpenById("tld.domain.packagename");
// Some changes applied that you want to undo
editor.Reload();
}
```## Support
**Package Manifest Editor** is a small and open-source utility that I hope helps other people. It is by no means necessary but if you feel generous you can support me by donating.[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/J3J11GEYY)
## Contributing
Pull requests are welcomed. Please feel free to fix any issues you find, or add new features.