From 21387f7c10e00a07b3c6261f496579989352da7e Mon Sep 17 00:00:00 2001 From: Collins Muriuki Date: Wed, 30 Oct 2024 12:47:19 +0300 Subject: [PATCH] feat: Enhance custom template generation (#404) * feat: Add a new template subcommand to create new custom template bases from existing templates * Remove call to wrapCustoTemplate in scaffolding nix flake * Update custom template docs --- flake.nix | 12 +- .../cli}/custom-template/README.md | 32 +- .../cli}/custom-template/flake.nix | 0 .../cli}/custom-template/run_test.sh | 0 src/cli/template.rs | 67 +++-- src/lib.rs | 17 +- .../template/collection.instructions.hbs | 2 - ...{{kebab_case collection_name}}.test.ts.hbs | 77 ----- .../{{kebab_case collection_name}}.ts.hbs | 80 ----- .../{{zome_manifest.name}}/common.ts.hbs | 2 - .../{{zome_manifest.name}}/types.ts.hbs | 38 --- .../common.ts.hbs | 52 ---- ...{{kebab_case entry_type.name}}.test.ts.hbs | 279 ------------------ ...eate-{{kebab_case entry_type.name}}.ts.hbs | 131 -------- .../types.ts.hbs | 7 - ...me}}.ts{{\302\241if}}{{\302\241each}}.hbs" | 72 ----- ...se entry_type.name}}.ts{{\302\241if}}.hbs" | 160 ---------- ...kebab_case entry_type.name}}-detail.ts.hbs | 137 --------- .../template/example.instructions.hbs | 10 - .../example/ui/src/holochain-app.ts.hbs | 43 --- .../field-types/ActionHash/sample.hbs | 1 - .../template/field-types/ActionHash/type.hbs | 1 - .../field-types/AgentPubKey/sample.hbs | 1 - .../template/field-types/AgentPubKey/type.hbs | 1 - .../template/field-types/DnaHash/sample.hbs | 1 - .../template/field-types/DnaHash/type.hbs | 1 - .../template/field-types/EntryHash/sample.hbs | 1 - .../template/field-types/EntryHash/type.hbs | 1 - .../field-types/Enum/Select/detail/render.hbs | 1 - .../field-types/Enum/Select/edit/render.hbs | 8 - .../field-types/Enum/Select/initial-value.hbs | 1 - .../field-types/Enum/Select/is-valid.hbs | 1 - .../template/field-types/Enum/default.hbs | 1 - .../template/field-types/Enum/sample.hbs | 1 - .../template/field-types/Enum/type.hbs | 1 - .../String/TextArea/detail/render.hbs | 1 - .../String/TextArea/edit/render.hbs | 11 - .../String/TextArea/initial-value.hbs | 1 - .../field-types/String/TextArea/is-valid.hbs | 1 - .../String/TextField/detail/render.hbs | 1 - .../String/TextField/edit/render.hbs | 11 - .../String/TextField/initial-value.hbs | 1 - .../field-types/String/TextField/is-valid.hbs | 1 - .../template/field-types/String/default.hbs | 1 - .../template/field-types/String/sample.hbs | 1 - .../template/field-types/String/type.hbs | 1 - .../DateTimePicker/detail/render.hbs | 1 - .../Timestamp/DateTimePicker/edit/render.hbs | 12 - .../DateTimePicker/initial-value.hbs | 1 - .../Timestamp/DateTimePicker/is-valid.hbs | 1 - .../field-types/Timestamp/default.hbs | 1 - .../template/field-types/Timestamp/sample.hbs | 1 - .../template/field-types/Timestamp/type.hbs | 1 - .../template/field-types/Vec/default.hbs | 1 - .../template/field-types/Vec/sample.hbs | 1 - .../template/field-types/Vec/type.hbs | 1 - .../bool/Checkbox/detail/render.hbs | 1 - .../field-types/bool/Checkbox/edit/render.hbs | 7 - .../bool/Checkbox/initial-value.hbs | 1 - .../field-types/bool/Checkbox/is-valid.hbs | 1 - .../template/field-types/bool/default.hbs | 1 - .../template/field-types/bool/sample.hbs | 1 - .../template/field-types/bool/type.hbs | 1 - .../field-types/f32/Slider/detail/render.hbs | 1 - .../field-types/f32/Slider/edit/render.hbs | 8 - .../field-types/f32/Slider/initial-value.hbs | 1 - .../field-types/f32/Slider/is-valid.hbs | 1 - .../template/field-types/f32/default.hbs | 1 - .../template/field-types/f32/sample.hbs | 1 - .../template/field-types/f32/type.hbs | 1 - .../field-types/i32/Slider/detail/render.hbs | 1 - .../field-types/i32/Slider/edit/render.hbs | 7 - .../field-types/i32/Slider/initial-value.hbs | 1 - .../field-types/i32/Slider/is-valid.hbs | 1 - .../template/field-types/i32/default.hbs | 1 - .../template/field-types/i32/sample.hbs | 1 - .../template/field-types/i32/type.hbs | 1 - .../field-types/u32/Slider/detail/render.hbs | 1 - .../field-types/u32/Slider/edit/render.hbs | 8 - .../field-types/u32/Slider/initial-value.hbs | 1 - .../field-types/u32/Slider/is-valid.hbs | 1 - .../template/field-types/u32/default.hbs | 1 - .../template/field-types/u32/sample.hbs | 1 - .../template/field-types/u32/type.hbs | 1 - ...nceable.name)}}.test.ts{{\302\241if}}.hbs" | 157 ---------- ...referenceable.name}}.ts{{\302\241if}}.hbs" | 71 ----- ...referenceable.name}}.ts{{\302\241if}}.hbs" | 71 ----- .../web-app/.github/workflows/test.yaml.hbs | 25 -- .../template/web-app/README.md.hbs | 59 ---- .../template/web-app/package.json.hbs | 40 --- .../template/web-app/tests/package.json.hbs | 16 - .../template/web-app/tests/tsconfig.json.hbs | 9 - .../web-app/tests/vitest.config.ts.hbs | 8 - .../template/web-app/ui/.gitignore.hbs | 25 -- .../template/web-app/ui/index.html.hbs | 17 -- .../template/web-app/ui/package.json.hbs | 74 ----- .../ui/src/assets/holochainLogo.svg.hbs | 45 --- .../template/web-app/ui/src/contexts.ts.hbs | 4 - .../web-app/ui/src/declarations.d.ts.hbs | 9 - .../web-app/ui/src/holochain-app.ts.hbs | 125 -------- .../template/web-app/ui/src/index.css.hbs | 261 ---------------- .../web-app/ui/src/shared-styles.ts.hbs | 4 - .../template/web-app/ui/tsconfig.json.hbs | 24 -- .../template/web-app/ui/vite.config.ts.hbs | 13 - 104 files changed, 72 insertions(+), 2331 deletions(-) rename {templates/custom-template => src/cli}/custom-template/README.md (60%) rename {templates/custom-template => src/cli}/custom-template/flake.nix (100%) rename {templates/custom-template => src/cli}/custom-template/run_test.sh (100%) delete mode 100644 templates/custom-template/custom-template/template/collection.instructions.hbs delete mode 100644 templates/custom-template/custom-template/template/collection/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case collection_name}}.test.ts.hbs delete mode 100644 templates/custom-template/custom-template/template/collection/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case collection_name}}.ts.hbs delete mode 100644 templates/custom-template/custom-template/template/coordinator-zome/tests/src/{{dna_role_name}}/{{zome_manifest.name}}/common.ts.hbs delete mode 100644 templates/custom-template/custom-template/template/coordinator-zome/ui/src/{{dna_role_name}}/{{zome_manifest.name}}/types.ts.hbs delete mode 100644 templates/custom-template/custom-template/template/entry-type/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/common.ts.hbs delete mode 100644 templates/custom-template/custom-template/template/entry-type/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case entry_type.name}}.test.ts.hbs delete mode 100644 templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/create-{{kebab_case entry_type.name}}.ts.hbs delete mode 100644 templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/types.ts.hbs delete mode 100644 "templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#each entry_type.fields}}{{#if (and linked_from (not (eq linked_from.hash_type 'AgentPubKey') ) )}}{{kebab_case (plural ..\302\241entry_type.name)}}-for-{{kebab_case linked_from.name}}.ts{{\302\241if}}{{\302\241each}}.hbs" delete mode 100644 "templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#if crud.update}}edit-{{kebab_case entry_type.name}}.ts{{\302\241if}}.hbs" delete mode 100644 templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case entry_type.name}}-detail.ts.hbs delete mode 100644 templates/custom-template/custom-template/template/example.instructions.hbs delete mode 100644 templates/custom-template/custom-template/template/example/ui/src/holochain-app.ts.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/ActionHash/sample.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/ActionHash/type.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/AgentPubKey/sample.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/AgentPubKey/type.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/DnaHash/sample.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/DnaHash/type.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/EntryHash/sample.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/EntryHash/type.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/Enum/Select/detail/render.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/Enum/Select/edit/render.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/Enum/Select/initial-value.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/Enum/Select/is-valid.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/Enum/default.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/Enum/sample.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/Enum/type.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/String/TextArea/detail/render.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/String/TextArea/edit/render.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/String/TextArea/initial-value.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/String/TextArea/is-valid.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/String/TextField/detail/render.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/String/TextField/edit/render.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/String/TextField/initial-value.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/String/TextField/is-valid.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/String/default.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/String/sample.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/String/type.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/Timestamp/DateTimePicker/detail/render.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/Timestamp/DateTimePicker/edit/render.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/Timestamp/DateTimePicker/initial-value.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/Timestamp/DateTimePicker/is-valid.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/Timestamp/default.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/Timestamp/sample.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/Timestamp/type.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/Vec/default.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/Vec/sample.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/Vec/type.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/bool/Checkbox/detail/render.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/bool/Checkbox/edit/render.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/bool/Checkbox/initial-value.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/bool/Checkbox/is-valid.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/bool/default.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/bool/sample.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/bool/type.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/f32/Slider/detail/render.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/f32/Slider/edit/render.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/f32/Slider/initial-value.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/f32/Slider/is-valid.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/f32/default.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/f32/sample.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/f32/type.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/i32/Slider/detail/render.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/i32/Slider/edit/render.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/i32/Slider/initial-value.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/i32/Slider/is-valid.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/i32/default.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/i32/sample.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/i32/type.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/u32/Slider/detail/render.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/u32/Slider/edit/render.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/u32/Slider/initial-value.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/u32/Slider/is-valid.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/u32/default.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/u32/sample.hbs delete mode 100644 templates/custom-template/custom-template/template/field-types/u32/type.hbs delete mode 100644 "templates/custom-template/custom-template/template/link-type/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#if to_referenceable}}{{kebab_case from_referenceable.name}}-to-{{kebab_case (plural to_referenceable.name)}}.test.ts{{\302\241if}}.hbs" delete mode 100644 "templates/custom-template/custom-template/template/link-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#if (and bidireccional (and to_referenceable (ne from_referenceable.hash_type 'AgentPubKey')))}}{{kebab_case (plural from_referenceable.name)}}-for-{{kebab_case to_referenceable.name}}.ts{{\302\241if}}.hbs" delete mode 100644 "templates/custom-template/custom-template/template/link-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#if (and to_referenceable (ne to_referenceable.hash_type 'AgentPubKey'))}}{{kebab_case (plural to_referenceable.name)}}-for-{{kebab_case from_referenceable.name}}.ts{{\302\241if}}.hbs" delete mode 100644 templates/custom-template/custom-template/template/web-app/.github/workflows/test.yaml.hbs delete mode 100644 templates/custom-template/custom-template/template/web-app/README.md.hbs delete mode 100644 templates/custom-template/custom-template/template/web-app/package.json.hbs delete mode 100644 templates/custom-template/custom-template/template/web-app/tests/package.json.hbs delete mode 100644 templates/custom-template/custom-template/template/web-app/tests/tsconfig.json.hbs delete mode 100644 templates/custom-template/custom-template/template/web-app/tests/vitest.config.ts.hbs delete mode 100644 templates/custom-template/custom-template/template/web-app/ui/.gitignore.hbs delete mode 100644 templates/custom-template/custom-template/template/web-app/ui/index.html.hbs delete mode 100644 templates/custom-template/custom-template/template/web-app/ui/package.json.hbs delete mode 100644 templates/custom-template/custom-template/template/web-app/ui/src/assets/holochainLogo.svg.hbs delete mode 100644 templates/custom-template/custom-template/template/web-app/ui/src/contexts.ts.hbs delete mode 100644 templates/custom-template/custom-template/template/web-app/ui/src/declarations.d.ts.hbs delete mode 100644 templates/custom-template/custom-template/template/web-app/ui/src/holochain-app.ts.hbs delete mode 100644 templates/custom-template/custom-template/template/web-app/ui/src/index.css.hbs delete mode 100644 templates/custom-template/custom-template/template/web-app/ui/src/shared-styles.ts.hbs delete mode 100644 templates/custom-template/custom-template/template/web-app/ui/tsconfig.json.hbs delete mode 100644 templates/custom-template/custom-template/template/web-app/ui/vite.config.ts.hbs diff --git a/flake.nix b/flake.nix index eaf7f6be6..92a3d66ec 100644 --- a/flake.nix +++ b/flake.nix @@ -28,11 +28,6 @@ flake-parts.lib.mkFlake { inherit inputs; } rec { flake = { - templates.default = { - path = ./templates/custom-template; - description = "Custom template for the scaffolding tool"; - }; - lib.wrapCustomTemplate = { system, pkgs, customTemplatePath }: let scaffolding = inputs.holonix.packages.${system}.hc-scaffold; @@ -70,7 +65,7 @@ # source filtering to ensure builds using include_str! or include_bytes! succeed # https://crane.dev/faq/building-with-non-rust-includes.html - nonCargoBuildFiles = path: _type: builtins.match ".*(gitignore|md|hbs)$" path != null; + nonCargoBuildFiles = path: _type: builtins.match ".*(gitignore|md|hbs|nix|sh)$" path != null; includeFilesFilter = path: type: (craneLib.filterCargoSources path type) || (nonCargoBuildFiles path type); in @@ -95,11 +90,6 @@ nativeBuildInputs = [ pkgs.perl ]; }; - checks.custom-template = flake.lib.wrapCustomTemplate { - inherit pkgs system; - customTemplatePath = ./templates/custom-template/custom-template; - }; - devShells.default = pkgs.mkShell { packages = (with inputs'.holonix.packages; [ holochain diff --git a/templates/custom-template/custom-template/README.md b/src/cli/custom-template/README.md similarity index 60% rename from templates/custom-template/custom-template/README.md rename to src/cli/custom-template/README.md index f10265231..e5ff89cc3 100644 --- a/templates/custom-template/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/templates/custom-template/custom-template/flake.nix b/src/cli/custom-template/flake.nix similarity index 100% rename from templates/custom-template/custom-template/flake.nix rename to src/cli/custom-template/flake.nix diff --git a/templates/custom-template/custom-template/run_test.sh b/src/cli/custom-template/run_test.sh similarity index 100% rename from templates/custom-template/custom-template/run_test.sh rename to src/cli/custom-template/run_test.sh diff --git a/src/cli/template.rs b/src/cli/template.rs index d2c9f0e27..f9318efcc 100644 --- a/src/cli/template.rs +++ b/src/cli/template.rs @@ -1,15 +1,16 @@ use std::{ffi::OsString, path::PathBuf}; -use build_fs_tree::{dir, Build, MergeableFileSystemTree}; -use dialoguer::{theme::ColorfulTheme, Input}; +use build_fs_tree::{dir, file, Build, MergeableFileSystemTree}; use structopt::StructOpt; -use crate::scaffold::web_app::template_type::TemplateType; +use crate::{scaffold::web_app::template_type::TemplateType, utils::input_with_case}; #[derive(Debug, StructOpt)] #[structopt(setting = structopt::clap::AppSettings::InferSubcommands)] /// Manage custom templates pub enum Template { + /// Create a new template from an existing scaffolding template + New, /// Clone the template in use into a new custom template Clone { #[structopt(long)] @@ -20,14 +21,44 @@ pub enum Template { impl Template { pub fn run(self, template_type: &TemplateType) -> anyhow::Result<()> { - let target_template = match self.target_template() { + match self { + Template::New => Template::new_template(template_type), + Template::Clone { to_template } => Template::clone_template(to_template, template_type), + } + } + + fn new_template(from_template: &TemplateType) -> anyhow::Result<()> { + let name = input_with_case( + "Enter new template name (kebab-case):", + Some(&from_template.name()), + convert_case::Case::Kebab, + )?; + + let template_file_tree = dir! { + name.clone() => dir!{ + "template" => from_template.file_tree()?, + "README.md" => file!(include_str!("custom-template/README.md")), + "flake.nix" => file!(include_str!("custom-template/flake.nix")), + "run_test.sh" => file!(include_str!("custom-template/run_test.sh")) + }, + }; + + let file_tree = MergeableFileSystemTree::::from(template_file_tree); + + file_tree.build(&PathBuf::from("."))?; + + println!(r#"Template initialized in path: ./{} "#, name); + + Ok(()) + } + + fn clone_template( + to_template: Option, + template_type: &TemplateType, + ) -> anyhow::Result<()> { + let target_template = match to_template { Some(t) => t, - None => { - // Enter template name - Input::with_theme(&ColorfulTheme::default()) - .with_prompt("Enter new template name:") - .interact()? - } + None => input_with_case("Enter new template name:", None, convert_case::Case::Kebab)?, }; let template_file_tree = dir! { @@ -38,20 +69,8 @@ impl Template { file_tree.build(&PathBuf::from("."))?; - match self { - Template::Clone { .. } => { - println!(r#"Template initialized to folder {:?} "#, target_template); - } - } - Ok(()) - } + println!(r#"Template initialized in path: ./{} "#, target_template); - pub fn target_template(&self) -> Option { - match self { - Template::Clone { - to_template: target_template, - .. - } => target_template.clone(), - } + Ok(()) } } 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. //! diff --git a/templates/custom-template/custom-template/template/collection.instructions.hbs b/templates/custom-template/custom-template/template/collection.instructions.hbs deleted file mode 100644 index 51ad54b6f..000000000 --- a/templates/custom-template/custom-template/template/collection.instructions.hbs +++ /dev/null @@ -1,2 +0,0 @@ -If you want the newly scaffolded collection's component to be the entry point for its UI, import the -generated <{{kebab_case collection_name}}> component. \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/collection/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case collection_name}}.test.ts.hbs b/templates/custom-template/custom-template/template/collection/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case collection_name}}.test.ts.hbs deleted file mode 100644 index 7694dcbda..000000000 --- a/templates/custom-template/custom-template/template/collection/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case collection_name}}.test.ts.hbs +++ /dev/null @@ -1,77 +0,0 @@ -import { assert, test } from "vitest"; - -import { runScenario, dhtSync, CallableCell } from '@holochain/tryorama'; -import { - NewEntryAction, - ActionHash, - Record, - Link, - AppBundleSource, - fakeActionHash, - fakeAgentPubKey, - fakeEntryHash -} from '@holochain/client'; -import { decode } from '@msgpack/msgpack'; - -import { create{{pascal_case referenceable.name}} } from './common.js'; - -test('create a {{pascal_case referenceable.name}} and get {{lower_case collection_name}}', async () => { - await runScenario(async scenario => { - // Construct proper paths for your app. - // This assumes app bundle created by the `hc app pack` command. - const testAppPath = process.cwd() + '/../workdir/{{app_name}}.happ'; - - // Set up the app to be installed - const appSource = { appBundleSource: { path: testAppPath } }; - - // Add 2 players with the test app to the Scenario. The returned players - // can be destructured. - const [alice, bob] = await scenario.addPlayersWithApps([appSource, appSource]); - - // Shortcut peer discovery through gossip and register all agents in every - // conductor of the scenario. - await scenario.shareAllAgents(); - - // Bob gets {{lower_case collection_name}} - let collectionOutput: Link[] = await bob.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "get_{{snake_case collection_name}}", - payload: {{#if (eq collection_type.type "Global")}}null{{else}}alice.agentPubKey{{/if}} - }); - assert.equal(collectionOutput.length, 0); - - // Alice creates a {{pascal_case referenceable.name}} - const createRecord: Record = await create{{pascal_case referenceable.name}}(alice.cells[0]); - assert.ok(createRecord); - - await dhtSync([alice, bob], alice.cells[0].cell_id[0]); - - // Bob gets {{lower_case collection_name}} again - collectionOutput = await bob.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "get_{{snake_case collection_name}}", - payload: {{#if (eq collection_type.type "Global")}}null{{else}}alice.agentPubKey{{/if}} - }); - assert.equal(collectionOutput.length, 1); - assert.deepEqual({{#if (eq referenceable.hash_type "EntryHash")}}(createRecord.signed_action.hashed.content as NewEntryAction).entry_hash{{else}}createRecord.signed_action.hashed.hash{{/if}}, collectionOutput[0].target); -{{#if (and deletable (eq referenceable.hash_type "ActionHash"))}} - - // Alice deletes the {{pascal_case referenceable.name}} - await alice.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "delete_{{snake_case referenceable.name}}", - payload: createRecord.signed_action.hashed.hash - }); - - await dhtSync([alice, bob], alice.cells[0].cell_id[0]); - - // Bob gets {{lower_case collection_name}} again - collectionOutput = await bob.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "get_{{snake_case collection_name}}", - payload: {{#if (eq collection_type.type "Global")}}null{{else}}alice.agentPubKey{{/if}} - }); - assert.equal(collectionOutput.length, 0); -{{/if}} - }); -}); diff --git a/templates/custom-template/custom-template/template/collection/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case collection_name}}.ts.hbs b/templates/custom-template/custom-template/template/collection/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case collection_name}}.ts.hbs deleted file mode 100644 index 8a7a87967..000000000 --- a/templates/custom-template/custom-template/template/collection/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case collection_name}}.ts.hbs +++ /dev/null @@ -1,80 +0,0 @@ -import { LitElement, html } from 'lit'; -import { state, customElement, property } from 'lit/decorators.js'; -import { AppClient, AgentPubKey, Link, EntryHash, ActionHash, Record, NewEntryAction, SignalType } from '@holochain/client'; -import { consume } from '@lit-labs/context'; -import { Task } from '@lit-labs/task'; - -import { sharedStyles } from '../../shared-styles'; -import { clientContext } from '../../contexts'; -import { {{pascal_case coordinator_zome_manifest.name}}Signal } from './types'; - -import './{{kebab_case referenceable.name}}-detail'; - -@customElement('{{kebab_case collection_name}}') -export class {{pascal_case collection_name}} extends LitElement { - @consume({ context: clientContext }) - client!: AppClient; - -{{#if (eq collection_type.type "ByAuthor")}} - @property({ - hasChanged: (newVal: AgentPubKey, oldVal: AgentPubKey) => newVal?.toString() !== oldVal?.toString() - }) - author!: AgentPubKey; -{{/if}} - - @state() - signaledHashes: Array<{{referenceable.hash_type}}> = []; - - _fetch{{pascal_case (plural referenceable.name)}} = new Task(this, ([{{#if (eq collection_type.type "ByAuthor")}}author{{/if}}]: any) => this.client.callZome({ - cap_secret: null, - role_name: '{{dna_role_name}}', - zome_name: '{{coordinator_zome_manifest.name}}', - fn_name: 'get_{{snake_case collection_name}}', - payload: {{#if (eq collection_type.type "ByAuthor")}}author{{else}}null{{/if}}, - }) as Promise>, () => [{{#if (eq collection_type.type "ByAuthor")}}this.author{{/if}}]); - - firstUpdated() { -{{#if (eq collection_type.type "ByAuthor")}} - if (!this.author) { - throw new Error(`The author property is required for the {{kebab_case collection_name}} element`); - } -{{/if}} - - this.client?.on('signal', signal => { - if (!(SignalType.App in signal)) return; - if (signal.App.zome_name !== '{{coordinator_zome_manifest.name}}') return; - const payload = signal.App.payload as {{pascal_case coordinator_zome_manifest.name}}Signal; - if (payload.type !== 'EntryCreated') return; - if (payload.app_entry.type !== '{{pascal_case referenceable.name}}') return; -{{#if (eq collection_type.type "ByAuthor")}} - if (this.author.toString() !== this.client.myPubKey.toString()) return; -{{/if}} - this.signaledHashes = [{{#if (eq referenceable.hash_type "ActionHash")}}payload.action.hashed.hash{{else}}(payload.action.hashed.content as NewEntryAction).entry_hash{{/if}}, ...this.signaledHashes]; - }); - } - - renderList(hashes: Array<{{referenceable.hash_type}}>) { - if (!hashes.length) return html`
No {{lower_case (plural referenceable.name)}} found{{#if (eq collection_type.type "ByAuthor")}} for this author{{/if}}.
`; - - return html` -
- ${hashes.map(hash => html` - <{{kebab_case referenceable.name}}-detail - .{{camel_case referenceable.name}}Hash=${hash} - @{{kebab_case referenceable.name}}-deleted=${() => { this._fetch{{pascal_case (plural referenceable.name)}}.run(); this.signaledHashes = []; } } - > - `)} -
- `; - } - - render() { - return this._fetch{{pascal_case (plural referenceable.name)}}.render({ - pending: () => html``, - complete: (links) => this.renderList([...this.signaledHashes, ...links.map(l => l.target)]), - error: (e: any) => html`
Error fetching the {{lower_case (plural referenceable.name)}}: ${e.message}.
` - }); - } - - static styles = sharedStyles; -} diff --git a/templates/custom-template/custom-template/template/coordinator-zome/tests/src/{{dna_role_name}}/{{zome_manifest.name}}/common.ts.hbs b/templates/custom-template/custom-template/template/coordinator-zome/tests/src/{{dna_role_name}}/{{zome_manifest.name}}/common.ts.hbs deleted file mode 100644 index 04f613ed8..000000000 --- a/templates/custom-template/custom-template/template/coordinator-zome/tests/src/{{dna_role_name}}/{{zome_manifest.name}}/common.ts.hbs +++ /dev/null @@ -1,2 +0,0 @@ -import { CallableCell } from '@holochain/tryorama'; -import { NewEntryAction, ActionHash, Record, AppBundleSource, fakeActionHash, fakeAgentPubKey, fakeEntryHash, fakeDnaHash } from '@holochain/client'; diff --git a/templates/custom-template/custom-template/template/coordinator-zome/ui/src/{{dna_role_name}}/{{zome_manifest.name}}/types.ts.hbs b/templates/custom-template/custom-template/template/coordinator-zome/ui/src/{{dna_role_name}}/{{zome_manifest.name}}/types.ts.hbs deleted file mode 100644 index 1781515ec..000000000 --- a/templates/custom-template/custom-template/template/coordinator-zome/ui/src/{{dna_role_name}}/{{zome_manifest.name}}/types.ts.hbs +++ /dev/null @@ -1,38 +0,0 @@ -import { - Record, - ActionHash, - DnaHash, - SignedActionHashed, - EntryHash, - AgentPubKey, - Create, - Update, - Delete, - CreateLink, - DeleteLink -} from '@holochain/client'; - -export type {{pascal_case zome_manifest.name}}Signal = { - type: 'EntryCreated'; - action: SignedActionHashed; - app_entry: EntryTypes; -} | { - type: 'EntryUpdated'; - action: SignedActionHashed; - app_entry: EntryTypes; - original_app_entry: EntryTypes; -} | { - type: 'EntryDeleted'; - action: SignedActionHashed; - original_app_entry: EntryTypes; -} | { - type: 'LinkCreated'; - action: SignedActionHashed; - link_type: string; -} | { - type: 'LinkDeleted'; - action: SignedActionHashed; - link_type: string; -}; - -export type EntryTypes = {}; diff --git a/templates/custom-template/custom-template/template/entry-type/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/common.ts.hbs b/templates/custom-template/custom-template/template/entry-type/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/common.ts.hbs deleted file mode 100644 index 404534844..000000000 --- a/templates/custom-template/custom-template/template/entry-type/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/common.ts.hbs +++ /dev/null @@ -1,52 +0,0 @@ -{{previous_file_content}} - -export async function sample{{pascal_case entry_type.name}}(cell: CallableCell, partial{{pascal_case entry_type.name}} = {}) { - return { - ...{ -{{#each entry_type.fields}} - {{#if linked_from}} - {{#if (ne linked_from.hash_type "AgentPubKey")}} - {{#if (eq cardinality "vector")}} - {{#if (eq (pascal_case linked_from.name) (pascal_case ../entry_type.name))}} - {{field_name}}: [], - {{else}} - {{#if (eq linked_from.hash_type "ActionHash")}} - {{field_name}}: [(await create{{pascal_case linked_from.name}}(cell)).signed_action.hashed.hash], - {{else}} - {{field_name}}: [((await create{{pascal_case linked_from.name}}(cell)).signed_action.hashed.content as NewEntryAction).entry_hash], - {{/if}} - {{/if}} - {{else}} - {{#if (eq (pascal_case linked_from.name) (pascal_case ../entry_type.name))}} - {{field_name}}: null, - {{else}} - {{#if (eq linked_from.hash_type "ActionHash")}} - {{field_name}}: (await create{{pascal_case linked_from.name}}(cell)).signed_action.hashed.hash, - {{else}} - {{field_name}}: ((await create{{pascal_case linked_from.name}}(cell)).signed_action.hashed.content as NewEntryAction).entry_hash, - {{/if}} - {{/if}} - {{/if}} - {{else}} - {{field_name}}: cell.cell_id[1], - {{/if}} - {{else}} - {{#if (eq cardinality "vector")}} - {{field_name}}: [{{> (concat field_type.type "/sample") field_type=field_type}}], - {{else}} - {{field_name}}: {{> (concat field_type.type "/sample") field_type=field_type}}, - {{/if}} - {{/if}} -{{/each}} - }, - ...partial{{pascal_case entry_type.name}} - }; -} - -export async function create{{pascal_case entry_type.name}}(cell: CallableCell, {{camel_case entry_type.name}} = undefined): Promise { - return cell.callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "create_{{snake_case entry_type.name}}", - payload: {{camel_case entry_type.name}} || await sample{{pascal_case entry_type.name}}(cell), - }); -} diff --git a/templates/custom-template/custom-template/template/entry-type/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case entry_type.name}}.test.ts.hbs b/templates/custom-template/custom-template/template/entry-type/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case entry_type.name}}.test.ts.hbs deleted file mode 100644 index 28b4d67d9..000000000 --- a/templates/custom-template/custom-template/template/entry-type/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case entry_type.name}}.test.ts.hbs +++ /dev/null @@ -1,279 +0,0 @@ -import { assert, test } from "vitest"; - -import { runScenario, dhtSync, CallableCell } from '@holochain/tryorama'; -import { - NewEntryAction, - ActionHash, - Record, - Link, - CreateLink, - DeleteLink, - SignedActionHashed, - AppBundleSource, - fakeActionHash, - fakeAgentPubKey, - fakeEntryHash -} from '@holochain/client'; -import { decode } from '@msgpack/msgpack'; - -import { create{{pascal_case entry_type.name}}, sample{{pascal_case entry_type.name}} } from './common.js'; - -test('create {{pascal_case entry_type.name}}', async () => { - await runScenario(async scenario => { - // Construct proper paths for your app. - // This assumes app bundle created by the `hc app pack` command. - const testAppPath = process.cwd() + '/../workdir/{{app_name}}.happ'; - - // Set up the app to be installed - const appSource = { appBundleSource: { path: testAppPath } }; - - // Add 2 players with the test app to the Scenario. The returned players - // can be destructured. - const [alice, bob] = await scenario.addPlayersWithApps([appSource, appSource]); - - // Shortcut peer discovery through gossip and register all agents in every - // conductor of the scenario. - await scenario.shareAllAgents(); - - // Alice creates a {{pascal_case entry_type.name}} - const record: Record = await create{{pascal_case entry_type.name}}(alice.cells[0]); - assert.ok(record); - }); -}); - -test('create and read {{pascal_case entry_type.name}}', async () => { - await runScenario(async scenario => { - // Construct proper paths for your app. - // This assumes app bundle created by the `hc app pack` command. - const testAppPath = process.cwd() + '/../workdir/{{app_name}}.happ'; - - // Set up the app to be installed - const appSource = { appBundleSource: { path: testAppPath } }; - - // Add 2 players with the test app to the Scenario. The returned players - // can be destructured. - const [alice, bob] = await scenario.addPlayersWithApps([appSource, appSource]); - - // Shortcut peer discovery through gossip and register all agents in every - // conductor of the scenario. - await scenario.shareAllAgents(); - - const sample = await sample{{pascal_case entry_type.name}}(alice.cells[0]); - - // Alice creates a {{pascal_case entry_type.name}} - const record: Record = await create{{pascal_case entry_type.name}}(alice.cells[0], sample); - assert.ok(record); - - // Wait for the created entry to be propagated to the other node. - await dhtSync([alice, bob], alice.cells[0].cell_id[0]); - - // Bob gets the created {{pascal_case entry_type.name}} - const createReadOutput: Record = await bob.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "{{#if crud.update}}get_original_{{snake_case entry_type.name}}{{else}}get_{{snake_case entry_type.name}}{{/if}}", - payload: {{#if entry_type.reference_entry_hash}}(record.signed_action.hashed.content as NewEntryAction).entry_hash{{else}}record.signed_action.hashed.hash{{/if}}, - }); - assert.deepEqual(sample, decode((createReadOutput.entry as any).Present.entry) as any); - - {{#each entry_type.fields}} - {{#if linked_from}} - {{#if (ne (pascal_case linked_from.name) (pascal_case ../entry_type.name))}} - // Bob gets the {{pascal_case (plural linked_from.name)}} for the new {{pascal_case ../entry_type.name}} - let linksTo{{pascal_case (plural linked_from.name)}}: Link[] = await bob.cells[0].callZome({ - zome_name: "{{../coordinator_zome_manifest.name}}", - fn_name: "get_{{snake_case (plural ../entry_type.name)}}_for_{{snake_case linked_from.name}}", - payload: {{#if (eq cardinality "vector")}}sample.{{field_name}}[0]{{else}}sample.{{field_name}}{{/if}} - }); - assert.equal(linksTo{{pascal_case (plural linked_from.name)}}.length, 1); - assert.deepEqual(linksTo{{pascal_case (plural linked_from.name)}}[0].target, {{#if ../entry_type.reference_entry_hash}}(record.signed_action.hashed.content as NewEntryAction).entry_hash{{else}}record.signed_action.hashed.hash{{/if}}); - {{/if}} - {{/if}} - {{/each}} - }); -}); - -{{#if crud.update}} -test('create and update {{pascal_case entry_type.name}}', async () => { - await runScenario(async scenario => { - // Construct proper paths for your app. - // This assumes app bundle created by the `hc app pack` command. - const testAppPath = process.cwd() + '/../workdir/{{app_name}}.happ'; - - // Set up the app to be installed - const appSource = { appBundleSource: { path: testAppPath } }; - - // Add 2 players with the test app to the Scenario. The returned players - // can be destructured. - const [alice, bob] = await scenario.addPlayersWithApps([appSource, appSource]); - - // Shortcut peer discovery through gossip and register all agents in every - // conductor of the scenario. - await scenario.shareAllAgents(); - - // Alice creates a {{pascal_case entry_type.name}} - const record: Record = await create{{pascal_case entry_type.name}}(alice.cells[0]); - assert.ok(record); - - const originalActionHash = record.signed_action.hashed.hash; - - // Alice updates the {{pascal_case entry_type.name}} - let contentUpdate: any = await sample{{pascal_case entry_type.name}}(alice.cells[0]); - let updateInput = { -{{#if link_from_original_to_each_update}} - original_{{snake_case entry_type.name}}_hash: originalActionHash, -{{/if}} - previous_{{snake_case entry_type.name}}_hash: originalActionHash, - updated_{{snake_case entry_type.name}}: contentUpdate, - }; - - let updatedRecord: Record = await alice.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "update_{{snake_case entry_type.name}}", - payload: updateInput, - }); - assert.ok(updatedRecord); - - // Wait for the updated entry to be propagated to the other node. - await dhtSync([alice, bob], alice.cells[0].cell_id[0]); - - // Bob gets the updated {{pascal_case entry_type.name}} - const readUpdatedOutput0: Record = await bob.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "get_latest_{{snake_case entry_type.name}}", - payload: updatedRecord.signed_action.hashed.hash, - }); - assert.deepEqual(contentUpdate, decode((readUpdatedOutput0.entry as any).Present.entry) as any); - - // Alice updates the {{pascal_case entry_type.name}} again - contentUpdate = await sample{{pascal_case entry_type.name}}(alice.cells[0]); - updateInput = { -{{#if link_from_original_to_each_update}} - original_{{snake_case entry_type.name}}_hash: originalActionHash, -{{/if}} - previous_{{snake_case entry_type.name}}_hash: updatedRecord.signed_action.hashed.hash, - updated_{{snake_case entry_type.name}}: contentUpdate, - }; - - updatedRecord = await alice.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "update_{{snake_case entry_type.name}}", - payload: updateInput, - }); - assert.ok(updatedRecord); - - // Wait for the updated entry to be propagated to the other node. - await dhtSync([alice, bob], alice.cells[0].cell_id[0]); - - // Bob gets the updated {{pascal_case entry_type.name}} - const readUpdatedOutput1: Record = await bob.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "get_latest_{{snake_case entry_type.name}}", - payload: updatedRecord.signed_action.hashed.hash, - }); - assert.deepEqual(contentUpdate, decode((readUpdatedOutput1.entry as any).Present.entry) as any); - - // Bob gets all the revisions for {{pascal_case entry_type.name}} - const revisions: Record[] = await bob.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "get_all_revisions_for_{{snake_case entry_type.name}}", - payload: originalActionHash, - }); - assert.equal(revisions.length, 3); - assert.deepEqual(contentUpdate, decode((revisions[2].entry as any).Present.entry) as any); - }); -}); -{{/if}} - -{{#if crud.delete}} -test('create and delete {{pascal_case entry_type.name}}', async () => { - await runScenario(async scenario => { - // Construct proper paths for your app. - // This assumes app bundle created by the `hc app pack` command. - const testAppPath = process.cwd() + '/../workdir/{{app_name}}.happ'; - - // Set up the app to be installed - const appSource = { appBundleSource: { path: testAppPath } }; - - // Add 2 players with the test app to the Scenario. The returned players - // can be destructured. - const [alice, bob] = await scenario.addPlayersWithApps([appSource, appSource]); - - // Shortcut peer discovery through gossip and register all agents in every - // conductor of the scenario. - await scenario.shareAllAgents(); - - const sample = await sample{{pascal_case entry_type.name}}(alice.cells[0]); - - // Alice creates a {{pascal_case entry_type.name}} - const record: Record = await create{{pascal_case entry_type.name}}(alice.cells[0], sample); - assert.ok(record); - - await dhtSync([alice, bob], alice.cells[0].cell_id[0]); - - {{#each entry_type.fields}} - {{#if linked_from}} - {{#if (ne (pascal_case linked_from.name) (pascal_case ../entry_type.name))}} - // Bob gets the {{pascal_case (plural linked_from.name)}} for the new {{pascal_case ../entry_type.name}} - let linksTo{{pascal_case (plural linked_from.name)}}: Link[] = await bob.cells[0].callZome({ - zome_name: "{{../coordinator_zome_manifest.name}}", - fn_name: "get_{{snake_case (plural ../entry_type.name)}}_for_{{snake_case linked_from.name}}", - payload: {{#if (eq cardinality "vector")}}sample.{{field_name}}[0]{{else}}sample.{{field_name}}{{/if}} - }); - assert.equal(linksTo{{pascal_case (plural linked_from.name)}}.length, 1); - assert.deepEqual(linksTo{{pascal_case (plural linked_from.name)}}[0].target, {{#if ../entry_type.reference_entry_hash}}(record.signed_action.hashed.content as NewEntryAction).entry_hash{{else}}record.signed_action.hashed.hash{{/if}}); - {{/if}} - {{/if}} - {{/each}} - - // Alice deletes the {{pascal_case entry_type.name}} - const deleteActionHash = await alice.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "delete_{{snake_case entry_type.name}}", - payload: record.signed_action.hashed.hash, - }); - assert.ok(deleteActionHash); - - // Wait for the entry deletion to be propagated to the other node. - await dhtSync([alice, bob], alice.cells[0].cell_id[0]); - - // Bob gets the oldest delete for the {{pascal_case entry_type.name}} - const oldestDeleteFor{{pascal_case entry_type.name}}: SignedActionHashed = await bob.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "get_oldest_delete_for_{{snake_case entry_type.name}}", - payload: record.signed_action.hashed.hash, - }); - assert.ok(oldestDeleteFor{{pascal_case entry_type.name}}); - - // Bob gets the deletions for the {{pascal_case entry_type.name}} - const deletesFor{{pascal_case entry_type.name}}: SignedActionHashed[] = await bob.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "get_all_deletes_for_{{snake_case entry_type.name}}", - payload: record.signed_action.hashed.hash, - }); - assert.equal(deletesFor{{pascal_case entry_type.name}}.length, 1); - - {{#each entry_type.fields}} - {{#if linked_from}} - {{#if (ne (pascal_case linked_from.name) (pascal_case ../entry_type.name))}} - // Bob gets the {{pascal_case (plural linked_from.name)}} for the {{pascal_case ../entry_type.name}} again - linksTo{{pascal_case (plural linked_from.name)}} = await bob.cells[0].callZome({ - zome_name: "{{../coordinator_zome_manifest.name}}", - fn_name: "get_{{snake_case (plural ../entry_type.name)}}_for_{{snake_case linked_from.name}}", - payload: {{#if (eq cardinality "vector")}}sample.{{field_name}}[0]{{else}}sample.{{field_name}}{{/if}} - }); - assert.equal(linksTo{{pascal_case (plural linked_from.name)}}.length, 0); - - // Bob gets the deleted {{pascal_case (plural linked_from.name)}} for the {{pascal_case ../entry_type.name}} - const deletedLinksTo{{pascal_case (plural linked_from.name)}}: Array<[SignedActionHashed, SignedActionHashed[]]> = await bob.cells[0].callZome({ - zome_name: "{{../coordinator_zome_manifest.name}}", - fn_name: "get_deleted_{{snake_case (plural ../entry_type.name)}}_for_{{snake_case linked_from.name}}", - payload: {{#if (eq cardinality "vector")}}sample.{{field_name}}[0]{{else}}sample.{{field_name}}{{/if}} - }); - assert.equal(deletedLinksTo{{pascal_case (plural linked_from.name)}}.length, 1); - {{/if}} - {{/if}} - {{/each}} - - }); -}); -{{/if}} diff --git a/templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/create-{{kebab_case entry_type.name}}.ts.hbs b/templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/create-{{kebab_case entry_type.name}}.ts.hbs deleted file mode 100644 index 36cfdf8fe..000000000 --- a/templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/create-{{kebab_case entry_type.name}}.ts.hbs +++ /dev/null @@ -1,131 +0,0 @@ -import { LitElement, html } from 'lit'; -import { state, customElement, property } from 'lit/decorators.js'; -import { InstalledCell, ActionHash, Record, AgentPubKey, EntryHash, AppClient, DnaHash, HolochainError } from '@holochain/client'; -import { consume } from '@lit-labs/context'; -{{#uniq_lines}} - {{#each entry_type.fields}} - {{#if widget}} -{{> (concat field_type.type "/" widget "/edit/imports") }} - - {{/if}} - {{/each}} -{{/uniq_lines}} - -import { sharedStyles } from '../../shared-styles'; -import { clientContext } from '../../contexts'; -import { {{pascal_case entry_type.name}}{{#each entry_type.fields}}{{#if (eq field_type.type "Enum")}}, {{field_type.label}}{{/if}}{{/each}} } from './types'; - -@customElement('create-{{kebab_case entry_type.name}}') -export class Create{{pascal_case entry_type.name}} extends LitElement { - @consume({ context: clientContext }) - client!: AppClient; - - {{#each entry_type.fields}} - {{#if (not widget) }} - {{#if (eq cardinality "single")}} - @property() - {{camel_case field_name}}!: {{> (concat field_type.type "/type") }}; - {{else}} - {{#if (eq cardinality "option")}} - @property() - {{camel_case field_name}}: {{> (concat field_type.type "/type") }} | undefined; - {{else}} - @property() - {{camel_case field_name}}!: Array<{{> (concat field_type.type "/type") }}>; - - {{/if}} - {{/if}} - {{/if}} - {{/each}} - - {{#each entry_type.fields}} - {{#if widget }} - {{#if (not (eq cardinality "vector" ) )}} - @state() - _{{camel_case field_name}}: {{> (concat field_type.type "/type") }}{{#if (eq cardinality "option")}} | undefined{{/if}} = {{> (concat field_type.type "/" widget "/initial-value") field_type=field_type}}; - - {{else}} - @state() - _{{camel_case field_name}}: Array<{{> (concat field_type.type "/type") }}> = [{{> (concat field_type.type "/" widget "/initial-value") field_type=field_type}}]; - - {{/if}} - {{/if}} - {{/each}} - - firstUpdated() { -{{#each entry_type.fields}} - {{#if (not widget) }} - {{#if (ne cardinality "option")}} - if (this.{{camel_case field_name}} === undefined) { - throw new Error(`The {{camel_case field_name}} input is required for the create-{{kebab_case ../entry_type.name}} element`); - } - {{/if}} - {{/if}} -{{/each}} - } - - is{{pascal_case entry_type.name}}Valid() { - return true{{#each entry_type.fields}}{{#if widget}}{{#if (eq cardinality "single")}} && {{> (concat field_type.type "/" widget "/is-valid") variable_to_validate=(concat "this._" (camel_case field_name)) }}{{/if}}{{#if (eq cardinality "vector")}} && this._{{camel_case field_name}}.every(e => {{> (concat field_type.type "/" widget "/is-valid") variable_to_validate="e" }}){{/if}}{{/if}}{{/each}}; - } - - async create{{pascal_case entry_type.name}}() { - const {{camel_case entry_type.name}}: {{pascal_case entry_type.name}} = { - {{#each entry_type.fields}} - {{#if widget}} - {{snake_case field_name}}: this._{{camel_case field_name}}, - {{else}} - {{snake_case field_name}}: this.{{camel_case field_name}}, - {{/if}} - {{/each}} - }; - - try { - const record: Record = await this.client.callZome({ - cap_secret: null, - role_name: '{{dna_role_name}}', - zome_name: '{{coordinator_zome_manifest.name}}', - fn_name: 'create_{{snake_case entry_type.name}}', - payload: {{camel_case entry_type.name}}, - }); - - this.dispatchEvent(new CustomEvent('{{kebab_case entry_type.name}}-created', { - composed: true, - bubbles: true, - detail: { - {{camel_case entry_type.name}}Hash: record.signed_action.hashed.hash - } - })); - } catch (e) { - alert((e as HolochainError).message); - } - } - - render() { - return html` -
-

Create {{pascal_case entry_type.name}}

-{{#each entry_type.fields}} - {{#if widget}} -
- {{#if (not (eq cardinality "vector") )}} - {{> (concat field_type.type "/" widget "/edit/render") label=(title_case field_name) variable_to_read=(concat "this._" (camel_case field_name) ) variable_to_change=(concat "this._" (camel_case field_name) ) required=(eq cardinality "single") }} - {{else}} - {{> Vec/edit/render field_name=field_name field_type=field_type widget=widget }} - {{/if}} - -
- {{/if}} -{{/each}} - - -
- `; - } - - static styles = sharedStyles; -} \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/types.ts.hbs b/templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/types.ts.hbs deleted file mode 100644 index 43005be82..000000000 --- a/templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/types.ts.hbs +++ /dev/null @@ -1,7 +0,0 @@ -{{#if (includes previous_file_content "export type EntryTypes = {};")}} -{{replace previous_file_content "export type EntryTypes = {};" (concat "/* dprint-ignore-start */\nexport type EntryTypes =\n | ({ type: '" (pascal_case entry_type.name) "'; } & " (pascal_case entry_type.name) ");" "\n/* dprint-ignore-end */")}} -{{else}} -{{replace previous_file_content "/* dprint-ignore-start */\nexport type EntryTypes =" (concat "/* dprint-ignore-start */\nexport type EntryTypes =\n | ({ type: '" (pascal_case entry_type.name) "'; } & " (pascal_case entry_type.name) ")")}} -{{/if}} - -{{entry_type_ts_types}} \ No newline at end of file diff --git "a/templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#each entry_type.fields}}{{#if (and linked_from (not (eq linked_from.hash_type 'AgentPubKey') ) )}}{{kebab_case (plural ..\302\241entry_type.name)}}-for-{{kebab_case linked_from.name}}.ts{{\302\241if}}{{\302\241each}}.hbs" "b/templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#each entry_type.fields}}{{#if (and linked_from (not (eq linked_from.hash_type 'AgentPubKey') ) )}}{{kebab_case (plural ..\302\241entry_type.name)}}-for-{{kebab_case linked_from.name}}.ts{{\302\241if}}{{\302\241each}}.hbs" deleted file mode 100644 index fae604da5..000000000 --- "a/templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#each entry_type.fields}}{{#if (and linked_from (not (eq linked_from.hash_type 'AgentPubKey') ) )}}{{kebab_case (plural ..\302\241entry_type.name)}}-for-{{kebab_case linked_from.name}}.ts{{\302\241if}}{{\302\241each}}.hbs" +++ /dev/null @@ -1,72 +0,0 @@ -import { LitElement, html } from 'lit'; -import { state, customElement, property } from 'lit/decorators.js'; -import { InstalledCell, Record, Link, AppClient, EntryHash, ActionHash, AgentPubKey, SignalType } from '@holochain/client'; -import { consume } from '@lit-labs/context'; -import { Task } from '@lit-labs/task'; - -import { sharedStyles } from '../../shared-styles'; -import { clientContext } from '../../contexts'; -import { {{pascal_case ../coordinator_zome_manifest.name}}Signal } from './types'; - -import './{{kebab_case ../entry_type.name}}-detail'; - -@customElement('{{kebab_case (plural ../entry_type.name)}}-for-{{kebab_case linked_from.name}}') -export class {{pascal_case (plural ../entry_type.name)}}For{{pascal_case linked_from.name }} extends LitElement { - @consume({ context: clientContext }) - client!: AppClient; - - @property({ - hasChanged: (newVal: {{linked_from.hash_type}}, oldVal: {{linked_from.hash_type}}) => newVal.toString() !== oldVal?.toString() - }) - {{camel_case linked_from.singular_arg}}!: {{linked_from.hash_type}}; - - @state() - hashes: Array = []; - - _fetch{{pascal_case (plural ../entry_type.name)}} = new Task(this, ([{{camel_case linked_from.singular_arg}}]: Array<{{linked_from.hash_type}}>) => this.client.callZome({ - cap_secret: null, - role_name: '{{../dna_role_name}}', - zome_name: '{{../coordinator_zome_manifest.name}}', - fn_name: 'get_{{snake_case (plural ../entry_type.name)}}_for_{{snake_case linked_from.name}}', - payload: {{camel_case linked_from.singular_arg}}, - }) as Promise>, () => [this.{{camel_case linked_from.singular_arg}}]); - - firstUpdated() { - if (!this.{{camel_case linked_from.singular_arg}}) { - throw new Error(`The {{camel_case linked_from.singular_arg}} property is required for the {{kebab_case (plural ../entry_type.name)}}-for-{{kebab_case linked_from.name}} element`); - } - - this.client?.on('signal', signal => { - if (!(SignalType.App in signal)) return; - if (signal.App.zome_name !== '{{../coordinator_zome_manifest.name}}') return; - const payload = signal.App.payload as {{pascal_case ../coordinator_zome_manifest.name}}Signal; - if (!(payload.type === 'EntryCreated' && payload.app_entry.type === '{{pascal_case ../entry_type.name}}')) return; - this._fetch{{pascal_case (plural ../entry_type.name)}}.run(); - }) - } - - renderList(hashes: Array) { - if (!hashes.length) return html`
No {{lower_case (plural ../entry_type.name)}} found for this {{lower_case linked_from.name}}.
`; - - return html` -
- ${hashes.map(hash => html` - <{{kebab_case ../entry_type.name}}-detail - .{{camel_case ../entry_type.name}}Hash=${hash} - @{{kebab_case ../entry_type.name}}-deleted=${() => { this._fetch{{pascal_case (plural ../entry_type.name)}}.run(); this.hashes = []; } } - > - `)} -
- `; - } - - render() { - return this._fetch{{pascal_case (plural ../entry_type.name)}}.render({ - pending: () => html``, - complete: (links) => this.renderList([...this.hashes, ...links.map(l => l.target)]), - error: (e: any) => html`
Error fetching {{lower_case (plural ../entry_type.name)}}: ${e.message}.
` - }); - } - - static styles = sharedStyles; -} \ No newline at end of file diff --git "a/templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#if crud.update}}edit-{{kebab_case entry_type.name}}.ts{{\302\241if}}.hbs" "b/templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#if crud.update}}edit-{{kebab_case entry_type.name}}.ts{{\302\241if}}.hbs" deleted file mode 100644 index a4a1a7b01..000000000 --- "a/templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#if crud.update}}edit-{{kebab_case entry_type.name}}.ts{{\302\241if}}.hbs" +++ /dev/null @@ -1,160 +0,0 @@ -import { LitElement, html } from 'lit'; -import { state, customElement, property } from 'lit/decorators.js'; -import { ActionHash, EntryHash, AgentPubKey, Record, AppClient, DnaHash, HolochainError } from '@holochain/client'; -import { consume } from '@lit-labs/context'; -import { decode } from '@msgpack/msgpack'; -{{#uniq_lines}} - {{#each entry_type.fields}} - {{#if widget}} -{{> (concat field_type.type "/" widget "/edit/imports") }} - - {{/if}} - {{/each}} -{{/uniq_lines}} - -import { sharedStyles } from '../../shared-styles'; -import { clientContext } from '../../contexts'; -import { {{pascal_case entry_type.name}}{{#each entry_type.fields}}{{#if (eq field_type.type "Enum")}}, {{field_type.label}}{{/if}}{{/each}} } from './types'; - -@customElement('edit-{{kebab_case entry_type.name}}') -export class Edit{{pascal_case entry_type.name}} extends LitElement { - - @consume({ context: clientContext }) - client!: AppClient; - - {{#if link_from_original_to_each_update}} - @property({ - hasChanged: (newVal: ActionHash, oldVal: ActionHash) => newVal?.toString() !== oldVal?.toString() - }) - original{{pascal_case entry_type.name}}Hash!: ActionHash; - - {{/if}} - - @property() - currentRecord!: Record; - - get current{{pascal_case entry_type.name}}() { - return decode((this.currentRecord.entry as any).Present.entry) as {{pascal_case entry_type.name}}; - } - - {{#each entry_type.fields}} - {{#if widget }} - {{#if (not (eq cardinality "vector" ) )}} - @state() - _{{camel_case field_name}}{{#if (eq cardinality "single")}}!{{/if}}: {{> (concat field_type.type "/type") }}{{#if (eq cardinality "option")}} | undefined{{/if}}; - - {{else}} - @state() - _{{camel_case field_name}}: Array<{{> (concat field_type.type "/type") }}> = this.current{{pascal_case ../entry_type.name}}.{{snake_case field_name}}; - - {{/if}} - {{/if}} - {{/each}} - - is{{pascal_case entry_type.name}}Valid() { - return true{{#each entry_type.fields}}{{#if widget}}{{#if (eq cardinality "single")}} && {{> (concat field_type.type "/" widget "/is-valid") variable_to_validate=(concat "this._" (camel_case field_name)) }}{{/if}}{{#if (eq cardinality "vector")}} && this._{{camel_case field_name}}.every(e => {{> (concat field_type.type "/" widget "/is-valid") variable_to_validate="e" }}){{/if}}{{/if}}{{/each}}; - } - - connectedCallback() { - super.connectedCallback(); - if (!this.currentRecord) { - throw new Error(`The currentRecord property is required for the edit-{{kebab_case entry_type.name}} element`); - } -{{#if link_from_original_to_each_update}} - - if (!this.original{{pascal_case entry_type.name}}Hash) { - throw new Error(`The original{{pascal_case entry_type.name}}Hash property is required for the edit-{{kebab_case entry_type.name}} element`); - } -{{/if}} - -{{#each entry_type.fields}} - {{#if widget}} - this._{{camel_case field_name}} = this.current{{pascal_case ../entry_type.name}}.{{snake_case field_name}}; - {{/if}} -{{/each}} - } - - async update{{pascal_case entry_type.name}}() { - const {{camel_case entry_type.name}}: {{pascal_case entry_type.name}} = { - {{#each entry_type.fields}} - {{#if widget}} - {{#if (eq cardinality "single") }} - {{snake_case field_name}}: this._{{camel_case field_name}}!, - {{else}} - {{snake_case field_name}}: this._{{camel_case field_name}}, - {{/if}} - {{/if}} - {{/each}} - {{#each entry_type.fields}} - {{#if (not widget)}} - {{snake_case field_name}}: this.current{{pascal_case ../entry_type.name}}.{{snake_case field_name}}, - {{/if}} - {{/each}} - }; - - try { - const updateRecord: Record = await this.client.callZome({ - cap_secret: null, - role_name: '{{dna_role_name}}', - zome_name: '{{coordinator_zome_manifest.name}}', - fn_name: 'update_{{snake_case entry_type.name}}', - payload: { - {{#if link_from_original_to_each_update}} - original_{{snake_case entry_type.name}}_hash: this.original{{pascal_case entry_type.name}}Hash, - {{/if}} - previous_{{snake_case entry_type.name}}_hash: this.currentRecord.signed_action.hashed.hash, - updated_{{snake_case entry_type.name}}: {{camel_case entry_type.name}} - }, - }); - - this.dispatchEvent(new CustomEvent('{{kebab_case entry_type.name}}-updated', { - composed: true, - bubbles: true, - detail: { - {{#if link_from_original_to_each_update}} - original{{pascal_case entry_type.name}}Hash: this.original{{pascal_case entry_type.name}}Hash, - {{/if}} - previous{{pascal_case entry_type.name}}Hash: this.currentRecord.signed_action.hashed.hash, - updated{{pascal_case entry_type.name}}Hash: updateRecord.signed_action.hashed.hash - } - })); - } catch (e) { - alert((e as HolochainError).message); - } - } - - render() { - return html` -
-{{#each entry_type.fields}} - {{#if widget}} -
- {{#if (not (eq cardinality "vector") )}} - {{> (concat field_type.type "/" widget "/edit/render") label=(title_case field_name) variable_to_read=(concat "this._" (camel_case field_name) ) variable_to_change=(concat "this._" (camel_case field_name) ) required=(eq cardinality "single") }} - {{else}} - {{> Vec/edit/render field_name=field_name field_type=field_type widget=widget }} - {{/if}} - -
- - {{/if}} -{{/each}} - -
- - -
-
- `; - } - - static styles = sharedStyles; -} diff --git a/templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case entry_type.name}}-detail.ts.hbs b/templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case entry_type.name}}-detail.ts.hbs deleted file mode 100644 index d7eedc360..000000000 --- a/templates/custom-template/custom-template/template/entry-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{kebab_case entry_type.name}}-detail.ts.hbs +++ /dev/null @@ -1,137 +0,0 @@ -import { LitElement, html } from 'lit'; -import { state, customElement, property } from 'lit/decorators.js'; -import { EntryHash, Record, ActionHash, AppClient, DnaHash, HolochainError } from '@holochain/client'; -import { consume } from '@lit-labs/context'; -import { Task } from '@lit-labs/task'; -import { decode } from '@msgpack/msgpack'; -{{#uniq_lines}} - {{#each entry_type.fields}} - {{#if widget}} -{{> (concat field_type.type "/" widget "/detail/imports") }} - - {{/if}} - {{/each}} -{{/uniq_lines}} - -{{#if crud.update}} -import './edit-{{kebab_case entry_type.name}}'; -{{/if}} - -import { sharedStyles } from '../../shared-styles'; -import { clientContext } from '../../contexts'; -import { {{pascal_case entry_type.name}}{{#each entry_type.fields}}{{#if (eq field_type.type "Enum")}}, {{field_type.label}}{{/if}}{{/each}} } from './types'; - -@customElement('{{kebab_case entry_type.name}}-detail') -export class {{pascal_case entry_type.name}}Detail extends LitElement { - @consume({ context: clientContext }) - client!: AppClient; - - @property({ - hasChanged: (newVal: {{#if entry_type.reference_entry_hash}}EntryHash{{else}}ActionHash{{/if}}, oldVal: {{#if entry_type.reference_entry_hash}}EntryHash{{else}}ActionHash{{/if}}) => newVal?.toString() !== oldVal?.toString() - }) - {{camel_case entry_type.name}}Hash!: {{#if entry_type.reference_entry_hash}}EntryHash{{else}}ActionHash{{/if}}; - - _fetchRecord = new Task(this, ([{{camel_case entry_type.name}}Hash]: Array<{{#if entry_type.reference_entry_hash}}EntryHash{{else}}ActionHash{{/if}}>) => this.client.callZome({ - cap_secret: null, - role_name: '{{dna_role_name}}', - zome_name: '{{coordinator_zome_manifest.name}}', - fn_name: '{{#if crud.update}}get_latest_{{snake_case entry_type.name}}{{else}}get_{{snake_case entry_type.name}}{{/if}}', - payload: {{camel_case entry_type.name}}Hash, - }) as Promise, () => [this.{{camel_case entry_type.name}}Hash]); - - {{#if crud.update}} - @state() _editing = false; - {{/if}} - - firstUpdated() { - if (!this.{{camel_case entry_type.name}}Hash) { - throw new Error(`The {{camel_case entry_type.name}}Hash property is required for the {{kebab_case entry_type.name}}-detail element`); - } - } - - {{#if crud.delete}} - async delete{{pascal_case entry_type.name}}() { - try { - await this.client.callZome({ - cap_secret: null, - role_name: '{{dna_role_name}}', - zome_name: '{{coordinator_zome_manifest.name}}', - fn_name: 'delete_{{snake_case entry_type.name}}', - payload: this.{{camel_case entry_type.name}}Hash, - }); - this.dispatchEvent(new CustomEvent('{{kebab_case entry_type.name}}-deleted', { - bubbles: true, - composed: true, - detail: { - {{camel_case entry_type.name}}Hash: this.{{camel_case entry_type.name}}Hash - } - })); - this._fetchRecord.run(); - } catch (e) { - alert((e as HolochainError).message) - } - } - {{/if}} - - renderDetail(record: Record) { - const {{camel_case entry_type.name}} = decode((record.entry as any).Present.entry) as {{pascal_case entry_type.name}}; - - return html` -
-{{#each entry_type.fields}} - {{#if widget}} - {{#if (not (eq cardinality "vector") )}} -
- {{title_case field_name}}: - {{> (concat field_type.type "/" widget "/detail/render") variable_to_read=(concat (camel_case ../entry_type.name) "." (snake_case field_name) ) }} -
- {{else}} - {{> Vec/detail/render variable_to_read=(concat (camel_case ../entry_type.name) "." (snake_case field_name) ) field_name=field_name field_type=field_type widget=widget }} - {{/if}} - {{/if}} -{{/each}} - -
-{{#if crud.update}} - -{{/if}} -{{#if crud.delete}} - -{{/if}} -
-
- `; - } - - render{{pascal_case entry_type.name}}(record: Record | undefined) { - if (!record) return html`
The requested {{lower_case entry_type.name}} was not found.
`; - {{#if crud.update}} - if (this._editing) { - return html` - { - this._editing = false; - await this._fetchRecord.run(); - } } - @edit-canceled=${() => { this._editing = false; } } - > - `; - } - {{/if}} - return this.renderDetail(record); - } - - render() { - return this._fetchRecord.render({ - pending: () => html``, - complete: (record) => this.render{{pascal_case entry_type.name}}(record), - error: (e: any) => html`
Error fetching the {{lower_case entry_type.name}}: ${e.message}
` - }); - } - - static styles = sharedStyles; -} \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/example.instructions.hbs b/templates/custom-template/custom-template/template/example.instructions.hbs deleted file mode 100644 index cfdf10efd..000000000 --- a/templates/custom-template/custom-template/template/example.instructions.hbs +++ /dev/null @@ -1,10 +0,0 @@ -Run the example app with: - - cd {{example}} - nix develop - {{(package_manager_command package_manager "install" null)}} - {{(package_manager_command package_manager "start" null)}} - -Generated ui code might also need to be reformatted: - - {{(package_manager_command package_manager "format" "ui")}} \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/example/ui/src/holochain-app.ts.hbs b/templates/custom-template/custom-template/template/example/ui/src/holochain-app.ts.hbs deleted file mode 100644 index 58eee306c..000000000 --- a/templates/custom-template/custom-template/template/example/ui/src/holochain-app.ts.hbs +++ /dev/null @@ -1,43 +0,0 @@ -import { LitElement, html, css, unsafeCSS } from 'lit'; -import { customElement, property, state } from 'lit/decorators.js'; -import { AppClient, AppWebsocket } from '@holochain/client'; -import { provide } from '@lit-labs/context'; - -import sharedStyles from './index.css'; -import { clientContext } from './contexts'; - -import './forum/posts/all-posts'; -import './forum/posts/create-post'; - -@customElement('holochain-app') -export class HolochainApp extends LitElement { - @state() loading = false; - - @provide({ context: clientContext }) - @property({ type: Object }) - client!: AppClient; - - async firstUpdated() { - this.loading = true; - try { - this.client = await AppWebsocket.connect(); - } catch(e) { - console.error(e) - } finally { - this.loading = false; - } - } - - render() { - if (this.loading) return html``; - return html` -
-

Welcome to the Forum hApp

- - -
- `; - } - - static styles = css`${unsafeCSS(sharedStyles)}`; -} \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/ActionHash/sample.hbs b/templates/custom-template/custom-template/template/field-types/ActionHash/sample.hbs deleted file mode 100644 index 3d318bd7c..000000000 --- a/templates/custom-template/custom-template/template/field-types/ActionHash/sample.hbs +++ /dev/null @@ -1 +0,0 @@ -(await fakeActionHash()) \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/ActionHash/type.hbs b/templates/custom-template/custom-template/template/field-types/ActionHash/type.hbs deleted file mode 100644 index 339425a42..000000000 --- a/templates/custom-template/custom-template/template/field-types/ActionHash/type.hbs +++ /dev/null @@ -1 +0,0 @@ -ActionHash \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/AgentPubKey/sample.hbs b/templates/custom-template/custom-template/template/field-types/AgentPubKey/sample.hbs deleted file mode 100644 index 2ad640d28..000000000 --- a/templates/custom-template/custom-template/template/field-types/AgentPubKey/sample.hbs +++ /dev/null @@ -1 +0,0 @@ -(await fakeAgentPubKey()) \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/AgentPubKey/type.hbs b/templates/custom-template/custom-template/template/field-types/AgentPubKey/type.hbs deleted file mode 100644 index fe408746c..000000000 --- a/templates/custom-template/custom-template/template/field-types/AgentPubKey/type.hbs +++ /dev/null @@ -1 +0,0 @@ -AgentPubKey \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/DnaHash/sample.hbs b/templates/custom-template/custom-template/template/field-types/DnaHash/sample.hbs deleted file mode 100644 index 19e7efd04..000000000 --- a/templates/custom-template/custom-template/template/field-types/DnaHash/sample.hbs +++ /dev/null @@ -1 +0,0 @@ -(await fakeDnaHash()) \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/DnaHash/type.hbs b/templates/custom-template/custom-template/template/field-types/DnaHash/type.hbs deleted file mode 100644 index 3551c1f2c..000000000 --- a/templates/custom-template/custom-template/template/field-types/DnaHash/type.hbs +++ /dev/null @@ -1 +0,0 @@ -DnaHash \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/EntryHash/sample.hbs b/templates/custom-template/custom-template/template/field-types/EntryHash/sample.hbs deleted file mode 100644 index f1f27ff28..000000000 --- a/templates/custom-template/custom-template/template/field-types/EntryHash/sample.hbs +++ /dev/null @@ -1 +0,0 @@ -(await fakeEntryHash()) \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/EntryHash/type.hbs b/templates/custom-template/custom-template/template/field-types/EntryHash/type.hbs deleted file mode 100644 index 9a4e496c5..000000000 --- a/templates/custom-template/custom-template/template/field-types/EntryHash/type.hbs +++ /dev/null @@ -1 +0,0 @@ -EntryHash \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/Enum/Select/detail/render.hbs b/templates/custom-template/custom-template/template/field-types/Enum/Select/detail/render.hbs deleted file mode 100644 index 2bdebc1aa..000000000 --- a/templates/custom-template/custom-template/template/field-types/Enum/Select/detail/render.hbs +++ /dev/null @@ -1 +0,0 @@ -${ {{#each field_type.variants}}{{#unless @last}} {{../variable_to_read}}.type === '{{pascal_case this}}' ?{{/unless}} `{{title_case this}}`{{#unless @last}} :{{/unless}} {{/each}} } \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/Enum/Select/edit/render.hbs b/templates/custom-template/custom-template/template/field-types/Enum/Select/edit/render.hbs deleted file mode 100644 index 81534064b..000000000 --- a/templates/custom-template/custom-template/template/field-types/Enum/Select/edit/render.hbs +++ /dev/null @@ -1,8 +0,0 @@ - - \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/Enum/Select/initial-value.hbs b/templates/custom-template/custom-template/template/field-types/Enum/Select/initial-value.hbs deleted file mode 100644 index 214893c2e..000000000 --- a/templates/custom-template/custom-template/template/field-types/Enum/Select/initial-value.hbs +++ /dev/null @@ -1 +0,0 @@ -{ type: '{{lookup field_type.variants 0}}' } \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/Enum/Select/is-valid.hbs b/templates/custom-template/custom-template/template/field-types/Enum/Select/is-valid.hbs deleted file mode 100644 index f32a5804e..000000000 --- a/templates/custom-template/custom-template/template/field-types/Enum/Select/is-valid.hbs +++ /dev/null @@ -1 +0,0 @@ -true \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/Enum/default.hbs b/templates/custom-template/custom-template/template/field-types/Enum/default.hbs deleted file mode 100644 index 214893c2e..000000000 --- a/templates/custom-template/custom-template/template/field-types/Enum/default.hbs +++ /dev/null @@ -1 +0,0 @@ -{ type: '{{lookup field_type.variants 0}}' } \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/Enum/sample.hbs b/templates/custom-template/custom-template/template/field-types/Enum/sample.hbs deleted file mode 100644 index 214893c2e..000000000 --- a/templates/custom-template/custom-template/template/field-types/Enum/sample.hbs +++ /dev/null @@ -1 +0,0 @@ -{ type: '{{lookup field_type.variants 0}}' } \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/Enum/type.hbs b/templates/custom-template/custom-template/template/field-types/Enum/type.hbs deleted file mode 100644 index 798c93ded..000000000 --- a/templates/custom-template/custom-template/template/field-types/Enum/type.hbs +++ /dev/null @@ -1 +0,0 @@ -{{pascal_case field_type.label}} \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/String/TextArea/detail/render.hbs b/templates/custom-template/custom-template/template/field-types/String/TextArea/detail/render.hbs deleted file mode 100644 index b82c4a0a1..000000000 --- a/templates/custom-template/custom-template/template/field-types/String/TextArea/detail/render.hbs +++ /dev/null @@ -1 +0,0 @@ -${ {{variable_to_read}} } \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/String/TextArea/edit/render.hbs b/templates/custom-template/custom-template/template/field-types/String/TextArea/edit/render.hbs deleted file mode 100644 index 5823114e1..000000000 --- a/templates/custom-template/custom-template/template/field-types/String/TextArea/edit/render.hbs +++ /dev/null @@ -1,11 +0,0 @@ - - \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/String/TextArea/initial-value.hbs b/templates/custom-template/custom-template/template/field-types/String/TextArea/initial-value.hbs deleted file mode 100644 index 942309095..000000000 --- a/templates/custom-template/custom-template/template/field-types/String/TextArea/initial-value.hbs +++ /dev/null @@ -1 +0,0 @@ -'' \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/String/TextArea/is-valid.hbs b/templates/custom-template/custom-template/template/field-types/String/TextArea/is-valid.hbs deleted file mode 100644 index e3891233e..000000000 --- a/templates/custom-template/custom-template/template/field-types/String/TextArea/is-valid.hbs +++ /dev/null @@ -1 +0,0 @@ -{{variable_to_validate}} !== '' \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/String/TextField/detail/render.hbs b/templates/custom-template/custom-template/template/field-types/String/TextField/detail/render.hbs deleted file mode 100644 index b82c4a0a1..000000000 --- a/templates/custom-template/custom-template/template/field-types/String/TextField/detail/render.hbs +++ /dev/null @@ -1 +0,0 @@ -${ {{variable_to_read}} } \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/String/TextField/edit/render.hbs b/templates/custom-template/custom-template/template/field-types/String/TextField/edit/render.hbs deleted file mode 100644 index 5311bf73b..000000000 --- a/templates/custom-template/custom-template/template/field-types/String/TextField/edit/render.hbs +++ /dev/null @@ -1,11 +0,0 @@ - - { {{variable_to_change}} = (e.target as any).value; } } - {{#if required}} - required - {{/if}} -> \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/String/TextField/initial-value.hbs b/templates/custom-template/custom-template/template/field-types/String/TextField/initial-value.hbs deleted file mode 100644 index 942309095..000000000 --- a/templates/custom-template/custom-template/template/field-types/String/TextField/initial-value.hbs +++ /dev/null @@ -1 +0,0 @@ -'' \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/String/TextField/is-valid.hbs b/templates/custom-template/custom-template/template/field-types/String/TextField/is-valid.hbs deleted file mode 100644 index e3891233e..000000000 --- a/templates/custom-template/custom-template/template/field-types/String/TextField/is-valid.hbs +++ /dev/null @@ -1 +0,0 @@ -{{variable_to_validate}} !== '' \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/String/default.hbs b/templates/custom-template/custom-template/template/field-types/String/default.hbs deleted file mode 100644 index 5de6da439..000000000 --- a/templates/custom-template/custom-template/template/field-types/String/default.hbs +++ /dev/null @@ -1 +0,0 @@ -{{#if (eq cardinality "vector")}}[]{{else}}""{{/if}} \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/String/sample.hbs b/templates/custom-template/custom-template/template/field-types/String/sample.hbs deleted file mode 100644 index f128f21fd..000000000 --- a/templates/custom-template/custom-template/template/field-types/String/sample.hbs +++ /dev/null @@ -1 +0,0 @@ -"Lorem ipsum dolor sit amet, consectetur adipiscing elit." \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/String/type.hbs b/templates/custom-template/custom-template/template/field-types/String/type.hbs deleted file mode 100644 index ec186f1f3..000000000 --- a/templates/custom-template/custom-template/template/field-types/String/type.hbs +++ /dev/null @@ -1 +0,0 @@ -string \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/Timestamp/DateTimePicker/detail/render.hbs b/templates/custom-template/custom-template/template/field-types/Timestamp/DateTimePicker/detail/render.hbs deleted file mode 100644 index 322138be4..000000000 --- a/templates/custom-template/custom-template/template/field-types/Timestamp/DateTimePicker/detail/render.hbs +++ /dev/null @@ -1 +0,0 @@ -${new Date({{variable_to_read}} / 1000).toLocaleString() } \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/Timestamp/DateTimePicker/edit/render.hbs b/templates/custom-template/custom-template/template/field-types/Timestamp/DateTimePicker/edit/render.hbs deleted file mode 100644 index 97e59e87e..000000000 --- a/templates/custom-template/custom-template/template/field-types/Timestamp/DateTimePicker/edit/render.hbs +++ /dev/null @@ -1,12 +0,0 @@ - - { {{variable_to_change}} = Math.floor(new Date(e.target.value).getTime() / 1000); } } - {{#if required}} - required - {{/if}} -> \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/Timestamp/DateTimePicker/initial-value.hbs b/templates/custom-template/custom-template/template/field-types/Timestamp/DateTimePicker/initial-value.hbs deleted file mode 100644 index e32bcd5fd..000000000 --- a/templates/custom-template/custom-template/template/field-types/Timestamp/DateTimePicker/initial-value.hbs +++ /dev/null @@ -1 +0,0 @@ -Date.now() \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/Timestamp/DateTimePicker/is-valid.hbs b/templates/custom-template/custom-template/template/field-types/Timestamp/DateTimePicker/is-valid.hbs deleted file mode 100644 index f32a5804e..000000000 --- a/templates/custom-template/custom-template/template/field-types/Timestamp/DateTimePicker/is-valid.hbs +++ /dev/null @@ -1 +0,0 @@ -true \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/Timestamp/default.hbs b/templates/custom-template/custom-template/template/field-types/Timestamp/default.hbs deleted file mode 100644 index 1b4b0c67a..000000000 --- a/templates/custom-template/custom-template/template/field-types/Timestamp/default.hbs +++ /dev/null @@ -1 +0,0 @@ -Date.now() * 1000 \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/Timestamp/sample.hbs b/templates/custom-template/custom-template/template/field-types/Timestamp/sample.hbs deleted file mode 100644 index e82254249..000000000 --- a/templates/custom-template/custom-template/template/field-types/Timestamp/sample.hbs +++ /dev/null @@ -1 +0,0 @@ -1674053334548000 \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/Timestamp/type.hbs b/templates/custom-template/custom-template/template/field-types/Timestamp/type.hbs deleted file mode 100644 index 0dfad6f42..000000000 --- a/templates/custom-template/custom-template/template/field-types/Timestamp/type.hbs +++ /dev/null @@ -1 +0,0 @@ -number \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/Vec/default.hbs b/templates/custom-template/custom-template/template/field-types/Vec/default.hbs deleted file mode 100644 index 0637a088a..000000000 --- a/templates/custom-template/custom-template/template/field-types/Vec/default.hbs +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/Vec/sample.hbs b/templates/custom-template/custom-template/template/field-types/Vec/sample.hbs deleted file mode 100644 index 0637a088a..000000000 --- a/templates/custom-template/custom-template/template/field-types/Vec/sample.hbs +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/Vec/type.hbs b/templates/custom-template/custom-template/template/field-types/Vec/type.hbs deleted file mode 100644 index 44a00abfa..000000000 --- a/templates/custom-template/custom-template/template/field-types/Vec/type.hbs +++ /dev/null @@ -1 +0,0 @@ -Array<{{field_type.type}}> \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/bool/Checkbox/detail/render.hbs b/templates/custom-template/custom-template/template/field-types/bool/Checkbox/detail/render.hbs deleted file mode 100644 index dda2fe9b1..000000000 --- a/templates/custom-template/custom-template/template/field-types/bool/Checkbox/detail/render.hbs +++ /dev/null @@ -1 +0,0 @@ -${ {{variable_to_read}} ? 'Yes' : 'No' } \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/bool/Checkbox/edit/render.hbs b/templates/custom-template/custom-template/template/field-types/bool/Checkbox/edit/render.hbs deleted file mode 100644 index 3fb668d2b..000000000 --- a/templates/custom-template/custom-template/template/field-types/bool/Checkbox/edit/render.hbs +++ /dev/null @@ -1,7 +0,0 @@ - - { {{variable_to_change}} = (e.target as any).checked;} } -> \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/bool/Checkbox/initial-value.hbs b/templates/custom-template/custom-template/template/field-types/bool/Checkbox/initial-value.hbs deleted file mode 100644 index 02e4a84d6..000000000 --- a/templates/custom-template/custom-template/template/field-types/bool/Checkbox/initial-value.hbs +++ /dev/null @@ -1 +0,0 @@ -false \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/bool/Checkbox/is-valid.hbs b/templates/custom-template/custom-template/template/field-types/bool/Checkbox/is-valid.hbs deleted file mode 100644 index f32a5804e..000000000 --- a/templates/custom-template/custom-template/template/field-types/bool/Checkbox/is-valid.hbs +++ /dev/null @@ -1 +0,0 @@ -true \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/bool/default.hbs b/templates/custom-template/custom-template/template/field-types/bool/default.hbs deleted file mode 100644 index 51b676e7a..000000000 --- a/templates/custom-template/custom-template/template/field-types/bool/default.hbs +++ /dev/null @@ -1 +0,0 @@ -{{#if (eq cardinality "vector")}}[]{{else}}false{{/if}} \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/bool/sample.hbs b/templates/custom-template/custom-template/template/field-types/bool/sample.hbs deleted file mode 100644 index 02e4a84d6..000000000 --- a/templates/custom-template/custom-template/template/field-types/bool/sample.hbs +++ /dev/null @@ -1 +0,0 @@ -false \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/bool/type.hbs b/templates/custom-template/custom-template/template/field-types/bool/type.hbs deleted file mode 100644 index 535368032..000000000 --- a/templates/custom-template/custom-template/template/field-types/bool/type.hbs +++ /dev/null @@ -1 +0,0 @@ -boolean \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/f32/Slider/detail/render.hbs b/templates/custom-template/custom-template/template/field-types/f32/Slider/detail/render.hbs deleted file mode 100644 index b82c4a0a1..000000000 --- a/templates/custom-template/custom-template/template/field-types/f32/Slider/detail/render.hbs +++ /dev/null @@ -1 +0,0 @@ -${ {{variable_to_read}} } \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/f32/Slider/edit/render.hbs b/templates/custom-template/custom-template/template/field-types/f32/Slider/edit/render.hbs deleted file mode 100644 index 99547a15a..000000000 --- a/templates/custom-template/custom-template/template/field-types/f32/Slider/edit/render.hbs +++ /dev/null @@ -1,8 +0,0 @@ - - { {{variable_to_change}} = e.detail.value; } } -> \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/f32/Slider/initial-value.hbs b/templates/custom-template/custom-template/template/field-types/f32/Slider/initial-value.hbs deleted file mode 100644 index 171538eb0..000000000 --- a/templates/custom-template/custom-template/template/field-types/f32/Slider/initial-value.hbs +++ /dev/null @@ -1 +0,0 @@ -0.0 \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/f32/Slider/is-valid.hbs b/templates/custom-template/custom-template/template/field-types/f32/Slider/is-valid.hbs deleted file mode 100644 index f32a5804e..000000000 --- a/templates/custom-template/custom-template/template/field-types/f32/Slider/is-valid.hbs +++ /dev/null @@ -1 +0,0 @@ -true \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/f32/default.hbs b/templates/custom-template/custom-template/template/field-types/f32/default.hbs deleted file mode 100644 index 0039c80a1..000000000 --- a/templates/custom-template/custom-template/template/field-types/f32/default.hbs +++ /dev/null @@ -1 +0,0 @@ -{{#if (eq cardinality "vector")}}[]{{else}}0.0{{/if}} \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/f32/sample.hbs b/templates/custom-template/custom-template/template/field-types/f32/sample.hbs deleted file mode 100644 index ea2303bc0..000000000 --- a/templates/custom-template/custom-template/template/field-types/f32/sample.hbs +++ /dev/null @@ -1 +0,0 @@ -0.5 \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/f32/type.hbs b/templates/custom-template/custom-template/template/field-types/f32/type.hbs deleted file mode 100644 index 0dfad6f42..000000000 --- a/templates/custom-template/custom-template/template/field-types/f32/type.hbs +++ /dev/null @@ -1 +0,0 @@ -number \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/i32/Slider/detail/render.hbs b/templates/custom-template/custom-template/template/field-types/i32/Slider/detail/render.hbs deleted file mode 100644 index b82c4a0a1..000000000 --- a/templates/custom-template/custom-template/template/field-types/i32/Slider/detail/render.hbs +++ /dev/null @@ -1 +0,0 @@ -${ {{variable_to_read}} } \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/i32/Slider/edit/render.hbs b/templates/custom-template/custom-template/template/field-types/i32/Slider/edit/render.hbs deleted file mode 100644 index 7ba55ca89..000000000 --- a/templates/custom-template/custom-template/template/field-types/i32/Slider/edit/render.hbs +++ /dev/null @@ -1,7 +0,0 @@ - - { {{variable_to_change}} = e.detail.value; } } -> \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/i32/Slider/initial-value.hbs b/templates/custom-template/custom-template/template/field-types/i32/Slider/initial-value.hbs deleted file mode 100644 index 573541ac9..000000000 --- a/templates/custom-template/custom-template/template/field-types/i32/Slider/initial-value.hbs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/templates/custom-template/custom-template/template/field-types/i32/Slider/is-valid.hbs b/templates/custom-template/custom-template/template/field-types/i32/Slider/is-valid.hbs deleted file mode 100644 index 27ba77dda..000000000 --- a/templates/custom-template/custom-template/template/field-types/i32/Slider/is-valid.hbs +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/templates/custom-template/custom-template/template/field-types/i32/default.hbs b/templates/custom-template/custom-template/template/field-types/i32/default.hbs deleted file mode 100644 index 16b2eb52b..000000000 --- a/templates/custom-template/custom-template/template/field-types/i32/default.hbs +++ /dev/null @@ -1 +0,0 @@ -{{#if (eq cardinality "vector")}}[]{{else}}0{{/if}} \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/i32/sample.hbs b/templates/custom-template/custom-template/template/field-types/i32/sample.hbs deleted file mode 100644 index 46b71d470..000000000 --- a/templates/custom-template/custom-template/template/field-types/i32/sample.hbs +++ /dev/null @@ -1 +0,0 @@ --10 \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/i32/type.hbs b/templates/custom-template/custom-template/template/field-types/i32/type.hbs deleted file mode 100644 index 0dfad6f42..000000000 --- a/templates/custom-template/custom-template/template/field-types/i32/type.hbs +++ /dev/null @@ -1 +0,0 @@ -number \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/u32/Slider/detail/render.hbs b/templates/custom-template/custom-template/template/field-types/u32/Slider/detail/render.hbs deleted file mode 100644 index b82c4a0a1..000000000 --- a/templates/custom-template/custom-template/template/field-types/u32/Slider/detail/render.hbs +++ /dev/null @@ -1 +0,0 @@ -${ {{variable_to_read}} } \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/u32/Slider/edit/render.hbs b/templates/custom-template/custom-template/template/field-types/u32/Slider/edit/render.hbs deleted file mode 100644 index 99547a15a..000000000 --- a/templates/custom-template/custom-template/template/field-types/u32/Slider/edit/render.hbs +++ /dev/null @@ -1,8 +0,0 @@ - - { {{variable_to_change}} = e.detail.value; } } -> \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/u32/Slider/initial-value.hbs b/templates/custom-template/custom-template/template/field-types/u32/Slider/initial-value.hbs deleted file mode 100644 index c22708346..000000000 --- a/templates/custom-template/custom-template/template/field-types/u32/Slider/initial-value.hbs +++ /dev/null @@ -1 +0,0 @@ -0 \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/u32/Slider/is-valid.hbs b/templates/custom-template/custom-template/template/field-types/u32/Slider/is-valid.hbs deleted file mode 100644 index 27ba77dda..000000000 --- a/templates/custom-template/custom-template/template/field-types/u32/Slider/is-valid.hbs +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/templates/custom-template/custom-template/template/field-types/u32/default.hbs b/templates/custom-template/custom-template/template/field-types/u32/default.hbs deleted file mode 100644 index 16b2eb52b..000000000 --- a/templates/custom-template/custom-template/template/field-types/u32/default.hbs +++ /dev/null @@ -1 +0,0 @@ -{{#if (eq cardinality "vector")}}[]{{else}}0{{/if}} \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/u32/sample.hbs b/templates/custom-template/custom-template/template/field-types/u32/sample.hbs deleted file mode 100644 index 9a037142a..000000000 --- a/templates/custom-template/custom-template/template/field-types/u32/sample.hbs +++ /dev/null @@ -1 +0,0 @@ -10 \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/field-types/u32/type.hbs b/templates/custom-template/custom-template/template/field-types/u32/type.hbs deleted file mode 100644 index 0dfad6f42..000000000 --- a/templates/custom-template/custom-template/template/field-types/u32/type.hbs +++ /dev/null @@ -1 +0,0 @@ -number \ No newline at end of file diff --git "a/templates/custom-template/custom-template/template/link-type/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#if to_referenceable}}{{kebab_case from_referenceable.name}}-to-{{kebab_case (plural to_referenceable.name)}}.test.ts{{\302\241if}}.hbs" "b/templates/custom-template/custom-template/template/link-type/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#if to_referenceable}}{{kebab_case from_referenceable.name}}-to-{{kebab_case (plural to_referenceable.name)}}.test.ts{{\302\241if}}.hbs" deleted file mode 100644 index 84e12c27f..000000000 --- "a/templates/custom-template/custom-template/template/link-type/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#if to_referenceable}}{{kebab_case from_referenceable.name}}-to-{{kebab_case (plural to_referenceable.name)}}.test.ts{{\302\241if}}.hbs" +++ /dev/null @@ -1,157 +0,0 @@ -import { assert, test } from "vitest"; - -import { runScenario, dhtSync, CallableCell } from '@holochain/tryorama'; -import { - NewEntryAction, - ActionHash, - Record, - Link, - CreateLink, - DeleteLink, - SignedActionHashed, - AppBundleSource, - fakeActionHash, - fakeAgentPubKey, - fakeEntryHash -} from '@holochain/client'; -import { decode } from '@msgpack/msgpack'; - -{{#if (ne from_referenceable.hash_type "AgentPubKey")}} -import { create{{pascal_case from_referenceable.name}} } from './common.js'; -{{/if}} -{{#if (ne to_referenceable.hash_type "AgentPubKey")}} -import { create{{pascal_case to_referenceable.name}} } from './common.js'; -{{/if}} - -test('link a {{pascal_case from_referenceable.name}} to a {{pascal_case to_referenceable.name}}', async () => { - await runScenario(async scenario => { - // Construct proper paths for your app. - // This assumes app bundle created by the `hc app pack` command. - const testAppPath = process.cwd() + '/../workdir/{{app_name}}.happ'; - - // Set up the app to be installed - const appSource = { appBundleSource: { path: testAppPath } }; - - // Add 2 players with the test app to the Scenario. The returned players - // can be destructured. - const [alice, bob] = await scenario.addPlayersWithApps([appSource, appSource]); - - // Shortcut peer discovery through gossip and register all agents in every - // conductor of the scenario. - await scenario.shareAllAgents(); - -{{#if (eq from_referenceable.hash_type "AgentPubKey")}} - const baseAddress = alice.agentPubKey; -{{else}} - const baseRecord = await create{{pascal_case from_referenceable.name}}(alice.cells[0]); - {{#if (eq from_referenceable.hash_type "EntryHash")}} - const baseAddress = (baseRecord.signed_action.hashed.content as NewEntryAction).entry_hash; - {{else}} - const baseAddress = baseRecord.signed_action.hashed.hash; - {{/if}} -{{/if}} -{{#if (eq to_referenceable.hash_type "AgentPubKey")}} - const targetAddress = alice.agentPubKey; -{{else}} - const targetRecord = await create{{pascal_case to_referenceable.name}}(alice.cells[0]); - {{#if (eq to_referenceable.hash_type "EntryHash")}} - const targetAddress = (targetRecord.signed_action.hashed.content as NewEntryAction).entry_hash; - {{else}} - const targetAddress = targetRecord.signed_action.hashed.hash; - {{/if}} -{{/if}} - - // Bob gets the links, should be empty - let linksOutput: Link[] = await bob.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "get_{{plural (snake_case to_referenceable.name)}}_for_{{snake_case from_referenceable.name}}", - payload: baseAddress - }); - assert.equal(linksOutput.length, 0); - - // Alice creates a link from {{pascal_case from_referenceable.name}} to {{pascal_case to_referenceable.name}} - await alice.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "add_{{snake_case to_referenceable.name}}_for_{{snake_case from_referenceable.name}}", - payload: { - base_{{snake_case from_referenceable.singular_arg}}: baseAddress, - target_{{snake_case to_referenceable.singular_arg}}: targetAddress - } - }); - - await dhtSync([alice, bob], alice.cells[0].cell_id[0]); - - // Bob gets the links again - linksOutput = await bob.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "get_{{plural (snake_case to_referenceable.name)}}_for_{{snake_case from_referenceable.name}}", - payload: baseAddress - }); - assert.equal(linksOutput.length, 1); -{{#if (ne to_referenceable.hash_type "AgentPubKey")}} - assert.deepEqual(targetAddress, linksOutput[0].target); -{{/if}} - -{{#if bidirectional}} - - // Bob gets the links in the inverse direction - linksOutput = await bob.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "get_{{plural (snake_case from_referenceable.name)}}_for_{{snake_case to_referenceable.name}}", - payload: targetAddress - }); - assert.equal(linksOutput.length, 1); - {{#if (ne from_referenceable.hash_type "AgentPubKey")}} - assert.deepEqual(baseAddress, linksOutput[0].target); - {{/if}} -{{/if}} - -{{#if delete}} - await alice.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "delete_{{snake_case to_referenceable.name}}_for_{{snake_case from_referenceable.name}}", - payload: { - base_{{snake_case from_referenceable.singular_arg}}: baseAddress, - target_{{snake_case to_referenceable.singular_arg}}: targetAddress - } - }); - - await dhtSync([alice, bob], alice.cells[0].cell_id[0]); - - // Bob gets the links again - linksOutput = await bob.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "get_{{plural (snake_case to_referenceable.name)}}_for_{{snake_case from_referenceable.name}}", - payload: baseAddress - }); - assert.equal(linksOutput.length, 0); - - // Bob gets the deleted links - let deletedLinksOutput: Array<[SignedActionHashed, SignedActionHashed[]]> = await bob.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "get_deleted_{{plural (snake_case to_referenceable.name)}}_for_{{snake_case from_referenceable.name}}", - payload: baseAddress - }); - assert.equal(deletedLinksOutput.length, 1); - - {{#if bidirectional}} - // Bob gets the links in the inverse direction - linksOutput = await bob.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "get_{{plural (snake_case from_referenceable.name)}}_for_{{snake_case to_referenceable.name}}", - payload: targetAddress - }); - assert.equal(linksOutput.length, 0); - - // Bob gets the deleted links in the inverse direction - deletedLinksOutput = await bob.cells[0].callZome({ - zome_name: "{{coordinator_zome_manifest.name}}", - fn_name: "get_deleted_{{plural (snake_case from_referenceable.name)}}_for_{{snake_case to_referenceable.name}}", - payload: targetAddress - }); - assert.equal(deletedLinksOutput.length, 1); - {{/if}} - -{{/if}} - }); -}); diff --git "a/templates/custom-template/custom-template/template/link-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#if (and bidireccional (and to_referenceable (ne from_referenceable.hash_type 'AgentPubKey')))}}{{kebab_case (plural from_referenceable.name)}}-for-{{kebab_case to_referenceable.name}}.ts{{\302\241if}}.hbs" "b/templates/custom-template/custom-template/template/link-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#if (and bidireccional (and to_referenceable (ne from_referenceable.hash_type 'AgentPubKey')))}}{{kebab_case (plural from_referenceable.name)}}-for-{{kebab_case to_referenceable.name}}.ts{{\302\241if}}.hbs" deleted file mode 100644 index 1ddb2555a..000000000 --- "a/templates/custom-template/custom-template/template/link-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#if (and bidireccional (and to_referenceable (ne from_referenceable.hash_type 'AgentPubKey')))}}{{kebab_case (plural from_referenceable.name)}}-for-{{kebab_case to_referenceable.name}}.ts{{\302\241if}}.hbs" +++ /dev/null @@ -1,71 +0,0 @@ -import { LitElement, html } from 'lit'; -import { state, property, customElement } from 'lit/decorators.js'; -import { AgentPubKey, Link, EntryHash, ActionHash, Record, AppClient, NewEntryAction, SignalType } from '@holochain/client'; -import { consume } from '@lit-labs/context'; -import { Task } from '@lit-labs/task'; - -import { sharedStyles } from '../../shared-styles'; -import { clientContext } from '../../contexts'; -import { {{pascal_case coordinator_zome_manifest.name}}Signal } from './types'; - -import './{{kebab_case from_referenceable.name}}-detail'; - -@customElement('{{kebab_case (plural from_referenceable.name)}}-for-{{kebab_case to_referenceable.name}}') -export class {{pascal_case (plural from_referenceable.name)}}For{{pascal_case to_referenceable.name}} extends LitElement { - @consume({ context: clientContext }) - client!: AppClient; - - @property({ - hasChanged: (newVal: {{to_referenceable.hash_type}}, oldVal: {{to_referenceable.hash_type}}) => newVal?.toString() !== oldVal?.toString() - }) - {{camel_case to_referenceable.singular_arg}}!: {{to_referenceable.hash_type}}; - - _fetch{{pascal_case (plural from_referenceable.name)}} = new Task(this, ([{{camel_case to_referenceable.singular_arg}}]: Array<{{to_referenceable.hash_type}}>) => this.client.callZome({ - cap_secret: null, - role_name: '{{dna_role_name}}', - zome_name: '{{coordinator_zome_manifest.name}}', - fn_name: 'get_{{snake_case (plural from_referenceable.name)}}_for_{{snake_case to_referenceable.name}}', - payload: {{camel_case to_referenceable.singular_arg}}, - }) as Promise>, () => [this.{{camel_case to_referenceable.singular_arg}}]); - - @state() - signaledHashes: Array<{{from_referenceable.hash_type}}> = []; - - firstUpdated() { - if (!this.{{camel_case to_referenceable.singular_arg}}) { - throw new Error(`The {{camel_case to_referenceable.singular_arg}} property is required for the {{kebab_case (plural from_referenceable.name)}}-for-{{kebab_case to_referenceable.name}} element`); - } - - this.client?.on('signal', signal => { - if (!(SignalType.App in signal)) return; - if (signal.App.zome_name !== '{{coordinator_zome_manifest.name}}') return; - const payload = signal.App.payload as {{pascal_case coordinator_zome_manifest.name}}Signal; - if (payload.type !== 'LinkCreated') return; - if (payload.link_type !== '{{pascal_case bidirectional}}') return; - - this.signaledHashes = [payload.action.hashed.content.target_address, ...this.signaledHashes]; - }); - } - - renderList(hashes: Array<{{to_referenceable.hash_type}}>) { - if (!hashes.length) return html`
No {{lower_case (plural from_referenceable.name)}} found for this {{lower_case to_referenceable.name}}
`; - - return html` -
- ${hashes.map(hash => - html`<{{kebab_case from_referenceable.name}}-detail .{{camel_case from_referenceable.name}}Hash=${hash} style="margin-bottom: 16px;">` - )} -
- `; - } - - render() { - return this._fetch{{pascal_case (plural from_referenceable.name)}}.render({ - pending: () => html``, - complete: (links) => this.renderList([...this.signaledHashes, ...links.map(l => l.target)]), - error: (e: any) => html`
Error fetching the {{lower_case (plural from_referenceable.name)}}: ${e.message}.
` - }); - } - - static styles = sharedStyles; -} diff --git "a/templates/custom-template/custom-template/template/link-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#if (and to_referenceable (ne to_referenceable.hash_type 'AgentPubKey'))}}{{kebab_case (plural to_referenceable.name)}}-for-{{kebab_case from_referenceable.name}}.ts{{\302\241if}}.hbs" "b/templates/custom-template/custom-template/template/link-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#if (and to_referenceable (ne to_referenceable.hash_type 'AgentPubKey'))}}{{kebab_case (plural to_referenceable.name)}}-for-{{kebab_case from_referenceable.name}}.ts{{\302\241if}}.hbs" deleted file mode 100644 index b751dbd6a..000000000 --- "a/templates/custom-template/custom-template/template/link-type/ui/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/{{#if (and to_referenceable (ne to_referenceable.hash_type 'AgentPubKey'))}}{{kebab_case (plural to_referenceable.name)}}-for-{{kebab_case from_referenceable.name}}.ts{{\302\241if}}.hbs" +++ /dev/null @@ -1,71 +0,0 @@ -import { LitElement, html } from 'lit'; -import { state, property, customElement } from 'lit/decorators.js'; -import { AgentPubKey, Link, EntryHash, ActionHash, Record, AppClient, NewEntryAction, SignalType } from '@holochain/client'; -import { consume } from '@lit-labs/context'; -import { Task } from '@lit-labs/task'; - -import { sharedStyles } from '../../shared-styles'; -import { clientContext } from '../../contexts'; -import { {{pascal_case coordinator_zome_manifest.name}}Signal } from './types'; - -import './{{kebab_case to_referenceable.name}}-detail'; - -@customElement('{{kebab_case (plural to_referenceable.name)}}-for-{{kebab_case from_referenceable.name}}') -export class {{pascal_case (plural to_referenceable.name)}}For{{pascal_case from_referenceable.name}} extends LitElement { - @consume({ context: clientContext }) - client!: AppClient; - - @property({ - hasChanged: (newVal: {{from_referenceable.hash_type}}, oldVal: {{from_referenceable.hash_type}}) => newVal?.toString() !== oldVal?.toString() - }) - {{camel_case from_referenceable.singular_arg}}!: {{from_referenceable.hash_type}}; - - @state() - signaledHashes: Array<{{to_referenceable.hash_type}}> = []; - - _fetch{{pascal_case (plural to_referenceable.name)}} = new Task(this, ([{{camel_case from_referenceable.singular_arg}}]: Array<{{from_referenceable.hash_type}}>) => this.client.callZome({ - cap_secret: null, - role_name: '{{dna_role_name}}', - zome_name: '{{coordinator_zome_manifest.name}}', - fn_name: 'get_{{snake_case (plural to_referenceable.name)}}_for_{{snake_case from_referenceable.name}}', - payload: {{camel_case from_referenceable.singular_arg}}, - }) as Promise>, () => [this.{{camel_case from_referenceable.singular_arg}}]); - - firstUpdated() { - if (!this.{{camel_case from_referenceable.singular_arg}}) { - throw new Error(`The {{camel_case from_referenceable.singular_arg}} property is required for the {{kebab_case (plural to_referenceable.name)}}-for-{{kebab_case from_referenceable.name}} element`); - } - - this.client?.on('signal', signal => { - if (!(SignalType.App in signal)) return - if (signal.App.zome_name !== '{{coordinator_zome_manifest.name}}') return; - const payload = signal.App.payload as {{pascal_case coordinator_zome_manifest.name}}Signal; - if (payload.type !== 'LinkCreated') return; - if (payload.link_type !== '{{pascal_case link_type_name}}') return; - - this.signaledHashes = [payload.action.hashed.content.target_address, ...this.signaledHashes]; - }); - } - - renderList(hashes: Array<{{to_referenceable.hash_type}}>) { - if (!hashes.length) return html`
No {{lower_case (plural to_referenceable.name)}} found for this {{lower_case from_referenceable.name}}
`; - - return html` -
- ${hashes.map(hash => - html`<{{kebab_case to_referenceable.name}}-detail .{{camel_case to_referenceable.name}}Hash=${hash} style="margin-bottom: 16px;">` - )} -
- `; - } - - render() { - return this._fetch{{pascal_case (plural to_referenceable.name)}}.render({ - pending: () => html``, - complete: (links) => this.renderList([...this.signaledHashes, ...links.map(l => l.target)]), - error: (e: any) => html`
Error fetching the {{lower_case (plural to_referenceable.name)}}: ${e.message}.
` - }); - } - - static styles = sharedStyles; -} \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/web-app/.github/workflows/test.yaml.hbs b/templates/custom-template/custom-template/template/web-app/.github/workflows/test.yaml.hbs deleted file mode 100644 index 08bccaa26..000000000 --- a/templates/custom-template/custom-template/template/web-app/.github/workflows/test.yaml.hbs +++ /dev/null @@ -1,25 +0,0 @@ -name: "test" -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - testbuild: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Install nix - uses: cachix/install-nix-action@v27 - with: - install_url: https://releases.nixos.org/nix/nix-2.23.2/install - - - uses: cachix/cachix-action@v15 - with: - name: holochain-ci - - - name: Install and test - run: | - nix develop --command bash -c "{{(package_manager_command package_manager "install" null)}} && {{(package_manager_command package_manager "test" null)}}" diff --git a/templates/custom-template/custom-template/template/web-app/README.md.hbs b/templates/custom-template/custom-template/template/web-app/README.md.hbs deleted file mode 100644 index 0164034bc..000000000 --- a/templates/custom-template/custom-template/template/web-app/README.md.hbs +++ /dev/null @@ -1,59 +0,0 @@ -# {{title_case app_name}} - -## Environment Setup - -> PREREQUISITE: set up the [holochain development environment](https://developer.holochain.org/docs/install/). - -Enter the nix shell by running this in the root folder of the repository: - -```bash -nix develop -{{(package_manager_command package_manager "install" null)}} -``` - -**Run all the other instructions in this README from inside this nix shell, otherwise they won't work**. - -## Running 2 agents - -```bash -{{(package_manager_command package_manager "start" null)}} -``` - -This will create a network of 2 nodes connected to each other and their respective UIs. -It will also bring up the Holochain Playground for advanced introspection of the conductors. - -## Running the backend tests - -```bash -{{(package_manager_command package_manager "test" null)}} -``` - -## Bootstrapping a network - -Create a custom network of nodes connected to each other and their respective UIs with: - -```bash -AGENTS=3 {{(package_manager_command package_manager "network" null)}} -``` - -Substitute the "3" for the number of nodes that you want to bootstrap in your network. -This will also bring up the Holochain Playground for advanced introspection of the conductors. - -## Packaging - -To package the web happ: -``` bash -{{(package_manager_command package_manager "package" null)}} -``` - -You'll have the `{{app_name}}.webhapp` in `workdir`. This is what you should distribute so that the Holochain Launcher can install it. -You will also have its subcomponent `{{app_name}}.happ` in the same folder`. - -## Documentation - -This repository is using these tools: -- [NPM Workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces/): npm v7's built-in monorepo capabilities. -- [hc](https://github.com/holochain/holochain/tree/develop/crates/hc): Holochain CLI to easily manage Holochain development instances. -- [@holochain/tryorama](https://www.npmjs.com/package/@holochain/tryorama): test framework. -- [@holochain/client](https://www.npmjs.com/package/@holochain/client): client library to connect to Holochain from the UI. -- [@holochain-playground/cli](https://www.npmjs.com/package/@holochain-playground/cli): introspection tooling to understand what's going on in the Holochain nodes. diff --git a/templates/custom-template/custom-template/template/web-app/package.json.hbs b/templates/custom-template/custom-template/template/web-app/package.json.hbs deleted file mode 100644 index 19ec6e52f..000000000 --- a/templates/custom-template/custom-template/template/web-app/package.json.hbs +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "{{app_name}}-dev", - "private": true, - "workspaces": [ - "ui", - "tests" - ], - "scripts": { - "start": "AGENTS=${AGENTS:-2} BOOTSTRAP_PORT=$(get-port) SIGNAL_PORT=$(get-port) {{(package_manager_command package_manager "network" null)}}", - "network": "hc sandbox clean && {{(package_manager_command package_manager "build:happ" null)}} && UI_PORT=$(get-port) concurrently \"{{(package_manager_command package_manager "start" "ui")}}\" \"{{(package_manager_command package_manager "launch:happ" null)}}\" \"holochain-playground\"", - "test": "{{(package_manager_command package_manager "build:zomes" null)}} && hc app pack workdir --recursive && {{(package_manager_command package_manager "test" "tests")}}", - "launch:happ": "hc-spin -n $AGENTS --ui-port $UI_PORT workdir/{{app_name}}.happ", - "start:tauri": "AGENTS=${AGENTS:-2} BOOTSTRAP_PORT=$(get-port) SIGNAL_PORT=$(get-port) {{(package_manager_command package_manager "network:tauri" null)}}", - "network:tauri": "hc sandbox clean && {{(package_manager_command package_manager "build:happ" null)}} && UI_PORT=$(get-port) concurrently \"{{(package_manager_command package_manager "start" "ui")}}\" \"{{(package_manager_command package_manager "launch:tauri" null)}}\" \"holochain-playground\"", - "launch:tauri": "concurrently \"hc run-local-services --bootstrap-port $BOOTSTRAP_PORT --signal-port $SIGNAL_PORT\" \"echo pass | RUST_LOG=warn hc launch --piped -n $AGENTS workdir/{{app_name}}.happ --ui-port $UI_PORT network --bootstrap http://127.0.0.1:\"$BOOTSTRAP_PORT\" webrtc ws://127.0.0.1:\"$SIGNAL_PORT\"\"", - {{#if holo_enabled}} - "start:holo": "AGENTS=${AGENTS:-2} {{(package_manager_command package_manager "network:holo" null)}}", - "network:holo": "{{(package_manager_command package_manager "build:happ" null)}} && UI_PORT=$(get-port) concurrently \"{{(package_manager_command package_manager "launch:holo-dev-server" null)}}\" \"holochain-playground ws://localhost:4444\" \"concurrently-repeat 'VITE_APP_CHAPERONE_URL=http://localhost:24274 VITE_APP_IS_HOLO=true {{(package_manager_command package_manager "start" "ui")}}' $AGENTS\"", - "launch:holo-dev-server": "holo-dev-server workdir/{{app_name}}.happ", - {{/if}} - {{#if (eq package_manager "pnpm")}} - "postinstall": "node ./node_modules/.pnpm/node_modules/electron/install.js", - {{/if}} - "package": "{{(package_manager_command package_manager "build:happ" null)}} && {{(package_manager_command package_manager "package" "ui")}} && hc web-app pack workdir --recursive", - "build:happ": "{{(package_manager_command package_manager "build:zomes" null)}} && hc app pack workdir --recursive", - "build:zomes": "cargo build --release --target wasm32-unknown-unknown" - }, - "devDependencies": { - "@holochain-playground/cli": "{{holochain_playground_cli_version}}", - "@holochain/hc-spin": "{{hc_spin_version}}", - "concurrently": "^6.2.1", - {{#if holo_enabled}} - "concurrently-repeat": "^0.0.1", - {{/if}} - "get-port-cli": "^3.0.0" - }, - "engines": { - "node": ">=16.0.0" - } -} diff --git a/templates/custom-template/custom-template/template/web-app/tests/package.json.hbs b/templates/custom-template/custom-template/template/web-app/tests/package.json.hbs deleted file mode 100644 index 59bce775a..000000000 --- a/templates/custom-template/custom-template/template/web-app/tests/package.json.hbs +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "tests", - "version": "0.1.0", - "private": true, - "scripts": { - "test": "vitest run" - }, - "dependencies": { - "@msgpack/msgpack": "^2.8.0", - "@holochain/client": "{{holochain_client_version}}", - "@holochain/tryorama": "{{tryorama_version}}", - "typescript": "^4.9.4", - "vitest": "^0.28.4" - }, - "type": "module" -} diff --git a/templates/custom-template/custom-template/template/web-app/tests/tsconfig.json.hbs b/templates/custom-template/custom-template/template/web-app/tests/tsconfig.json.hbs deleted file mode 100644 index 88643849d..000000000 --- a/templates/custom-template/custom-template/template/web-app/tests/tsconfig.json.hbs +++ /dev/null @@ -1,9 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2017", - "module": "ESNext", - "moduleResolution": "node", - "esModuleInterop": true, - "allowSyntheticDefaultImports": true - } -} diff --git a/templates/custom-template/custom-template/template/web-app/tests/vitest.config.ts.hbs b/templates/custom-template/custom-template/template/web-app/tests/vitest.config.ts.hbs deleted file mode 100644 index ed926ca6b..000000000 --- a/templates/custom-template/custom-template/template/web-app/tests/vitest.config.ts.hbs +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - threads: false, - testTimeout: 60*1000*3 // 3 mins - }, -}) diff --git a/templates/custom-template/custom-template/template/web-app/ui/.gitignore.hbs b/templates/custom-template/custom-template/template/web-app/ui/.gitignore.hbs deleted file mode 100644 index 23452c88c..000000000 --- a/templates/custom-template/custom-template/template/web-app/ui/.gitignore.hbs +++ /dev/null @@ -1,25 +0,0 @@ -## editors -/.idea -/.vscode - -## system files -.DS_Store - -## npm -/node_modules/ -/npm-debug.log - -## testing -/coverage/ - -## temp folders -/.tmp/ - -# build -/_site/ -/dist/ -/out-tsc/ - -storybook-static -.rollup.cache -*.tsbuildinfo \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/web-app/ui/index.html.hbs b/templates/custom-template/custom-template/template/web-app/ui/index.html.hbs deleted file mode 100644 index f38b7af12..000000000 --- a/templates/custom-template/custom-template/template/web-app/ui/index.html.hbs +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - {{title_case app_name}} - - - - - - diff --git a/templates/custom-template/custom-template/template/web-app/ui/package.json.hbs b/templates/custom-template/custom-template/template/web-app/ui/package.json.hbs deleted file mode 100644 index 61c0fcf8f..000000000 --- a/templates/custom-template/custom-template/template/web-app/ui/package.json.hbs +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "ui", - "version": "0.1.0", - "scripts": { - "start": "vite --port $UI_PORT --clearScreen false", - "build": "vite build", - {{#if holo_enabled}} - "build:holo": "VITE_APP_IS_HOLO=true vite build", - "package:holo": "{{(package_manager_command package_manager "build:holo" null)}} && rimraf dist.zip && cd dist && bestzip ../dist.zip *", - {{/if}} - "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore", - "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore", - "package": "{{(package_manager_command package_manager "build" null)}} && rimraf dist.zip && cd dist && bestzip ../dist.zip *" - }, - "dependencies": { - "@holochain/client": "{{holochain_client_version}}", - {{#if holo_enabled}} - "@holo-host/web-sdk": "{{holo_web_sdk_version}}", - {{/if}} - "@lit-labs/context": "^0.2.0", - "@lit-labs/task": "^2.0.0", - "@msgpack/msgpack": "^2.8.0", - "lit": "^2.6.1" - }, - "devDependencies": { - "@open-wc/eslint-config": "^4.3.0", - "@typescript-eslint/eslint-plugin": "^5.43.0", - "@typescript-eslint/parser": "^5.43.0", - "bestzip": "^2.2.0", - "eslint": "^7.32.0", - "eslint-config-prettier": "^8.3.0", - "prettier": "^2.3.2", - "rimraf": "^5.0.7", - "vite": "^4.0.0", - "vite-plugin-checker": "^0.5.3", - "typescript": "^4.5.5", - "tslib": "^2.6.3" - }, - "eslintConfig": { - "parser": "@typescript-eslint/parser", - "extends": [ - "@open-wc", - "prettier" - ], - "plugins": [ - "@typescript-eslint" - ], - "rules": { - "wc/guard-super-call": "off", - "prefer-destructuring": "off", - "no-useless-constructor": "off", - "no-empty-function": "off", - "no-nested-ternary": "off", - "no-empty-pattern": "off", - "no-console": "off", - "no-alert": "off", - "no-param-reassign": "off", - "camelcase": "off", - "import/no-duplicates": "off", - "no-unused-vars": "off", - "class-methods-use-this": "off", - "@typescript-eslint/no-unused-vars": "off", - "import/no-unresolved": "off", - "import/extensions": "off", - "no-use-before-define": "off", - "lines-between-class-members": "off" - } - }, - "prettier": { - "singleQuote": true, - "arrowParens": "avoid" - }, - "type": "module" -} diff --git a/templates/custom-template/custom-template/template/web-app/ui/src/assets/holochainLogo.svg.hbs b/templates/custom-template/custom-template/template/web-app/ui/src/assets/holochainLogo.svg.hbs deleted file mode 100644 index d5b87c953..000000000 --- a/templates/custom-template/custom-template/template/web-app/ui/src/assets/holochainLogo.svg.hbs +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/templates/custom-template/custom-template/template/web-app/ui/src/contexts.ts.hbs b/templates/custom-template/custom-template/template/web-app/ui/src/contexts.ts.hbs deleted file mode 100644 index e947aaaf0..000000000 --- a/templates/custom-template/custom-template/template/web-app/ui/src/contexts.ts.hbs +++ /dev/null @@ -1,4 +0,0 @@ -import { createContext } from '@lit-labs/context'; -import { AppClient } from '@holochain/client'; - -export const clientContext = createContext('AppClient'); \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/web-app/ui/src/declarations.d.ts.hbs b/templates/custom-template/custom-template/template/web-app/ui/src/declarations.d.ts.hbs deleted file mode 100644 index bf581f294..000000000 --- a/templates/custom-template/custom-template/template/web-app/ui/src/declarations.d.ts.hbs +++ /dev/null @@ -1,9 +0,0 @@ -declare module '*.svg' { - const content: string; - export default content; -} - -declare module '*.css' { - const content: string; - export default content; -} \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/web-app/ui/src/holochain-app.ts.hbs b/templates/custom-template/custom-template/template/web-app/ui/src/holochain-app.ts.hbs deleted file mode 100644 index 59a6ffcba..000000000 --- a/templates/custom-template/custom-template/template/web-app/ui/src/holochain-app.ts.hbs +++ /dev/null @@ -1,125 +0,0 @@ -import { LitElement, html, css } from 'lit'; -import { customElement, property, state } from 'lit/decorators.js'; -import { AppWebsocket, ActionHash, AppClient, HolochainError } from '@holochain/client'; -{{#if holo_enabled}} -import WebSdk from '@holo-host/web-sdk' -import type { AgentState } from '@holo-host/web-sdk'; -{{/if}} -import { provide } from '@lit-labs/context'; - -import { sharedStyles } from './shared-styles'; -import HolochainLogo from "./assets/holochainLogo.svg"; -import { clientContext } from './contexts'; - -{{#if holo_enabled}} -const IS_HOLO = ['true', '1', 't'].includes(import.meta.env.VITE_APP_IS_HOLO?.toLowerCase()) -{{/if}} - -@customElement('holochain-app') -export class HolochainApp extends LitElement { - @state() loading = false; - - @state() - error: HolochainError | undefined; - - @provide({ context: clientContext }) - @property({ type: Object }) - client!: AppClient; - - async firstUpdated() { - this.loading = true; -{{#if holo_enabled}} - try { - if (IS_HOLO) { - const client = await WebSdk.connect({ - chaperoneUrl: import.meta.env.VITE_APP_CHAPERONE_URL, - authFormCustomization: { - appName: '{{app_name}}', - } - }); - - client.on('agent-state', (agent_state: AgentState) => { - this.loading = !agent_state.isAvailable || agent_state.isAnonymous; - }); - - client.signUp({ cancellable: false }); - this.client = client; - } else { - this.client = await AppWebsocket.connect(); - } - } catch(e) { - this.error = e as HolochainError; - } finally { - this.loading = false; - } -{{else}} - try { - this.client = await AppWebsocket.connect(); - } catch(e) { - this.error = e as HolochainError; - } finally { - this.loading = false; - } -{{/if}} - } - -{{#if holo_enabled}} - async logout() { - await (this.client as WebSdk).signOut(); - await (this.client as WebSdk).signIn({ cancellable: false }); - } -{{/if}} - - render() { - if (this.loading) return html``; - return html` -
-
- - - -
-

Holochain Lit hApp

-
-
- ${this.loading ? html`

connecting...

` : ''} - ${this.error ? html`

${this.error.message}

` : html`

Client is connected.

`} -
-

Import scaffolded components into src/holochain-app.ts to use your hApp

-

Click on the Holochain logo to learn more

-
-{{#if holo_enabled}} - ${IS_HOLO ? html``: ''} -{{/if}} -
- `; - } - - static styles = css` - ${sharedStyles} - - .logo { - height: 15em; - padding: 1.5em; - will-change: filter; - transition: filter 300ms; - width: auto; - } - - .logo:hover { - filter: drop-shadow(0 0 2em #646cffaa); - } - - .logo.holochain:hover { - filter: drop-shadow(0 0 2em #61dafbaa); - } - - .card { - padding: 2em; - } - - .read-the-docs { - color: #888; - } - `; -} \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/web-app/ui/src/index.css.hbs b/templates/custom-template/custom-template/template/web-app/ui/src/index.css.hbs deleted file mode 100644 index 9cb3efd2c..000000000 --- a/templates/custom-template/custom-template/template/web-app/ui/src/index.css.hbs +++ /dev/null @@ -1,261 +0,0 @@ -:root { - font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; - line-height: 1.5; - font-weight: 400; - - color-scheme: light dark; - color: rgba(255, 255, 255, 0.87); - background-color: #242424; - - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -a { - font-weight: 500; - color: #646cff; - text-decoration: inherit; -} -a:hover { - color: #535bf2; -} - -body { - margin: 0; - display: flex; - justify-content: center; - text-align: center; - align-items: center; - min-width: 320px; - min-height: 100vh; -} - -h1 { - font-size: 3.2em; - line-height: 1.1; -} - -button { - border-radius: 8px; - border: 1px solid transparent; - padding: 0.6em 1.2em; - font-size: 1em; - font-weight: 500; - font-family: inherit; - background-color: #1a1a1a; - cursor: pointer; - transition: border-color 0.25s; -} -button:hover { - border-color: #646cff; -} -button:focus, -button:focus-visible { - outline: 4px auto -webkit-focus-ring-color; -} - -@media (prefers-color-scheme: light) { - :root { - color: #213547; - background-color: #ffffff; - } - a:hover { - color: #747bff; - } - button { - background-color: #f9f9f9; - } -} - -label { - display: block; - margin-bottom: 0.5em; - font-weight: 500; -} - -input { - display: block; - width: 540px; - padding: 0.75em; - margin: 0.5em 0; - border: 1px solid #ccc; - border-radius: 4px; - font-family: inherit; - font-size: 1em; - color: inherit; - background-color: #2c2c2c; - transition: border-color 0.25s, box-shadow 0.25s; -} - -input[type="checkbox"] { - display: inline-block; - width: auto; - margin-bottom: 1em; - transform: scale(1.5); - margin-right: 0.5em; - vertical-align: middle; -} - -input:focus { - outline: none; - border-color: #646cff; - box-shadow: 0 0 0 4px rgba(100, 108, 255, 0.2); -} - -textarea { - display: block; - width: 540px; - height: 150px; - padding: 0.75em; - margin: 0.5em 0; - border: 1px solid #ccc; - border-radius: 4px; - font-family: inherit; - font-size: 1em; - color: inherit; - background-color: #2c2c2c; - transition: border-color 0.25s, box-shadow 0.25s; - resize: none; -} - -textarea:focus { - outline: none; - border-color: #646cff; - box-shadow: 0 0 0 4px rgba(100, 108, 255, 0.2); -} - -@media (prefers-color-scheme: light) { - input, - textarea { - background-color: #ffffff; - border-color: #ccc; - } - - input:focus, - textarea:focus { - border-color: #646cff; - box-shadow: 0 0 0 4px rgba(100, 108, 255, 0.2); - } -} - -select { - display: block; - width: 566px; - padding: 0.75em; - margin: 1em 0; - border: 1px solid #ccc; - border-radius: 4px; - font-family: inherit; - font-size: 1em; - color: inherit; - background-color: #2c2c2c; - transition: border-color 0.25s, box-shadow 0.25s; -} - -select:focus { - outline: none; - border-color: #646cff; - box-shadow: 0 0 0 4px rgba(100, 108, 255, 0.2); -} - -@media (prefers-color-scheme: light) { - select { - background-color: #ffffff; - border-color: #ccc; - } - - select:focus { - border-color: #646cff; - box-shadow: 0 0 0 4px rgba(100, 108, 255, 0.2); - } -} - -.alert { - font-size: 1.2em; - font-weight: bold; - color: rgba(255, 255, 255, 0.87); - text-align: center; - padding: 2rem; - background-color: #333333; - border: 1px solid #555555; - border-radius: 8px; - box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); - margin: 1rem auto; - max-width: 500px; -} - -section { - padding: 2rem; - margin: 1rem 0; - background-color: #333333; - border: 1px solid #555555; - border-radius: 8px; - box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3); - transition: transform 0.3s, box-shadow 0.3s; - max-width: 500px; -} - -section:hover { - transform: translateY(-5px); - box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4); -} - -section div { - margin-bottom: 1.5rem; - padding: 1rem; - background-color: #444444; - border: 1px solid #666666; - border-radius: 4px; -} - -section input { - width: 440px; -} - -section select { - width: 464px; -} - -section textarea { - width: 440px; -} - -section div:last-child { - margin-bottom: 0; -} - -section p, -section span { - margin: 0; - font-size: 1em; - line-height: 1.6; - color: rgba(255, 255, 255, 0.87); -} - -section div:has(button) { - display: flex; - justify-content: space-between; - align-items: center; -} - -progress { - width: 100%; - height: 1.5em; -} - -progress::-webkit-progress-bar { - background-color: #444444; - border-radius: 8px; -} - -progress::-webkit-progress-value { - background-color: #646cff; - border-radius: 8px; -} - -progress::-moz-progress-bar { - background-color: #646cff; - border-radius: 8px; -} diff --git a/templates/custom-template/custom-template/template/web-app/ui/src/shared-styles.ts.hbs b/templates/custom-template/custom-template/template/web-app/ui/src/shared-styles.ts.hbs deleted file mode 100644 index 5080ba072..000000000 --- a/templates/custom-template/custom-template/template/web-app/ui/src/shared-styles.ts.hbs +++ /dev/null @@ -1,4 +0,0 @@ -import { css, unsafeCSS } from 'lit'; -import styles from './index.css'; - -export const sharedStyles = css`${unsafeCSS(styles)}`; \ No newline at end of file diff --git a/templates/custom-template/custom-template/template/web-app/ui/tsconfig.json.hbs b/templates/custom-template/custom-template/template/web-app/ui/tsconfig.json.hbs deleted file mode 100644 index 89a6f6466..000000000 --- a/templates/custom-template/custom-template/template/web-app/ui/tsconfig.json.hbs +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "target": "es2018", - "module": "esnext", - "moduleResolution": "node", - "noEmitOnError": true, - "useDefineForClassFields": false, - "lib": ["es2017", "dom"], - "strict": true, - "esModuleInterop": false, - "allowSyntheticDefaultImports": true, - "experimentalDecorators": true, - "importHelpers": true, - "outDir": "dist", - "sourceMap": true, - "inlineSources": true, - "incremental": true, - {{#if holo_enabled}} - "types": ["vite/client"], - {{/if}} - "skipLibCheck": true - }, - "include": ["src/**/*.ts", "src/**/*.d.ts"] -} diff --git a/templates/custom-template/custom-template/template/web-app/ui/vite.config.ts.hbs b/templates/custom-template/custom-template/template/web-app/ui/vite.config.ts.hbs deleted file mode 100644 index b8181d30d..000000000 --- a/templates/custom-template/custom-template/template/web-app/ui/vite.config.ts.hbs +++ /dev/null @@ -1,13 +0,0 @@ -import { defineConfig } from 'vite'; -import checker from 'vite-plugin-checker'; - -export default defineConfig({ - plugins: [ - checker({ - typescript: true, - eslint: { - lintCommand: 'eslint --ext .ts,.html . --ignore-path .gitignore', - }, - }), - ] -});