diff --git a/.templates/app/collection/ui/src/{{dna_role_name}}/{{kebab_case coordinator_zome_manifest.name}}/{{kebab_case coordinator_zome_manifest.name}}-client.ts.hbs b/.templates/app/collection/ui/src/{{dna_role_name}}/{{kebab_case coordinator_zome_manifest.name}}/{{kebab_case coordinator_zome_manifest.name}}-client.ts.hbs index 3e3c8c7..470a5e9 100644 --- a/.templates/app/collection/ui/src/{{dna_role_name}}/{{kebab_case coordinator_zome_manifest.name}}/{{kebab_case coordinator_zome_manifest.name}}-client.ts.hbs +++ b/.templates/app/collection/ui/src/{{dna_role_name}}/{{kebab_case coordinator_zome_manifest.name}}/{{kebab_case coordinator_zome_manifest.name}}-client.ts.hbs @@ -4,7 +4,7 @@ /** {{title_case collection_name}} */ async get{{pascal_case collection_name}}({{#if (eq collection_type.type "ByAuthor")}}author: AgentPubKey{{else}}{{/if}}): Promise>> { - const records: Record[] = await this.callZome('get_{{snake_case collection_name}}', {{#if (eq collection_type.type "ByAuthor")}}author{{else}}null{{/if}}); + const records: Record[] = await this.callZome('get_{{snake_case collection_name}}', {{#if (eq collection_type.type "ByAuthor")}}author{{else}}undefined{{/if}}); return records.map(r => new EntryRecord(r)); } diff --git a/.templates/app/entry-type.instructions.hbs b/.templates/app/entry-type.instructions.hbs index 679089a..a3e1ffa 100644 --- a/.templates/app/entry-type.instructions.hbs +++ b/.templates/app/entry-type.instructions.hbs @@ -4,11 +4,11 @@ You have scaffolded an entry type with an image field. Scaffold the file-storage zome in one of your DNAs by running these commands, if you haven't already: - npm i -w ui @holochain-open-dev/file-storage@0.3.0 + npm i -w ui @holochain-open-dev/file-storage hc-scaffold zome file_storage --coordinator dnas/{{../dna_role_name}}/zomes/coordinator --integrity dnas/{{../dna_role_name}}/zomes/integrity - cargo add -p file_storage hc_zome_file_storage_coordinator@0.1 + cargo add -p file_storage hc_zome_file_storage_coordinator echo "extern crate hc_zome_file_storage_coordinator;" > dnas/{{../dna_role_name}}/zomes/coordinator/file_storage/src/lib.rs - cargo add -p file_storage_integrity hc_zome_file_storage_integrity@0.1 + cargo add -p file_storage_integrity hc_zome_file_storage_integrity echo "extern crate hc_zome_file_storage_integrity;" > dnas/{{../dna_role_name}}/zomes/integrity/file_storage/src/lib.rs {{/if}} diff --git a/.templates/app/entry-type/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/common.ts.hbs b/.templates/app/entry-type/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/common.ts.hbs index 84177ce..5410024 100644 --- a/.templates/app/entry-type/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/common.ts.hbs +++ b/.templates/app/entry-type/tests/src/{{dna_role_name}}/{{coordinator_zome_manifest.name}}/common.ts.hbs @@ -20,7 +20,7 @@ export async function sample{{pascal_case entry_type.name}}(client: {{pascal_cas {{/if}} {{else}} {{#if (eq (pascal_case linked_from.name) (pascal_case ../entry_type.name))}} - {{field_name}}: null, + {{field_name}}: undefined, {{else}} {{#if (eq linked_from.hash_type "ActionHash")}} {{field_name}}: partial{{pascal_case ../entry_type.name}}.{{field_name}} || (await create{{pascal_case linked_from.name}}(client)).actionHash, diff --git a/.templates/app/entry-type/ui/src/{{dna_role_name}}/{{kebab_case coordinator_zome_manifest.name}}/mocks.ts.hbs b/.templates/app/entry-type/ui/src/{{dna_role_name}}/{{kebab_case coordinator_zome_manifest.name}}/mocks.ts.hbs index 5faef1e..8f9832f 100644 --- a/.templates/app/entry-type/ui/src/{{dna_role_name}}/{{kebab_case coordinator_zome_manifest.name}}/mocks.ts.hbs +++ b/.templates/app/entry-type/ui/src/{{dna_role_name}}/{{kebab_case coordinator_zome_manifest.name}}/mocks.ts.hbs @@ -121,7 +121,7 @@ export async function sample{{pascal_case entry_type.name}}(client: {{pascal_cas {{/if}} {{else}} {{#if (eq (pascal_case linked_from.name) (pascal_case ../entry_type.name))}} - {{field_name}}: null, + {{field_name}}: undefined, {{else}} {{#if (eq linked_from.hash_type "ActionHash")}} {{field_name}}: partial{{pascal_case ../entry_type.name}}.{{field_name}} || (await client.create{{pascal_case linked_from.name}}(await sample{{pascal_case linked_from.name}}(client))).actionHash, diff --git a/.templates/app/field-types/ActionHash/sample-js.hbs b/.templates/app/field-types/ActionHash/sample-js.hbs new file mode 100644 index 0000000..a1fa54d --- /dev/null +++ b/.templates/app/field-types/ActionHash/sample-js.hbs @@ -0,0 +1 @@ +fakeActionHash() diff --git a/.templates/app/field-types/AgentPubKey/sample-js.hbs b/.templates/app/field-types/AgentPubKey/sample-js.hbs new file mode 100644 index 0000000..98a2ed7 --- /dev/null +++ b/.templates/app/field-types/AgentPubKey/sample-js.hbs @@ -0,0 +1 @@ +(await fakeAgentPubKey()) diff --git a/.templates/app/field-types/DnaHash/sample-js.hbs b/.templates/app/field-types/DnaHash/sample-js.hbs new file mode 100644 index 0000000..9369d2e --- /dev/null +++ b/.templates/app/field-types/DnaHash/sample-js.hbs @@ -0,0 +1 @@ +(await fakeDnaHash()) diff --git a/.templates/app/field-types/EntryHash/sample-js.hbs b/.templates/app/field-types/EntryHash/sample-js.hbs new file mode 100644 index 0000000..5d1b81d --- /dev/null +++ b/.templates/app/field-types/EntryHash/sample-js.hbs @@ -0,0 +1 @@ +fakeEntryHash() diff --git a/.templates/app/field-types/Enum/sample-js.hbs b/.templates/app/field-types/Enum/sample-js.hbs new file mode 100644 index 0000000..560b9ff --- /dev/null +++ b/.templates/app/field-types/Enum/sample-js.hbs @@ -0,0 +1 @@ +{ type: '{{lookup field_type.variants 0}}' } diff --git a/.templates/app/field-types/String/sample-js.hbs b/.templates/app/field-types/String/sample-js.hbs new file mode 100644 index 0000000..f31cb45 --- /dev/null +++ b/.templates/app/field-types/String/sample-js.hbs @@ -0,0 +1 @@ +"Lorem ipsum 2" diff --git a/.templates/app/field-types/Timestamp/sample-js.hbs b/.templates/app/field-types/Timestamp/sample-js.hbs new file mode 100644 index 0000000..cc94d19 --- /dev/null +++ b/.templates/app/field-types/Timestamp/sample-js.hbs @@ -0,0 +1 @@ +Date.now() * 1000 diff --git a/.templates/app/field-types/bool/sample-js.hbs b/.templates/app/field-types/bool/sample-js.hbs new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/.templates/app/field-types/bool/sample-js.hbs @@ -0,0 +1 @@ +true diff --git a/.templates/app/field-types/f32/sample-js.hbs b/.templates/app/field-types/f32/sample-js.hbs new file mode 100644 index 0000000..c239c60 --- /dev/null +++ b/.templates/app/field-types/f32/sample-js.hbs @@ -0,0 +1 @@ +1.5 diff --git a/.templates/app/field-types/i32/sample-js.hbs b/.templates/app/field-types/i32/sample-js.hbs new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/.templates/app/field-types/i32/sample-js.hbs @@ -0,0 +1 @@ +3 diff --git a/.templates/app/field-types/u32/sample-js.hbs b/.templates/app/field-types/u32/sample-js.hbs new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/.templates/app/field-types/u32/sample-js.hbs @@ -0,0 +1 @@ +3 diff --git a/.templates/app/web-app.instructions.hbs b/.templates/app/web-app.instructions.hbs index 93755cd..0a5d7b4 100644 --- a/.templates/app/web-app.instructions.hbs +++ b/.templates/app/web-app.instructions.hbs @@ -14,10 +14,22 @@ In order to be able to revert any next scaffolding steps, it is also recommended git add . git commit -m "web-app skeleton scaffolded" -To continue scaffolding your module, add new entry types: +To continue scaffolding your app, add a new dna: - hc scaffold entry-type + hc scaffold dna -Then, at any point in time you can start the demo with: +And then adding a zome to that dna: + + hc scaffold zome + +After that, at any point in time you can start the demo with: npm start + +You can run the tests with: + + npm test + +And you can build the .webhapp production package with: + + npm package \ No newline at end of file diff --git a/.templates/app/web-app/ui/src/holochain-app.ts.hbs b/.templates/app/web-app/ui/src/holochain-app.ts.hbs index 1f4a109..4d9977e 100644 --- a/.templates/app/web-app/ui/src/holochain-app.ts.hbs +++ b/.templates/app/web-app/ui/src/holochain-app.ts.hbs @@ -40,7 +40,7 @@ export class HolochainApp extends LitElement { _myProfile!: StoreSubscriber>; async firstUpdated() { - this._client = await AppAgentWebsocket.connect('', '{{app_name}}'); + this._client = await AppAgentWebsocket.connect(new URL('ws://localhost'), '{{app_name}}'); await this.initStores(this._client); diff --git a/.templates/module/collection/ui/src/{{kebab_case app_name}}-client.ts.hbs b/.templates/module/collection/ui/src/{{kebab_case app_name}}-client.ts.hbs index 3e3c8c7..470a5e9 100644 --- a/.templates/module/collection/ui/src/{{kebab_case app_name}}-client.ts.hbs +++ b/.templates/module/collection/ui/src/{{kebab_case app_name}}-client.ts.hbs @@ -4,7 +4,7 @@ /** {{title_case collection_name}} */ async get{{pascal_case collection_name}}({{#if (eq collection_type.type "ByAuthor")}}author: AgentPubKey{{else}}{{/if}}): Promise>> { - const records: Record[] = await this.callZome('get_{{snake_case collection_name}}', {{#if (eq collection_type.type "ByAuthor")}}author{{else}}null{{/if}}); + const records: Record[] = await this.callZome('get_{{snake_case collection_name}}', {{#if (eq collection_type.type "ByAuthor")}}author{{else}}undefined{{/if}}); return records.map(r => new EntryRecord(r)); } diff --git a/.templates/module/field-types/Timestamp/sample-js.hbs b/.templates/module/field-types/Timestamp/sample-js.hbs new file mode 100644 index 0000000..cc94d19 --- /dev/null +++ b/.templates/module/field-types/Timestamp/sample-js.hbs @@ -0,0 +1 @@ +Date.now() * 1000 diff --git a/.templates/module/web-app.instructions.hbs b/.templates/module/web-app.instructions.hbs index 9efe626..5fc5ad8 100644 --- a/.templates/module/web-app.instructions.hbs +++ b/.templates/module/web-app.instructions.hbs @@ -17,6 +17,14 @@ To continue scaffolding your module, add new entry types: hc scaffold entry-type -Then, at any point in time you can start the demo with: +After that, at any point in time you can start the demo with: npm start + +You can run the tests with: + + npm test + +And you can build the .webhapp production package with: + + npm package \ No newline at end of file diff --git a/.templates/module/web-app/stories/3.1-frontend-setup.mdx.hbs b/.templates/module/web-app/stories/3.1-frontend-setup.mdx.hbs index 626f5b4..2968e80 100644 --- a/.templates/module/web-app/stories/3.1-frontend-setup.mdx.hbs +++ b/.templates/module/web-app/stories/3.1-frontend-setup.mdx.hbs @@ -27,7 +27,7 @@ import { {{pascal_case app_name}}Store, {{pascal_case app_name}}Client } from "@ import { AppAgentWebsocket } from "@holochain/client"; async function setup{{pascal_case app_name}}Store() { - const client = await AppAgentWebsocket.connect('', '') + const client = await AppAgentWebsocket.connect(new URL('ws://localhost'), '') // TODO: change "MY_CELL_ROLE" for the roleId that you can find in your "happ.yaml" return new {{pascal_case app_name}}Store(new {{pascal_case app_name}}Client(client, '')); diff --git a/.templates/module/web-app/ui/demo/index.html.hbs b/.templates/module/web-app/ui/demo/index.html.hbs index 2bd620a..d5d0794 100644 --- a/.templates/module/web-app/ui/demo/index.html.hbs +++ b/.templates/module/web-app/ui/demo/index.html.hbs @@ -58,7 +58,7 @@ export class DemoApp extends LitElement { } async firstUpdated() { - this._client = await AppAgentWebsocket.connect('', '{{app_name}}'); + this._client = await AppAgentWebsocket.connect(new URL('ws://localhost'), '{{app_name}}'); await this.initStores(this._client);