From 1c81d471e1b59be769e35c11a306cd70e49e799c Mon Sep 17 00:00:00 2001 From: "guillem.cordoba" Date: Tue, 5 Mar 2024 19:03:28 +0100 Subject: [PATCH] WIP --- run_test_app.sh | 2 + run_test_module.sh | 2 + .../{{snake_case collection_name}}.rs.hbs | 2 +- .../{{zome_manifest.name}}/Cargo.toml.hbs | 2 +- .../{{zome_manifest.name}}/zome.nix.hbs | 46 +++++++++++++++ .../app/dna/dnas/{{dna_name}}/dna.nix.hbs | 35 ++++++++++++ .../{{snake_case entry_type.name}}.rs.hbs | 8 +-- .../zome.nix.hbs" | 15 +++++ ...eferenceable.name)}}.rs{{\302\241if}}.hbs" | 2 +- templates/app/web-app/flake.nix.hbs | 56 ++++++++++++++++--- templates/app/web-app/happ.nix.hbs | 30 ++++++++++ templates/app/web-app/optimize-wasms.sh.hbs | 5 -- templates/app/web-app/package.json.hbs | 5 +- templates/app/web-app/ui/package.json.hbs | 2 +- templates/app/web-app/ui/vite.config.ts.hbs | 29 ---------- templates/app/web-app/workdir/app-path.ts.hbs | 5 ++ .../{{snake_case collection_name}}.rs.hbs | 3 +- .../{{zome_manifest.name}}/Cargo.toml.hbs | 2 +- .../{{snake_case entry_type.name}}.rs.hbs | 8 +-- ...eferenceable.name)}}.rs{{\302\241if}}.hbs" | 2 +- .../{{snake_case app_name}}/Cargo.toml.hbs | 2 +- 21 files changed, 201 insertions(+), 62 deletions(-) create mode 100644 templates/app/coordinator-zome/dnas/{{dna_role_name}}/zomes/coordinator/{{zome_manifest.name}}/zome.nix.hbs create mode 100644 templates/app/dna/dnas/{{dna_name}}/dna.nix.hbs create mode 100644 "templates/app/integrity-zome/dnas/{{dna_role_name}}/zomes/integrity/{{replace zome_manifest.name \"_integrity\" \"\" }}/zome.nix.hbs" create mode 100644 templates/app/web-app/happ.nix.hbs delete mode 100644 templates/app/web-app/optimize-wasms.sh.hbs create mode 100644 templates/app/web-app/workdir/app-path.ts.hbs diff --git a/run_test_app.sh b/run_test_app.sh index 44a5bf1..2137d01 100644 --- a/run_test_app.sh +++ b/run_test_app.sh @@ -35,6 +35,8 @@ hc-scaffold link-type comment like --delete true --bidirectional false hc-scaffold link-type certificate like --delete false --bidirectional false hc-scaffold link-type agent:creator post --delete false --bidirectional false +git add . + npm i npm i -w ui @holochain-open-dev/file-storage diff --git a/run_test_module.sh b/run_test_module.sh index 0a78858..ab6ea08 100644 --- a/run_test_module.sh +++ b/run_test_module.sh @@ -32,6 +32,8 @@ hc-scaffold link-type --zome posts_integrity comment like --delete true --bidir hc-scaffold link-type --zome posts_integrity certificate like --delete false --bidirectional false hc-scaffold link-type --zome posts_integrity agent:creator post --delete false --bidirectional false +git add . + npm i npm run format -w ui diff --git a/templates/app/collection/dnas/{{dna_role_name}}/zomes/coordinator/{{snake_case coordinator_zome_manifest.name}}/tests/{{snake_case collection_name}}.rs.hbs b/templates/app/collection/dnas/{{dna_role_name}}/zomes/coordinator/{{snake_case coordinator_zome_manifest.name}}/tests/{{snake_case collection_name}}.rs.hbs index 4773cc3..0905652 100644 --- a/templates/app/collection/dnas/{{dna_role_name}}/zomes/coordinator/{{snake_case coordinator_zome_manifest.name}}/tests/{{snake_case collection_name}}.rs.hbs +++ b/templates/app/collection/dnas/{{dna_role_name}}/zomes/coordinator/{{snake_case coordinator_zome_manifest.name}}/tests/{{snake_case collection_name}}.rs.hbs @@ -14,7 +14,7 @@ async fn create_a_{{snake_case referenceable.name}}_and_get_{{snake_case collect // Use prebuilt dna file let dna_path = std::env::current_dir() .unwrap() - .join("../../../workdir/{{dna_role_name}}.dna"); + .join(std::env::var("DNA_PATH").expect("DNA_PATH not set, must be run using nix flake check")); let dna = SweetDnaFile::from_bundle(&dna_path).await.unwrap(); // Set up conductors diff --git a/templates/app/coordinator-zome/dnas/{{dna_role_name}}/zomes/coordinator/{{zome_manifest.name}}/Cargo.toml.hbs b/templates/app/coordinator-zome/dnas/{{dna_role_name}}/zomes/coordinator/{{zome_manifest.name}}/Cargo.toml.hbs index d0967b1..c21d7f6 100644 --- a/templates/app/coordinator-zome/dnas/{{dna_role_name}}/zomes/coordinator/{{zome_manifest.name}}/Cargo.toml.hbs +++ b/templates/app/coordinator-zome/dnas/{{dna_role_name}}/zomes/coordinator/{{zome_manifest.name}}/Cargo.toml.hbs @@ -1,7 +1,7 @@ {{previous_file_content}} [dev-dependencies] -fixt = "*" +fixt = "0.3.0-beta-dev" futures = { version = "0.3.1", default-features = false } hdk = { workspace = true, features = ["encoding", "test_utils"] } holochain = { workspace = true } diff --git a/templates/app/coordinator-zome/dnas/{{dna_role_name}}/zomes/coordinator/{{zome_manifest.name}}/zome.nix.hbs b/templates/app/coordinator-zome/dnas/{{dna_role_name}}/zomes/coordinator/{{zome_manifest.name}}/zome.nix.hbs new file mode 100644 index 0000000..75aab3a --- /dev/null +++ b/templates/app/coordinator-zome/dnas/{{dna_role_name}}/zomes/coordinator/{{zome_manifest.name}}/zome.nix.hbs @@ -0,0 +1,46 @@ +{ inputs, rootPath, ... }: + +{ + perSystem = + { inputs' + , self' + , ... + }: { + packages.{{zome_manifest.name}} = inputs.hcUtils.outputs.lib.rustZome { + workspacePath = rootPath; + holochain = inputs'.holochain; + crateCargoTomlPath = ./Cargo.toml; + }; + + # Test only this zome and its integrity in isolation + checks.{{zome_manifest.name }}= inputs.hcUtils.outputs.lib.sweettest { + workspacePath = rootPath; + holochain = inputs'.holochain; + dna = inputs.hcUtils.outputs.lib.dna { + dnaManifest = '' + --- + manifest_version: "1" + name: test_dna + integrity: + network_seed: ~ + properties: ~ + origin_time: 1709638576394039 + zomes: + - name: {{zome_manifest.name}}_integrity + coordinator: + zomes: + - name: my_zome + hash: ~ + dependencies: + - {{zome_manifest.name}}_integrity + dylib: ~ + ''; + zomes = inputs.hcUtils.outputs.lib.filterZomes self'.packages; + holochain = inputs'.holochain; + }; + crateCargoTomlPath = ./Cargo.toml; + }; + + }; +} + diff --git a/templates/app/dna/dnas/{{dna_name}}/dna.nix.hbs b/templates/app/dna/dnas/{{dna_name}}/dna.nix.hbs new file mode 100644 index 0000000..322d573 --- /dev/null +++ b/templates/app/dna/dnas/{{dna_name}}/dna.nix.hbs @@ -0,0 +1,35 @@ +{ inputs, holochainSources, ... }: + +{ + # Import all ./zomes/coordinator/*/zome.nix and ./zomes/integrity/*/zome.nix + imports = ( + map (m: "${./.}/zomes/coordinator/${m}/zome.nix") + (builtins.attrNames (builtins.readDir ./zomes/coordinator)) + ) + ++ + ( + map (m: "${./.}/zomes/integrity/${m}/zome.nix") + (builtins.attrNames (builtins.readDir ./zomes/integrity)) + ) + ; + perSystem = + { inputs' + , self' + , lib + , ... + }: { + packages.{{dna_name}} = inputs.hcUtils.outputs.lib.dna { + dnaManifestPath = ./workdir/dna.yaml; + holochain = inputs'.holochain; + zomes = inputs.hcUtils.outputs.lib.filterZomes ( + inputs.nixpkgs.lib.attrsets.mergeAttrsList ( + [ self'.packages ] + ++ builtins.map (s: s.packages) holochainSources inputs' + ) # Merge all the holochain packages from this repository with the holochain sources repositories + ) // { + # Override specific zomes here, e.g.: + # profiles_integrity = inputs'.profiles.packages.profiles_integrity; + }; + }; + }; +} diff --git a/templates/app/entry-type/dnas/{{dna_role_name}}/zomes/coordinator/{{snake_case coordinator_zome_manifest.name}}/tests/{{snake_case entry_type.name}}.rs.hbs b/templates/app/entry-type/dnas/{{dna_role_name}}/zomes/coordinator/{{snake_case coordinator_zome_manifest.name}}/tests/{{snake_case entry_type.name}}.rs.hbs index 5beca6c..8ea58e2 100644 --- a/templates/app/entry-type/dnas/{{dna_role_name}}/zomes/coordinator/{{snake_case coordinator_zome_manifest.name}}/tests/{{snake_case entry_type.name}}.rs.hbs +++ b/templates/app/entry-type/dnas/{{dna_role_name}}/zomes/coordinator/{{snake_case coordinator_zome_manifest.name}}/tests/{{snake_case entry_type.name}}.rs.hbs @@ -30,7 +30,7 @@ async fn create_{{snake_case entry_type.name}}_test() { // Use prebuilt dna file let dna_path = std::env::current_dir() .unwrap() - .join("../../../workdir/{{dna_role_name}}.dna"); + .join(std::env::var("DNA_PATH").expect("DNA_PATH not set, must be run using nix flake check")); let dna = SweetDnaFile::from_bundle(&dna_path).await.unwrap(); // Set up conductors @@ -56,7 +56,7 @@ async fn create_and_read_{{snake_case entry_type.name}}() { // Use prebuilt dna file let dna_path = std::env::current_dir() .unwrap() - .join("../../../workdir/{{dna_role_name}}.dna"); + .join(std::env::var("DNA_PATH").expect("DNA_PATH not set, must be run using nix flake check")); let dna = SweetDnaFile::from_bundle(&dna_path).await.unwrap(); // Set up conductors @@ -95,7 +95,7 @@ async fn create_and_update_{{snake_case entry_type.name}}() { // Use prebuilt dna file let dna_path = std::env::current_dir() .unwrap() - .join("../../../workdir/{{dna_role_name}}.dna"); + .join(std::env::var("DNA_PATH").expect("DNA_PATH not set, must be run using nix flake check")); let dna = SweetDnaFile::from_bundle(&dna_path).await.unwrap(); // Set up conductors @@ -173,7 +173,7 @@ async fn create_and_delete_{{snake_case entry_type.name}}() { // Use prebuilt dna file let dna_path = std::env::current_dir() .unwrap() - .join("../../../workdir/{{dna_role_name}}.dna"); + .join(std::env::var("DNA_PATH").expect("DNA_PATH not set, must be run using nix flake check")); let dna = SweetDnaFile::from_bundle(&dna_path).await.unwrap(); // Set up conductors diff --git "a/templates/app/integrity-zome/dnas/{{dna_role_name}}/zomes/integrity/{{replace zome_manifest.name \"_integrity\" \"\" }}/zome.nix.hbs" "b/templates/app/integrity-zome/dnas/{{dna_role_name}}/zomes/integrity/{{replace zome_manifest.name \"_integrity\" \"\" }}/zome.nix.hbs" new file mode 100644 index 0000000..570f4cc --- /dev/null +++ "b/templates/app/integrity-zome/dnas/{{dna_role_name}}/zomes/integrity/{{replace zome_manifest.name \"_integrity\" \"\" }}/zome.nix.hbs" @@ -0,0 +1,15 @@ +{ inputs, rootPath, ... }: + +{ + perSystem = + { inputs' + , ... + }: { + packages.{{zome_manifest.name}} = inputs.hcUtils.outputs.lib.rustZome { + workspacePath = rootPath; + holochain = inputs'.holochain; + crateCargoTomlPath = ./Cargo.toml; + }; + }; +} + diff --git "a/templates/app/link-type/dnas/{{dna_role_name}}/zomes/coordinator/{{snake_case coordinator_zome_manifest.name}}/tests/{{#if to_referenceable}}{{snake_case from_referenceable.name}}_to_{{snake_case (plural to_referenceable.name)}}.rs{{\302\241if}}.hbs" "b/templates/app/link-type/dnas/{{dna_role_name}}/zomes/coordinator/{{snake_case coordinator_zome_manifest.name}}/tests/{{#if to_referenceable}}{{snake_case from_referenceable.name}}_to_{{snake_case (plural to_referenceable.name)}}.rs{{\302\241if}}.hbs" index 33116d6..2db1e53 100644 --- "a/templates/app/link-type/dnas/{{dna_role_name}}/zomes/coordinator/{{snake_case coordinator_zome_manifest.name}}/tests/{{#if to_referenceable}}{{snake_case from_referenceable.name}}_to_{{snake_case (plural to_referenceable.name)}}.rs{{\302\241if}}.hbs" +++ "b/templates/app/link-type/dnas/{{dna_role_name}}/zomes/coordinator/{{snake_case coordinator_zome_manifest.name}}/tests/{{#if to_referenceable}}{{snake_case from_referenceable.name}}_to_{{snake_case (plural to_referenceable.name)}}.rs{{\302\241if}}.hbs" @@ -24,7 +24,7 @@ async fn link_a_{{snake_case from_referenceable.name}}_to_a_{{snake_case to_refe // Use prebuilt dna file let dna_path = std::env::current_dir() .unwrap() - .join("../../../workdir/{{dna_role_name}}.dna"); + .join(std::env::var("DNA_PATH").expect("DNA_PATH not set, must be run using nix flake check")); let dna = SweetDnaFile::from_bundle(&dna_path).await.unwrap(); // Set up conductors diff --git a/templates/app/web-app/flake.nix.hbs b/templates/app/web-app/flake.nix.hbs index 8c5a9a4..6a1b9a0 100644 --- a/templates/app/web-app/flake.nix.hbs +++ b/templates/app/web-app/flake.nix.hbs @@ -1,12 +1,48 @@ -{{#merge previous_file_content}} - {{#match_scope "inputs = {"}} - {{previous_scope_content}} +{ + description = "Template for Holochain app development"; - scaffolding.url = "github:holochain-open-dev/templates"; - {{/match_scope}} - {{#match_scope "devShells.default = pkgs.mkShell {"}} + inputs = { + versions.url = "github:holochain/holochain?dir=versions/weekly"; - inputsFrom = [ inputs'.holochain-flake.devShells.holonix ]; + holochain.url = "github:holochain/holochain"; + holochain.inputs.versions.follows = "versions"; + + nixpkgs.follows = "holochain/nixpkgs"; + flake-parts.follows = "holochain/flake-parts"; + + scaffolding.url = "github:holochain-open-dev/templates"; + hcUtils.url = "github:holochain-open-dev/common"; + + # hApp dependencies + profiles.url = "github:holochain-open-dev/profiles/nixify"; + }; + + outputs = inputs: + inputs.flake-parts.lib.mkFlake + { + inherit inputs; + specialArgs.rootPath = ./.; + # All the repositories that output zomes, dnas or happs packages + specialArgs.holochainSources = inputs': with inputs'; [ + profiles + # Add more here + ]; + } + { + imports = [ + ./happ.nix + ]; + + systems = builtins.attrNames inputs.holochain.devShells; + perSystem = + { inputs' + , config + , pkgs + , system + , ... + }: { + devShells.default = pkgs.mkShell { + inputsFrom = [ inputs'.holochain.devShells.holonix ]; packages = with pkgs; [ nodejs_20 @@ -14,5 +50,7 @@ ] ++ [ inputs'.scaffolding.packages.hc-scaffold-app-template ]; - {{/match_scope}} -{{/merge}} + }; + }; + }; +} diff --git a/templates/app/web-app/happ.nix.hbs b/templates/app/web-app/happ.nix.hbs new file mode 100644 index 0000000..d62a061 --- /dev/null +++ b/templates/app/web-app/happ.nix.hbs @@ -0,0 +1,30 @@ +{ inputs, holochainSources, ... }: + +{ + # Import all `dnas/*/dna.nix` files + imports = ( + map (m: "${./.}/dnas/${m}/dna.nix") + (builtins.attrNames (if builtins.pathExists ./dnas then builtins.readDir ./dnas else {} )) + ); + + perSystem = + { inputs' + , lib + , self' + , ... + }: { + packages.{{snake_case app_name}} = inputs.hcUtils.outputs.lib.happ { + holochain = inputs'.holochain; + happManifestPath = ./workdir/happ.yaml; + dnas = inputs.hcUtils.outputs.lib.filterDnas ( + inputs.nixpkgs.lib.attrsets.mergeAttrsList ( + [ self'.packages ] + ++ builtins.map (s: s.packages) holochainSources inputs' + ) # Merge all the holochain packages from this repository with the holochain sources repositories + ) // { + # Override specific dnas here, e.g.: + # my_dna = inputs'.some_input.packages.my_dna; + }; + }; + }; +} diff --git a/templates/app/web-app/optimize-wasms.sh.hbs b/templates/app/web-app/optimize-wasms.sh.hbs deleted file mode 100644 index 825a8c3..0000000 --- a/templates/app/web-app/optimize-wasms.sh.hbs +++ /dev/null @@ -1,5 +0,0 @@ -WASMS="./target/wasm32-unknown-unknown/release/*.wasm" -for f in $WASMS; do - echo "Optimizing $f zome..."; - wasm-opt -Oz --strip-debug -o $f $f -done diff --git a/templates/app/web-app/package.json.hbs b/templates/app/web-app/package.json.hbs index 856011b..0fbe298 100644 --- a/templates/app/web-app/package.json.hbs +++ b/templates/app/web-app/package.json.hbs @@ -10,9 +10,8 @@ "network": "hc s clean && npm run build:happ && UI_PORT=8888 concurrently -k \"npm start -w ui\" \"npm run launch:happ\" \"holochain-playground\"", "test": "npm run build:happ && cargo nextest run -j 1 && npm test -w tests", "launch:happ": "echo \"pass\" | RUST_LOG=warn hc launch --piped -n $AGENTS workdir/{{app_name}}.happ --ui-port $UI_PORT network -b https://bootstrap.holo.host webrtc wss://signal.holo.host", - "package": "npm run build:zomes && sh optimize-wasms.sh && npm run package -w ui && hc web-app pack workdir --recursive", - "build:happ": "npm run build:zomes && hc app pack workdir --recursive", - "build:zomes": "CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown" + "package": "nix build .#{{snake_case app_name}} -o workdir/{{snake_case app_name}}.happ && npm run package -w ui && hc web-app pack workdir --recursive", + "build:happ": "nix build .#{{snake_case app_name}}.meta.debug -o workdir/{{snake_case app_name}}-debug.happ" }, "devDependencies": { "@holochain-playground/cli": "^0.1.0", diff --git a/templates/app/web-app/ui/package.json.hbs b/templates/app/web-app/ui/package.json.hbs index 5af49c8..5bb090e 100644 --- a/templates/app/web-app/ui/package.json.hbs +++ b/templates/app/web-app/ui/package.json.hbs @@ -13,7 +13,7 @@ "dependencies": { "@holochain/client": "^0.17.0-dev.7", "@holochain-open-dev/elements": "^0.8.4", - "@holochain-open-dev/profiles": "^0.17.3", + "@holochain-open-dev/profiles": "https://gitpkg.now.sh/holochain-open-dev/profiles/ui?nixify", "@holochain-open-dev/stores": "^0.8.11", "@holochain-open-dev/utils": "^0.16.5", "@lit/context": "^1.0.0", diff --git a/templates/app/web-app/ui/vite.config.ts.hbs b/templates/app/web-app/ui/vite.config.ts.hbs index a4224b2..9e0450c 100644 --- a/templates/app/web-app/ui/vite.config.ts.hbs +++ b/templates/app/web-app/ui/vite.config.ts.hbs @@ -3,36 +3,7 @@ import checker from "vite-plugin-checker"; import path from "path"; import { viteStaticCopy } from "vite-plugin-static-copy"; -const components = [ - "dropdown", - "menu", - "menu-item", - "checkbox", - "divider", - "menu-label", - "option", - "select", - "tooltip", - "card", - "icon-button", - "button", - "icon", - "alert", - "input", - "spinner", - "avatar", - "skeleton", -]; -const exclude = components.map( - (c) => `@shoelace-style/shoelace/dist/components/${c}/${c}.js` -); export default defineConfig({ - optimizeDeps: { - exclude: [ - ...exclude, - "@holochain-open-dev/elements/dist/elements/display-error.js", - ], - }, plugins: [ checker({ typescript: true, diff --git a/templates/app/web-app/workdir/app-path.ts.hbs b/templates/app/web-app/workdir/app-path.ts.hbs new file mode 100644 index 0000000..df63394 --- /dev/null +++ b/templates/app/web-app/workdir/app-path.ts.hbs @@ -0,0 +1,5 @@ +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +export const appPath = + dirname(fileURLToPath(import.meta.url)) + '/../../workdir/{{snake_case app_name}}-debug.happ'; diff --git a/templates/module/collection/zomes/coordinator/{{snake_case app_name}}/tests/{{snake_case collection_name}}.rs.hbs b/templates/module/collection/zomes/coordinator/{{snake_case app_name}}/tests/{{snake_case collection_name}}.rs.hbs index 4773cc3..f7b3803 100644 --- a/templates/module/collection/zomes/coordinator/{{snake_case app_name}}/tests/{{snake_case collection_name}}.rs.hbs +++ b/templates/module/collection/zomes/coordinator/{{snake_case app_name}}/tests/{{snake_case collection_name}}.rs.hbs @@ -14,7 +14,8 @@ async fn create_a_{{snake_case referenceable.name}}_and_get_{{snake_case collect // Use prebuilt dna file let dna_path = std::env::current_dir() .unwrap() - .join("../../../workdir/{{dna_role_name}}.dna"); + .join(std::env::var("DNA_PATH").expect("DNA_PATH not set, must be run using nix flake check")); + let dna = SweetDnaFile::from_bundle(&dna_path).await.unwrap(); // Set up conductors diff --git a/templates/module/coordinator-zome/dnas/{{dna_role_name}}/zomes/coordinator/{{zome_manifest.name}}/Cargo.toml.hbs b/templates/module/coordinator-zome/dnas/{{dna_role_name}}/zomes/coordinator/{{zome_manifest.name}}/Cargo.toml.hbs index d0967b1..c21d7f6 100644 --- a/templates/module/coordinator-zome/dnas/{{dna_role_name}}/zomes/coordinator/{{zome_manifest.name}}/Cargo.toml.hbs +++ b/templates/module/coordinator-zome/dnas/{{dna_role_name}}/zomes/coordinator/{{zome_manifest.name}}/Cargo.toml.hbs @@ -1,7 +1,7 @@ {{previous_file_content}} [dev-dependencies] -fixt = "*" +fixt = "0.3.0-beta-dev" futures = { version = "0.3.1", default-features = false } hdk = { workspace = true, features = ["encoding", "test_utils"] } holochain = { workspace = true } diff --git a/templates/module/entry-type/zomes/coordinator/{{snake_case app_name}}/tests/{{snake_case entry_type.name}}.rs.hbs b/templates/module/entry-type/zomes/coordinator/{{snake_case app_name}}/tests/{{snake_case entry_type.name}}.rs.hbs index d917711..9d4e450 100644 --- a/templates/module/entry-type/zomes/coordinator/{{snake_case app_name}}/tests/{{snake_case entry_type.name}}.rs.hbs +++ b/templates/module/entry-type/zomes/coordinator/{{snake_case app_name}}/tests/{{snake_case entry_type.name}}.rs.hbs @@ -30,7 +30,7 @@ async fn create_{{snake_case entry_type.name}}_test() { // Use prebuilt dna file let dna_path = std::env::current_dir() .unwrap() - .join("../../../workdir/{{dna_role_name}}.dna"); + .join(std::env::var("DNA_PATH").expect("DNA_PATH not set, must be run using nix flake check")); let dna = SweetDnaFile::from_bundle(&dna_path).await.unwrap(); // Set up conductors @@ -56,7 +56,7 @@ async fn create_and_read_{{snake_case entry_type.name}}() { // Use prebuilt dna file let dna_path = std::env::current_dir() .unwrap() - .join("../../../workdir/{{dna_role_name}}.dna"); + .join(std::env::var("DNA_PATH").expect("DNA_PATH not set, must be run using nix flake check")); let dna = SweetDnaFile::from_bundle(&dna_path).await.unwrap(); // Set up conductors @@ -95,7 +95,7 @@ async fn create_and_update_{{snake_case entry_type.name}}() { // Use prebuilt dna file let dna_path = std::env::current_dir() .unwrap() - .join("../../../workdir/{{dna_role_name}}.dna"); + .join(std::env::var("DNA_PATH").expect("DNA_PATH not set, must be run using nix flake check")); let dna = SweetDnaFile::from_bundle(&dna_path).await.unwrap(); // Set up conductors @@ -178,7 +178,7 @@ async fn create_and_delete_{{snake_case entry_type.name}}() { // Use prebuilt dna file let dna_path = std::env::current_dir() .unwrap() - .join("../../../workdir/{{dna_role_name}}.dna"); + .join(std::env::var("DNA_PATH").expect("DNA_PATH not set, must be run using nix flake check")); let dna = SweetDnaFile::from_bundle(&dna_path).await.unwrap(); // Set up conductors diff --git "a/templates/module/link-type/zomes/coordinator/{{snake_case app_name}}/tests/{{#if to_referenceable}}{{snake_case from_referenceable.name}}_to_{{snake_case (plural to_referenceable.name)}}.rs{{\302\241if}}.hbs" "b/templates/module/link-type/zomes/coordinator/{{snake_case app_name}}/tests/{{#if to_referenceable}}{{snake_case from_referenceable.name}}_to_{{snake_case (plural to_referenceable.name)}}.rs{{\302\241if}}.hbs" index 8d6b16b..8287542 100644 --- "a/templates/module/link-type/zomes/coordinator/{{snake_case app_name}}/tests/{{#if to_referenceable}}{{snake_case from_referenceable.name}}_to_{{snake_case (plural to_referenceable.name)}}.rs{{\302\241if}}.hbs" +++ "b/templates/module/link-type/zomes/coordinator/{{snake_case app_name}}/tests/{{#if to_referenceable}}{{snake_case from_referenceable.name}}_to_{{snake_case (plural to_referenceable.name)}}.rs{{\302\241if}}.hbs" @@ -24,7 +24,7 @@ async fn link_a_{{snake_case from_referenceable.name}}_to_a_{{snake_case to_refe // Use prebuilt dna file let dna_path = std::env::current_dir() .unwrap() - .join("../../../workdir/{{dna_role_name}}.dna"); + .join(std::env::var("DNA_PATH").expect("DNA_PATH not set, must be run using nix flake check")); let dna = SweetDnaFile::from_bundle(&dna_path).await.unwrap(); // Set up conductors diff --git a/templates/module/web-app/zomes/coordinator/{{snake_case app_name}}/Cargo.toml.hbs b/templates/module/web-app/zomes/coordinator/{{snake_case app_name}}/Cargo.toml.hbs index d4f5388..203af95 100644 --- a/templates/module/web-app/zomes/coordinator/{{snake_case app_name}}/Cargo.toml.hbs +++ b/templates/module/web-app/zomes/coordinator/{{snake_case app_name}}/Cargo.toml.hbs @@ -15,7 +15,7 @@ serde = { workspace = true } {{snake_case app_name}}_integrity = { path = "../../integrity/{{snake_case app_name}}", package = "hc_zome_{{snake_case app_name}}_integrity" } [dev-dependencies] -fixt = "*" +fixt = "0.3.0-beta-dev" futures = { version = "0.3.1", default-features = false } hdk = { workspace = true, features = ["encoding", "test_utils"] } holochain = { workspace = true }