From 60c015f8eece6e064b219a5fac59c403664b7ac4 Mon Sep 17 00:00:00 2001 From: MobiusCraftFlip Date: Sun, 11 Jun 2023 09:27:10 +0100 Subject: [PATCH] implement homepage and repository links --- src/manifest.rs | 12 ++++++++++++ src/test_package.rs | 2 ++ .../manifestlinks/default.project.json | 6 ++++++ test-projects/manifestlinks/src/init.lua | 1 + test-projects/manifestlinks/wally.toml | 8 ++++++++ .../contents/biff/manifestlinks/0.1.0.zip | Bin 0 -> 162 bytes .../primary-registry/index/biff/manifestlinks | 1 + wally-registry-frontend/package-lock.json | 6 ++---- wally-registry-frontend/src/pages/Package.tsx | 18 +++++++++++++++++- wally-registry-frontend/src/types/wally.d.ts | 2 ++ 10 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 test-projects/manifestlinks/default.project.json create mode 100644 test-projects/manifestlinks/src/init.lua create mode 100644 test-projects/manifestlinks/wally.toml create mode 100644 test-registries/primary-registry/contents/biff/manifestlinks/0.1.0.zip create mode 100644 test-registries/primary-registry/index/biff/manifestlinks diff --git a/src/manifest.rs b/src/manifest.rs index fdd7d157..dc25085a 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -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, + + /// URL of the package source repository. + /// + /// Example: "https://github.com/Sleitnick/Knit.git" + #[serde(default)] + pub repository: Option, } // Metadata we require when this manifest will be used to generate package folders diff --git a/src/test_package.rs b/src/test_package.rs index 8929fa01..d7284d69 100644 --- a/src/test_package.rs +++ b/src/test_package.rs @@ -39,6 +39,8 @@ impl PackageBuilder { include: Vec::new(), exclude: Vec::new(), private: false, + homepage: None, + repository: None, }, place: Default::default(), dependencies: Default::default(), diff --git a/test-projects/manifestlinks/default.project.json b/test-projects/manifestlinks/default.project.json new file mode 100644 index 00000000..dd40fd97 --- /dev/null +++ b/test-projects/manifestlinks/default.project.json @@ -0,0 +1,6 @@ +{ + "name": "minimal", + "tree": { + "$path": "src" + } +} \ No newline at end of file diff --git a/test-projects/manifestlinks/src/init.lua b/test-projects/manifestlinks/src/init.lua new file mode 100644 index 00000000..f5407de7 --- /dev/null +++ b/test-projects/manifestlinks/src/init.lua @@ -0,0 +1 @@ +return "hey" \ No newline at end of file diff --git a/test-projects/manifestlinks/wally.toml b/test-projects/manifestlinks/wally.toml new file mode 100644 index 00000000..62ade855 --- /dev/null +++ b/test-projects/manifestlinks/wally.toml @@ -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" \ No newline at end of file diff --git a/test-registries/primary-registry/contents/biff/manifestlinks/0.1.0.zip b/test-registries/primary-registry/contents/biff/manifestlinks/0.1.0.zip new file mode 100644 index 0000000000000000000000000000000000000000..8c1eaa00a7fe8151a880e6fb61d92dadf09e5fcc GIT binary patch literal 162 zcmWIWW@h1H0D;C@m7v item.package.version === packageVersion ) - + console.log(packageMetadata) if (packageMetadata == undefined) { return ( <> @@ -418,6 +418,22 @@ export default function Package() { )} */} + {packageMetadata?.package.homepage && ( + + + {packageMetadata?.package.homepage.replace("https://", "")} + + + )} + + {packageMetadata?.package.repository && ( + + + {packageMetadata?.package.repository} + + + )} + {packageMetadata.package.authors.length > 0 && ( {packageMetadata.package.authors.map((author) => ( diff --git a/wally-registry-frontend/src/types/wally.d.ts b/wally-registry-frontend/src/types/wally.d.ts index ee65c196..0e089103 100644 --- a/wally-registry-frontend/src/types/wally.d.ts +++ b/wally-registry-frontend/src/types/wally.d.ts @@ -14,6 +14,8 @@ export interface WallyPackageMetadata { realm: string registry: string version: string + homepage: string + repository: string } place: {