gnolang / hackerspace

Tinker, build, explore Gno - without the monorepo!
11 stars 8 forks source link

Utilize `gno get` Command and Create Gno Package Center #60

Open notJoon opened 8 months ago

notJoon commented 8 months ago

In our current project (like gnoswap), when a package is needed, we handle it by directly implementing it in the p/demo directory of the forked Gno repository. This approach requires uploading all packages to the repository, resulting in a significant increase in the size of the repository. Additionally, it has been problematic having to run make install every time we use each repository.

To solve these issues, I propose introducing a gno get command, similar to the package management approach of the Go language. By inputting the address of the package (for example: github.com/xxx/xxx), it automatically adds and manages the dependencies. The specific method is as follows:

  1. Once the package information is recognized, update the gno.mod file to determine the correct version of the package and record a checksum to ensure its integrity (we consider creating a separate file like go.sum or Rust's Cargo.lock that stores only the checksum). At this stage, the package is not downloaded, only recorded.

  2. When building or testing the project, the gno.mod file is checked to identify the necessary dependencies. Packages are downloaded and compiled only if necessary. The downloaded packages are stored in Gno's module cache and can be placed in an arbitrary directory such as $GNOPATH/pkg/mod.