Conversation
Reviewer's GuideThis PR enhances the docs metadata sync script to derive the Terraria version dynamically from restored NuGet assets (OTAPI.dll), wires in an explicit restore step in CI before running the sync check, and updates the English/Chinese READMEs and project metadata to reflect the new Terraria/OTAPI USP versions and wording clarifications. Class diagram for updated sync-doc-metadata PowerShell moduleclassDiagram
class SyncDocMetadataScript {
+GetProjectXml(path)
+GetPackageVersion(projectXml, packageId)
+GetRestoreAssets(path, projectPath)
+ConvertNuGetRelativePath(path)
+GetRestoredPackageLibrary(assets, packageId)
+GetRestoredTargetPackageEntry(assets, targetFramework, packageLibraryName)
+ResolveRestoredPackageAssetPath(assets, targetFramework, packageId, assetFileName, projectPath)
+GetAssemblyFileVersion(path)
+GetTerrariaVersionFromRestoreAssets(assets, targetFramework, projectPath)
+ConvertTargetFrameworkDisplay(targetFramework)
+BuildEnglishVersionBlock(metadata)
+BuildChineseVersionBlock(metadata)
+SyncMarkedBlock(path, newBlock, mode)
}
class RestoreAssetsJson {
+libraries
+targets
+packageFolders
}
class DotNetRuntimeTypes {
<<static>> System_IO_Path
<<static>> System_Diagnostics_FileVersionInfo
<<static>> regex
}
SyncDocMetadataScript --> RestoreAssetsJson : uses
SyncDocMetadataScript ..> DotNetRuntimeTypes : calls
SyncDocMetadataScript ..> SyncDocMetadataScript : internal calls
SyncDocMetadataScript ..> GetRestoreAssets : main script uses
SyncDocMetadataScript ..> GetTerrariaVersionFromRestoreAssets : main script uses
SyncDocMetadataScript ..> GetPackageVersion : main script uses
GetTerrariaVersionFromRestoreAssets --> ResolveRestoredPackageAssetPath
ResolveRestoredPackageAssetPath --> GetRestoredPackageLibrary
ResolveRestoredPackageAssetPath --> GetRestoredTargetPackageEntry
ResolveRestoredPackageAssetPath --> ConvertNuGetRelativePath
GetAssemblyFileVersion --> DotNetRuntimeTypes
SyncDocMetadataScript ..> BuildEnglishVersionBlock : uses metadata.TerrariaVersion
SyncDocMetadataScript ..> BuildChineseVersionBlock : uses metadata.TerrariaVersion
Flow diagram for CI build job with restored docs metadata sync orderflowchart TD
A[Checkout repository] --> B[Setup .NET using actions.setup-dotnet]
B --> C[Restore dependencies with dotnet restore PROJECT_PATH]
C --> D[Run sync-doc-metadata.ps1 -Mode check]
D --> E[Install GitVersion]
E --> F[Determine version via GitVersion]
F --> G[Build Publisher with dotnet build --no-restore]
subgraph GitHubActionsBuildJob
A
B
C
D
E
F
G
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
Resolve-RestoredPackageAssetPath, consider explicitly validating that$targetPackage.runtimeexists before enumerating its properties to avoid a null-member access if a target has noruntimesection. - The hardcoded package/asset identifiers (
'OTAPI.USP','OTAPI.dll', and the restore assets path) are used in multiple places; centralizing them as variables/constants at the top of the script would make future changes less error-prone.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `Resolve-RestoredPackageAssetPath`, consider explicitly validating that `$targetPackage.runtime` exists before enumerating its properties to avoid a null-member access if a target has no `runtime` section.
- The hardcoded package/asset identifiers (`'OTAPI.USP'`, `'OTAPI.dll'`, and the restore assets path) are used in multiple places; centralizing them as variables/constants at the top of the script would make future changes less error-prone.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Update documentation metadata generation to derive the Terraria version from restored OTAPI assets and keep version matrices in sync with the actual dependencies.
Enhancements:
CI:
Documentation: