Skip to content

Commit

Permalink
Update custom template docs
Browse files Browse the repository at this point in the history
  • Loading branch information
c12i committed Oct 28, 2024
1 parent 5d352af commit 5c7d20b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
28 changes: 12 additions & 16 deletions src/cli/custom-template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,20 @@ 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:<TODO:REPLACE_ME_WITH_THE_APPROPRIATE_GIT_URL>#hc-scaffold-custom-template -- web-app`
`nix run github:<TODO:REPLACE_ME_WITH_CUSTOM_TEMPLATE_GIT_URL>#app -- web-app`

2. If you already have an existing project, add the `<TODO:REPLACE_ME_WITH_THE_APPROPRIATE_GIT_URL>` 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 `<TODO:REPLACE_ME_WITH_CUSTOM_TEMPLATE_GIT_URL>` 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";
holonix.url = "github:holochain/holonix?ref=main";
nixpkgs.follows = "holonix/nixpkgs";
flake-parts.follows = "holonix/flake-parts";

holochain-flake.url = "github:holochain/holochain";
holochain-flake.inputs.versions.follows = "versions";

nixpkgs.follows = "holochain-flake/nixpkgs";
flake-parts.follows = "holochain-flake/flake-parts";

+ scaffolding.url = "github:<TODO:REPLACE_ME_WITH_THE_APPROPRIATE_GIT_URL>";
+ scaffolding.url = "github:<TODO:REPLACE_ME_WITH_CUSTOM_TEMPLATE_GIT_URL>";
};

outputs = inputs:
Expand All @@ -32,7 +28,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
Expand All @@ -41,17 +37,17 @@ 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
];
};
};
};
}
}
```

---
Expand All @@ -72,4 +68,4 @@ To run the tests for this custom template, simply run the `run_test.sh` script:

```bash
sh run_test.sh
```
```
17 changes: 13 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<TODO:REPLACE_ME_WITH_THE_APPROPRIATE_GIT_URL>` in its `README.md` file with the appropriate git URL (eg. "github:holochain-open-dev/templates").
//! 4. Replace all instances of `<TODO:REPLACE_ME_WITH_THE_APPROPRIATE_GIT_URL>` 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 `<TODO:REPLACE_ME_WITH_CUSTOM_TEMPLATE_GIT_URL>` in its `README.md` file with the appropriate git URL (eg. "github:holochain-open-dev/templates").
//! 4. Replace all instances of `<TODO:REPLACE_ME_WITH_CUSTOM_TEMPLATE_GIT_URL>` 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.
//!
Expand Down

0 comments on commit 5c7d20b

Please sign in to comment.