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

Add release notes #438

Merged
merged 5 commits into from
Jan 22, 2020
Merged

Conversation

pratikvasa
Copy link
Contributor

Summary of the changes (in less than 80 chars)

  • Added the ablity to view release notes for packages.

/// The package's release notes.
/// </summary>
[JsonProperty("releaseNotes")]
public string ReleaseNotes { get; set; }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the properties on PackageMetadata are part of the official NuGet protocol (see this).

Please move this to BaGetPackageMetadata, as that is where all of BaGet's custom additions to the protocol are placed. See:

/// BaGet's extensions to the package metadata model. These additions

@loic-sharma
Copy link
Owner

Hi, thanks for opening this pull request! Would you mind also updating the Azure Table package service? These places will need to be updated:

  • The PackageEntity type:

public class PackageEntity : TableEntity, IDownloadCount, IListed
{
public PackageEntity()
{
}
public string Id { get; set; }
public string NormalizedVersion { get; set; }
public string OriginalVersion { get; set; }
public string Authors { get; set; }
public string Description { get; set; }
public long Downloads { get; set; }
public bool HasReadme { get; set; }
public bool IsPrerelease { get; set; }
public string Language { get; set; }
public bool Listed { get; set; }
public string MinClientVersion { get; set; }
public DateTime Published { get; set; }
public bool RequireLicenseAcceptance { get; set; }
public int SemVerLevel { get; set; }
public string Summary { get; set; }
public string Title { get; set; }
public string IconUrl { get; set; }
public string LicenseUrl { get; set; }
public string ProjectUrl { get; set; }
public string RepositoryUrl { get; set; }
public string RepositoryType { get; set; }
public string Tags { get; set; }
public string Dependencies { get; set; }
public string PackageTypes { get; set; }
public string TargetFrameworks { get; set; }
}

  • The TableOperationBuilder.AddPackage method:

var entity = new PackageEntity
{
PartitionKey = package.Id.ToLowerInvariant(),
RowKey = normalizedVersion.ToLowerInvariant(),
Id = package.Id,
NormalizedVersion = normalizedVersion,
OriginalVersion = version.ToFullString(),
Authors = JsonConvert.SerializeObject(package.Authors),
Description = package.Description,
Downloads = package.Downloads,
HasReadme = package.HasReadme,
IsPrerelease = package.IsPrerelease,
Language = package.Language,
Listed = package.Listed,
MinClientVersion = package.MinClientVersion,
Published = package.Published,
RequireLicenseAcceptance = package.RequireLicenseAcceptance,
SemVerLevel = (int)package.SemVerLevel,
Summary = package.Summary,
Title = package.Title,
IconUrl = package.IconUrlString,
LicenseUrl = package.LicenseUrlString,
ProjectUrl = package.ProjectUrlString,
RepositoryUrl = package.RepositoryUrlString,
RepositoryType = package.RepositoryType,
Tags = JsonConvert.SerializeObject(package.Tags),
Dependencies = SerializeList(package.Dependencies, AsDependencyModel),
PackageTypes = SerializeList(package.PackageTypes, AsPackageTypeModel),
TargetFrameworks = SerializeList(package.TargetFrameworks, f => f.Moniker)
};

  • The TablePackageService.AsPackage method:

return new Package
{
Id = entity.Id,
NormalizedVersionString = entity.NormalizedVersion,
OriginalVersionString = entity.OriginalVersion,
Authors = JsonConvert.DeserializeObject<string[]>(entity.Authors),
Description = entity.Description,
Downloads = entity.Downloads,
HasReadme = entity.HasReadme,
IsPrerelease = entity.IsPrerelease,
Language = entity.Language,
Listed = entity.Listed,
MinClientVersion = entity.MinClientVersion,
Published = entity.Published,
RequireLicenseAcceptance = entity.RequireLicenseAcceptance,
SemVerLevel = (SemVerLevel)entity.SemVerLevel,
Summary = entity.Summary,
Title = entity.Title,
IconUrl = ParseUri(entity.IconUrl),
LicenseUrl = ParseUri(entity.LicenseUrl),
ProjectUrl = ParseUri(entity.ProjectUrl),
RepositoryUrl = ParseUri(entity.RepositoryUrl),
RepositoryType = entity.RepositoryType,
Tags = JsonConvert.DeserializeObject<string[]>(entity.Tags),
Dependencies = ParseDependencies(entity.Dependencies),
PackageTypes = ParsePackageTypes(entity.PackageTypes),
TargetFrameworks = targetFrameworks,
};

Very nice work! :)

@pratikvasa
Copy link
Contributor Author

Thanks for the review. Will update according to commets.

I wanted to ask you one thing. I deployed this version of Baget and replaced it with the previous release. The issue is that the Release notes did not get updated. I could see the Section in the UI, but without the actual notes.

For new packages release notes are updated properly.

What extra would I need to do so that while upgrading the release notes for old packages are also reflected.

@loic-sharma
Copy link
Owner

loic-sharma commented Jan 21, 2020

Sadly today there’s no way to “reprocess” already uploaded packages. I opened an issue to track this: #447

Today, you’ll need to:

  1. Enable package hard deletion (see this documentation)
  2. Download the packages you’d like to reprocess
  3. Delete the packages using dotnet nuget delete
  4. Reupload the packages

@loic-sharma
Copy link
Owner

Your changes look good to me, I’ll test this when I’m back home and then merge this in!

/// The package's release notes.
/// </summary>
[JsonProperty("releaseNotes")]
public string ReleaseNotes { get; set; }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this to after PackageTypes but before RepositoryUrl to keep these properties alphabetically sorted?

@@ -247,6 +248,10 @@ class DisplayPackage extends React.Component<IDisplayPackageProps, IDisplayPacka
<Dependents packageId={this.state.package.id} />
</ExpandableSection>

<ExpandableSection title="Release Notes" expanded={false}>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most packages don't have release notes. Let's hide the section if the package is missing release notes:

{this.state.package.releaseNotes &&
  <ExpandableSection title="Release Notes" expanded={false}>
    <div className="package-release-notes" >{this.state.package.releaseNotes}</div>
  </ExpandableSection>
}

@loic-sharma
Copy link
Owner

Ok I tested this and it worked like a charm! I left two more minor comments, I'll merge this in once you've addressed them. Thanks for all the help!

@loic-sharma loic-sharma merged commit 9d58ca5 into loic-sharma:master Jan 22, 2020
@loic-sharma
Copy link
Owner

Thank you @cw-pratik for the excellent pull request!

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