From 9bfbc7adabc951a8acfb4b1012dc47fdb1760dd7 Mon Sep 17 00:00:00 2001 From: "guillem.cordoba" Date: Thu, 11 Apr 2024 18:56:31 +0200 Subject: [PATCH] Updated hc, minor fixes --- Cargo.toml | 2 +- examples/tauri-app/src-tauri/Cargo.toml | 1 - examples/tauri-app/ui/src/forum/posts/create-post.ts | 4 ++-- .../zomes/coordinator/{{zome_manifest.name}}/zome.nix.hbs | 3 ++- .../{{dna_role_name}}/{{zome_manifest.name}}/setup.ts.hbs | 2 +- .../zome.nix.hbs" | 3 ++- ...se (plural to_referenceable.name)}}.rs{{\302\241if}}.hbs" | 2 +- ...lural to_referenceable.name)}}.test.ts{{\302\241if}}.hbs" | 4 ++++ templates/happ-open-dev/web-app/flake.nix.hbs | 1 + templates/happ-open-dev/web-app/package.json.hbs | 5 +++-- templates/happ-open-dev/web-app/src-tauri/Cargo.toml.hbs | 1 + templates/happ-open-dev/web-app/ui/package.json.hbs | 3 ++- templates/happ-open-dev/web-app/ui/vite.config.ts.hbs | 1 + 13 files changed, 21 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a3a38d45..9a2abd8c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ tauri = { version = "2.0.0-beta", features = [ # Holochain dependencies mr_bundle = "0.3.0-beta-dev" -holochain = "=0.3.0-beta-dev.43" +holochain = "=0.3.0-beta-dev.45" holochain_types = "0.3.0-beta-dev" holochain_keystore = "0.3.0-beta-dev" holochain_conductor_api = "0.3.0-beta-dev" diff --git a/examples/tauri-app/src-tauri/Cargo.toml b/examples/tauri-app/src-tauri/Cargo.toml index 3c775129..2aa2fb40 100644 --- a/examples/tauri-app/src-tauri/Cargo.toml +++ b/examples/tauri-app/src-tauri/Cargo.toml @@ -25,5 +25,4 @@ lair_keystore = { version = "0.4.0" } holochain_client = { version = "0.5.0-dev" } log = "0.4" tauri-plugin-log = "2.0.0-beta" - url2 = "0.0.6" diff --git a/examples/tauri-app/ui/src/forum/posts/create-post.ts b/examples/tauri-app/ui/src/forum/posts/create-post.ts index 5506da67..1c0f023c 100644 --- a/examples/tauri-app/ui/src/forum/posts/create-post.ts +++ b/examples/tauri-app/ui/src/forum/posts/create-post.ts @@ -8,8 +8,8 @@ import { Snackbar } from '@material/mwc-snackbar'; import '@material/mwc-textfield'; import '@material/mwc-textarea'; -import { clientContext } from '../../contexts'; -import { Post } from './types'; +import { clientContext } from '../../contexts.js'; +import { Post } from './types.js'; @customElement('create-post') export class CreatePost extends LitElement { diff --git a/templates/happ-open-dev/coordinator-zome/dnas/{{dna_role_name}}/zomes/coordinator/{{zome_manifest.name}}/zome.nix.hbs b/templates/happ-open-dev/coordinator-zome/dnas/{{dna_role_name}}/zomes/coordinator/{{zome_manifest.name}}/zome.nix.hbs index 71307523..6473d45a 100644 --- a/templates/happ-open-dev/coordinator-zome/dnas/{{dna_role_name}}/zomes/coordinator/{{zome_manifest.name}}/zome.nix.hbs +++ b/templates/happ-open-dev/coordinator-zome/dnas/{{dna_role_name}}/zomes/coordinator/{{zome_manifest.name}}/zome.nix.hbs @@ -1,4 +1,4 @@ -{ inputs, rootPath, ... }: +{ inputs, rootPath, excludedCrates, ... }: { perSystem = @@ -7,6 +7,7 @@ , ... }: { packages.{{zome_manifest.name}} = inputs.hc-infra.outputs.lib.rustZome { + inherit excludedCrates; workspacePath = rootPath; holochain = inputs'.holochain; crateCargoToml = ./Cargo.toml; diff --git a/templates/happ-open-dev/coordinator-zome/tests/src/{{dna_role_name}}/{{zome_manifest.name}}/setup.ts.hbs b/templates/happ-open-dev/coordinator-zome/tests/src/{{dna_role_name}}/{{zome_manifest.name}}/setup.ts.hbs index 687412df..035aac98 100644 --- a/templates/happ-open-dev/coordinator-zome/tests/src/{{dna_role_name}}/{{zome_manifest.name}}/setup.ts.hbs +++ b/templates/happ-open-dev/coordinator-zome/tests/src/{{dna_role_name}}/{{zome_manifest.name}}/setup.ts.hbs @@ -20,7 +20,7 @@ import { dirname } from 'path'; import { fileURLToPath } from 'url'; import { appPath } from '../../app-path.js'; import { {{pascal_case zome_manifest.name}}Client } from '../../../../ui/src/{{dna_role_name}}/{{kebab_case zome_manifest.name}}/{{kebab_case zome_manifest.name}}-client.js'; -import { {{pascal_case zome_manifest.name}}Store } from '../../../../ui/src//{{dna_role_name}}/{{kebab_case zome_manifest.name}}/{{kebab_case zome_manifest.name}}-store.js'; +import { {{pascal_case zome_manifest.name}}Store } from '../../../../ui/src/{{dna_role_name}}/{{kebab_case zome_manifest.name}}/{{kebab_case zome_manifest.name}}-store.js'; export async function setup(scenario: Scenario) { // Add 2 players with the test hApp to the Scenario. The returned players diff --git "a/templates/happ-open-dev/integrity-zome/dnas/{{dna_role_name}}/zomes/integrity/{{replace zome_manifest.name \"_integrity\" \"\" }}/zome.nix.hbs" "b/templates/happ-open-dev/integrity-zome/dnas/{{dna_role_name}}/zomes/integrity/{{replace zome_manifest.name \"_integrity\" \"\" }}/zome.nix.hbs" index 16bf6f6f..ae475971 100644 --- "a/templates/happ-open-dev/integrity-zome/dnas/{{dna_role_name}}/zomes/integrity/{{replace zome_manifest.name \"_integrity\" \"\" }}/zome.nix.hbs" +++ "b/templates/happ-open-dev/integrity-zome/dnas/{{dna_role_name}}/zomes/integrity/{{replace zome_manifest.name \"_integrity\" \"\" }}/zome.nix.hbs" @@ -1,4 +1,4 @@ -{ inputs, rootPath, ... }: +{ inputs, rootPath, excludedCrates, ... }: { perSystem = @@ -6,6 +6,7 @@ , ... }: { packages.{{zome_manifest.name}} = inputs.hc-infra.outputs.lib.rustZome { + inherit excludedCrates; workspacePath = rootPath; holochain = inputs'.holochain; crateCargoToml = ./Cargo.toml; diff --git "a/templates/happ-open-dev/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/happ-open-dev/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 e8b039f4..8c849e36 100644 --- "a/templates/happ-open-dev/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/happ-open-dev/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" @@ -48,7 +48,7 @@ async fn link_a_{{snake_case from_referenceable.name}}_to_a_{{snake_case to_refe {{/if}} {{/if}} {{#if (eq to_referenceable.hash_type "AgentPubKey")}} - let target_address = alice.agentPubKey; + let target_address = alice.agent_pubkey(); {{else}} let target_record = create_{{snake_case to_referenceable.name}}(&conductors[0], &alice_zome, sample_{{snake_case to_referenceable.name}}_1(&conductors[0], &alice_zome).await).await; {{#if (eq to_referenceable.hash_type "EntryHash")}} diff --git "a/templates/happ-open-dev/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/happ-open-dev/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" index a29bf9c3..9bc93e3f 100644 --- "a/templates/happ-open-dev/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/happ-open-dev/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" @@ -44,7 +44,11 @@ test('link a {{pascal_case from_referenceable.name}} to a {{pascal_case to_refer // Bob gets the links, should be empty let linksOutput = await toPromise(bob.store.{{#if (ne from_referenceable.hash_type "ActionHash")}}{{camel_case (plural to_referenceable.name)}}For{{pascal_case from_referenceable.name}}.get(baseAddress){{else}}{{camel_case (plural from_referenceable.name)}}.get(baseAddress).{{camel_case (plural to_referenceable.name)}}{{/if}}{{#if delete}}.live{{/if}}); + {{#if (eq to_referenceable.hash_type "AgentPubKey")}} + assert.equal(linksOutput.length, 0); + {{else}} assert.equal(linksOutput.size, 0); + {{/if}} // Alice creates a link from {{pascal_case from_referenceable.name}} to {{pascal_case to_referenceable.name}} await alice.store.client.add{{pascal_case to_referenceable.name}}For{{pascal_case from_referenceable.name}}(baseAddress, targetAddress); diff --git a/templates/happ-open-dev/web-app/flake.nix.hbs b/templates/happ-open-dev/web-app/flake.nix.hbs index 34635b1a..5cc55bd8 100644 --- a/templates/happ-open-dev/web-app/flake.nix.hbs +++ b/templates/happ-open-dev/web-app/flake.nix.hbs @@ -22,6 +22,7 @@ specialArgs = { ## Special arguments for the flake parts of this repository rootPath = ./.; + excludedCrates = [ "{{app_name}}" ]; }; } { diff --git a/templates/happ-open-dev/web-app/package.json.hbs b/templates/happ-open-dev/web-app/package.json.hbs index b9b753e9..62f3b27a 100644 --- a/templates/happ-open-dev/web-app/package.json.hbs +++ b/templates/happ-open-dev/web-app/package.json.hbs @@ -3,8 +3,8 @@ "private": true, "scripts": { "local-services": "hc run-local-services --bootstrap-port $BOOTSTRAP_PORT --signal-port $SIGNAL_PORT", - "test": "pnpm run build:happ && nix flake check -L && pnpm -F tests test", - "happ:build-debug": "nix build -L .#{{app_name}}.meta.debug -o workdir/{{app_name}}.happ", + "test": "pnpm happ:build-debug && nix flake check -L && pnpm -F tests test", + "happ:build-debug": "nix build -L .#{{app_name}}.meta.debug -o workdir/{{app_name}}debug.happ", "happ:build": "nix build -L .#{{app_name}} -o workdir/{{app_name}}.happ", "tauri": "tauri" }, @@ -12,6 +12,7 @@ "@holochain-playground/cli": "^0.1.0", "@tauri-apps/cli": "^2.0.0-alpha.17", "concurrently": "^6.2.1", + "internal-ip-cli": "^2.0.0", "new-port-cli": "^1.0.0", "rimraf": "^3.0.2" }, diff --git a/templates/happ-open-dev/web-app/src-tauri/Cargo.toml.hbs b/templates/happ-open-dev/web-app/src-tauri/Cargo.toml.hbs index a63fb50d..bc7a2bbf 100644 --- a/templates/happ-open-dev/web-app/src-tauri/Cargo.toml.hbs +++ b/templates/happ-open-dev/web-app/src-tauri/Cargo.toml.hbs @@ -25,4 +25,5 @@ lair_keystore = { version = "0.4.0" } holochain_client = { version = "0.5.0-dev" } log = "0.4" tauri-plugin-log = "2.0.0-beta" +url2 = "0.0.6" diff --git a/templates/happ-open-dev/web-app/ui/package.json.hbs b/templates/happ-open-dev/web-app/ui/package.json.hbs index acd81e69..2278bb47 100644 --- a/templates/happ-open-dev/web-app/ui/package.json.hbs +++ b/templates/happ-open-dev/web-app/ui/package.json.hbs @@ -2,7 +2,7 @@ "name": "ui", "version": "0.0.0", "scripts": { - "start": "vite --port $UI_PORT --clearScreen false", + "start": "vite", "build": "vite build", "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore", "format": "eslint --fix --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore", @@ -32,6 +32,7 @@ "bestzip": "^2.2.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", + "internal-ip": "^8.0.0", "prettier": "^3.2.5", "rimraf": "^3.0.2", "vite": "^4.0.0", diff --git a/templates/happ-open-dev/web-app/ui/vite.config.ts.hbs b/templates/happ-open-dev/web-app/ui/vite.config.ts.hbs index 0f78f269..ec3eda72 100644 --- a/templates/happ-open-dev/web-app/ui/vite.config.ts.hbs +++ b/templates/happ-open-dev/web-app/ui/vite.config.ts.hbs @@ -4,6 +4,7 @@ import path from "path"; import { viteStaticCopy } from "vite-plugin-static-copy"; import { internalIpV4Sync } from "internal-ip"; +// @ts-ignore const mobile = !!/android|ios/.exec(process.env.TAURI_ENV_PLATFORM); export default defineConfig({