This week, I released version 1.0.1 of rost_gen, a simple static site generator built using rust. I had kind of forgotten about versions for a while, but the project had advanced enough for a v1 release. Since I had used rust, the appropriate place for a release was crates.io.
Since my project is supposed to run on its own, I also considered creating binaries for different operating systems and hosting them somewhere. However, I decided against it since it would be better to start with crates.io and get used to the process. First, I had to log in to crates.io and verify my email address. This gave me access to an API token which I had to use for authentication after running the
cargo login command.
After finishing the setup, I started out by adding some metadata to the
Cargo.toml file following this awesome guide. This included fields like description, readme, repository, license, etc:
[package] ... description = "A simple static site generator" readme = "README.md" repository = "https://github.com/Eakam1007/rost_gen" license = "MIT" keywords = ["ssg"] categories = ["command-line-utilities"]
After committing the changes, I ran
cargo package --list and noticed that some unnecessary files such as some test documents and vscode configuration files were also being included. So, I added an array of excluded files in the configuration:
[package] ... exclude = [ "docs/*", ".vscode/*", ".gitignore", "rustfmt.toml", ".github/*" ]
Then I ran the
cargo publish command and v1.0.0 of my crate was successfully published. Now, I had to modify the readme file, specifically the installation instructions, so it would be possible to install the crate from crates.io instead of needing to clone the github repo. I found out that for binaries, i.e., programs that are meant to run on their own,
cargo install <name_of_crate> can be used. However, this installs the binary in the
~/.cargo/bin directory. After looking up the documentation for cargo install and some testing, I found that the installation directory could be specified as follows:
cargo install rost_gen --root ./install_here
This would result in a compiled binary inside the ./install_here/bin folder. Thus, it was now possible to simply run this command, navigate to the bin/ directory and run the ssg:
After some additional testing to confirm that everything was working as intended, I updated the readme file and published an updated v1.0.1 of the crate. I requested some help with testing and my testing partner was able to follow the new instructions to successfully install and use the tool on their machine.
However, the installation part took quite a bit longer than I had expected. From what I could observe, some of the dependencies being used in the project are quite large. I would need to investigate this to confirm if this is the case and if some of them can be removed/substituted to make the build process quicker.
Oldest comments (0)