unitysetup.powershell icon indicating copy to clipboard operation
unitysetup.powershell copied to clipboard

Refactor and migrate Confirm-UPMConfig into UnitySetup.powershell

Open Exolun opened this issue 1 year ago • 1 comments

Internally we've had a script called Confirm-UPMConfig for quite some time that provides the utility of scanning for all NPM packaging feeds used by a given Unity project and creating auth tokens for each of them, storing them in the user's .toml file.

This pull request migrates that functionality, to UnitySetup, allowing users to call Update-UPMConfig -ProjectManifestPath to have the script find and update auth tokens for their unity project's NPM for all manifests or a given manifest.

Additionally there are a few structural changes incorporated here as the process is now 3 stages of logic in the code:

  • Import-UPMConfig: Collects all of the scoped registries and entries in the existing .toml file and returns them
  • Sync-UPMConfig: Looks at the registries listed and gets auth tokens for each, refreshing expired existing tokens if found, or adding new entries for new scoped registries.
  • Export-UPMConfig: Writes out the UPM configuration to the .toml file (or creates it if one doesn't exist)

The logic is a bit clunky since Sync does most of the work here. Would appreciate feedback where applicable

Exolun avatar Jun 25 '24 21:06 Exolun

This is almost done, but I'll need to move the dynamic install logic to the script leveraging this, and push another commit to fix a runtime error I'm seeing now (dropped a param during a refactor)

Exolun avatar Jul 08 '24 16:07 Exolun