Skip to content

Commit

Permalink
implement homepage and repository links
Browse files Browse the repository at this point in the history
  • Loading branch information
MobiusCraftFlip authored Nov 26, 2023
1 parent ea536c5 commit 60c015f
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 5 deletions.
12 changes: 12 additions & 0 deletions src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,18 @@ pub struct Package {
/// Example: true
#[serde(default)]
pub private: bool,

/// URL of the package homepage.
///
/// Example: "https://github.com/sleitnick/knit"
#[serde(default)]
pub homepage: Option<String>,

/// URL of the package source repository.
///
/// Example: "https://github.com/Sleitnick/Knit.git"
#[serde(default)]
pub repository: Option<String>,
}

// Metadata we require when this manifest will be used to generate package folders
Expand Down
2 changes: 2 additions & 0 deletions src/test_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ impl PackageBuilder {
include: Vec::new(),
exclude: Vec::new(),
private: false,
homepage: None,
repository: None,
},
place: Default::default(),
dependencies: Default::default(),
Expand Down
6 changes: 6 additions & 0 deletions test-projects/manifestlinks/default.project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "minimal",
"tree": {
"$path": "src"
}
}
1 change: 1 addition & 0 deletions test-projects/manifestlinks/src/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
return "hey"
8 changes: 8 additions & 0 deletions test-projects/manifestlinks/wally.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "biff/minimal"
version = "0.1.0"
license = "MIT"
realm = "server"
registry = "test-registries/primary-registry"
repository = "https://github.com/UpliftGames/player-module.git"
homepage = "https://github.com/UpliftGames/player-module"
Binary file not shown.
1 change: 1 addition & 0 deletions test-registries/primary-registry/index/biff/manifestlinks
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"package":{"name":"biff/minimal","version":"0.1.0","registry":"test-registries/primary-registry","realm":"server","description":null,"license":"MIT","authors":[],"include":[],"exclude":[],"private":false,"homepage":"https://github.com/UpliftGames/player-module","repository":"https://github.com/UpliftGames/player-module.git"},"place":{"shared-packages":null,"server-packages":null},"dependencies":{},"server-dependencies":{},"dev-dependencies":{}}
6 changes: 2 additions & 4 deletions wally-registry-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 17 additions & 1 deletion wally-registry-frontend/src/pages/Package.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export default function Package() {
const packageMetadata = packageHistory?.find(
(item: WallyPackageMetadata) => item.package.version === packageVersion
)

console.log(packageMetadata)
if (packageMetadata == undefined) {
return (
<>
Expand Down Expand Up @@ -418,6 +418,22 @@ export default function Package() {
</MetaItem>
)} */}

{packageMetadata?.package.homepage && (
<MetaItem title="Homepage" width="full">
<a href={packageMetadata?.package.homepage}>
{packageMetadata?.package.homepage.replace("https://", "")}
</a>
</MetaItem>
)}

{packageMetadata?.package.repository && (
<MetaItem title="Repository" width="full">
<a href={packageMetadata?.package.repository.replace("https://", "")}>
{packageMetadata?.package.repository}
</a>
</MetaItem>
)}

{packageMetadata.package.authors.length > 0 && (
<MetaItem title="Authors" width="full">
{packageMetadata.package.authors.map((author) => (
Expand Down
2 changes: 2 additions & 0 deletions wally-registry-frontend/src/types/wally.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export interface WallyPackageMetadata {
realm: string
registry: string
version: string
homepage: string
repository: string
}

place: {
Expand Down

0 comments on commit 60c015f

Please sign in to comment.