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

implement homepage and repository links #180

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Dekkonot marked this conversation as resolved.
Show resolved Hide resolved
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
Loading