From 05bbdad5709cf0aa9c61709724cdb56069f95ade Mon Sep 17 00:00:00 2001 From: Collins Muriuki Date: Mon, 28 Oct 2024 17:34:37 +0300 Subject: [PATCH] Update custom template docs --- src/cli/custom-template/README.md | 32 +++++++++++++++---------------- src/lib.rs | 17 ++++++++++++---- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/cli/custom-template/README.md b/src/cli/custom-template/README.md index f10265231..e5ff89cc3 100644 --- a/src/cli/custom-template/README.md +++ b/src/cli/custom-template/README.md @@ -6,24 +6,22 @@ Custom template for the [scaffolding tool](https://github.com/holochain/scaffold 1. To scaffold a new project with this template, run this: -`nix run github:#hc-scaffold-custom-template -- web-app` +```bash +nix run github:#app -- web-app +``` -2. If you already have an existing project, add the `` repository as input to your flake, and use it in the packages or your `devShell`: +2. If you already have an existing project, add the `` repository as input to your flake, and use it in the packages or your `devShell`: ```diff { - description = "Template for Holochain app development"; + description = "Flake for Holochain app development"; inputs = { - versions.url = "github:holochain/holochain?dir=versions/weekly"; - - holochain-flake.url = "github:holochain/holochain"; - holochain-flake.inputs.versions.follows = "versions"; - - nixpkgs.follows = "holochain-flake/nixpkgs"; - flake-parts.follows = "holochain-flake/flake-parts"; + holonix.url = "github:holochain/holonix?ref=main"; + nixpkgs.follows = "holonix/nixpkgs"; + flake-parts.follows = "holonix/flake-parts"; -+ scaffolding.url = "github:"; ++ scaffolding.url = "github:"; }; outputs = inputs: @@ -32,7 +30,7 @@ Custom template for the [scaffolding tool](https://github.com/holochain/scaffold inherit inputs; } { - systems = builtins.attrNames inputs.holochain-flake.devShells; + systems = builtins.attrNames inputs.holonix.devShells; perSystem = { inputs' , config @@ -41,24 +39,24 @@ Custom template for the [scaffolding tool](https://github.com/holochain/scaffold , ... }: { devShells.default = pkgs.mkShell { - inputsFrom = [ inputs'.holochain-flake.devShells.holonix ]; + inputsFrom = [ inputs'.holonix.devShells.default ]; packages = [ pkgs.nodejs_20 # more packages go here + ] ++ [ -+ inputs'.scaffolding.packages.hc-scaffold-custom-template ++ inputs'.scaffolding.packages.app ]; }; }; }; -} +} ``` --- After this set up, you will be able to `nix develop` from inside your repository, and use the scaffolding tool as normal: -``` +```bash hc scaffold dna hc scaffold zome ... @@ -72,4 +70,4 @@ To run the tests for this custom template, simply run the `run_test.sh` script: ```bash sh run_test.sh -``` +``` diff --git a/src/lib.rs b/src/lib.rs index a4cd6e8a1..5ef6a0a73 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -97,10 +97,19 @@ //! To create a custom template, execute these steps: //! //! 1. Run this command: -//! `nix flake init -t github:holochain/scaffolding` -//! 2. A new dir `custom-template` will be created in the current directory. Check this new folder in a version control system like git. -//! 3. Replace all instances of `` in its `README.md` file with the appropriate git URL (eg. "github:holochain-open-dev/templates"). -//! 4. Replace all instances of `` in its `template/web-app/flake.nix.hbs` file with the appropriate git URL (eg. "github:holochain-open-dev/templates"). +//! - Through holonix: +//! +//! ```bash +//! nix run github:holochain/holonix#hc-scaffold -- template new +//! ``` +//! - Outside holonix if the cli was installed via `cargo install holochain_scaffolding_cli` +//! +//! ```bash +//! hc-scaffold template new +//! ``` +//! 2. A new dir will be created in the current directory. Check this new folder in a version control system like git. +//! 3. Replace all instances of `` in its `README.md` file with the appropriate git URL (eg. "github:holochain-open-dev/templates"). +//! 4. Replace all instances of `` in its `template/web-app/flake.nix.hbs` file with the appropriate git URL (eg. "github:holochain-open-dev/templates"). //! //! That's it! At this point you will have a correctly functioning custom template repository with tests, a `README.md` documenting how to use it, and a `template` folder. That's where your custom template lives. //!