Giter Site home page Giter Site logo

holochain / scaffolding Goto Github PK

View Code? Open in Web Editor NEW
218.0 14.0 17.0 30.49 MB

Scaffolding tool to quickly generate and edit holochain applications

Home Page: https://docs.rs/holochain_scaffolding_cli

Shell 0.82% Nix 0.48% Rust 52.41% Handlebars 46.29%
holochain rad scaffolding

scaffolding's Introduction

Holochain Scaffolding CLI

CLI to easily generate and edit holochain apps.

Obtaining the scaffolding tool through holonix

The easiest way to start using the scaffolding tool is through holonix:

nix run github:holochain/holochain#hc-scaffold -- --version

Should print the version of the scaffolding tool.

Usage

Refer to the holochain developer instructions to know how you can use the scaffolding tool to create your own apps.

These are the commands that you can run with the scaffolding tool inside of a holonix develop shell:

# Scaffold an example app
hc scaffold example

# Scaffold an empty web-app
hc scaffold web-app forum

cd forum

# Scaffold a dna inside the newly scaffolded app
hc scaffold dna forum

# Scaffold a zome inside the newly scaffolded dna
hc scaffold zome posts

# Scaffold an entry-type inside the newly scaffolded zome
hc scaffold entry-type post

# Scaffold a collection for the newly scaffolded entry-type
hc scaffold collection global all_posts

# Scaffold a new link-type
hc scaffold link-type

Documentation

See the docs.rs documentation to learn how to use and create custom templates.

Contributing

We have a contributing guide to help you get started. If you need anything else to get started please reach out on Discord!

Maintenance

We have a maintenance guide which is mainly aimed at maintainers of the project but may be useful for some contributors or users to read.

Manual installation

Install the CLI globally with this command.

cargo install holochain_scaffolding_cli

scaffolding's People

Contributors

c12i avatar emhoracek avatar guillemcordoba avatar harlantwood avatar joshuavial avatar matthme avatar mattyg avatar pdaoust avatar r-vdp avatar robbiecarlton avatar steveej avatar thetasinner avatar zippy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scaffolding's Issues

entry-type: choosing f32 or option of f32 doesn't ask to add to LIT UI

The expected question of asking to add a field to the ui when selecting f3 (LIT UI) doesn't happen, but the float is added to the UI but in a broken way, i.e. without a type:

Here is the result of an entry type definition in the types.ts file to which I added an option of f32 and and option f:

export interface Foo { 

  f_opt:  | undefined;

  f: ;
}

hc-scaffold version: 0.0.4

Package ‘webkitgtk-2.38.2+abi=4.0’ in /nix/store/73w8ml8wf35agm65ihdanz42yj7n8cz3-source/pkgs/development/libraries/webkitgtk/default.nix:241 is marked as broken, refusing to evaluate

I installed Nix on my MacBook Pro with an M1 chip.

I ran the following command while following the instructions on the Holochain Developer documentation:

nix-shell https://holochain.love --run "hc scaffold example forum"

It did a bunch of stuff and then ended up erroring out in the following way:

Screenshot 2023-01-17 at 7 08 15 PM

Do I follow its instructions for allowing broken packages or is that something that needs to be addressed in the scaffolding itself?

Two zomes in scaffold window produce one as an output

Hi
When I run the npx @holochain/create@latest , I made two zomes within one DNA, but as an output, it created:

  1. two integrity folders with files
  2. only one conductor file, just for the first some.

I have included the screenshot of it:
Screenshot from 2022-08-15 17-06-47

npm run package fails to build .webhapp unless "skipLibCheck": true on tsconfig.json inside ui folder

I'm just playing around with the scaffold.

and I fail to build the .webhapp file and get this error.
2022-11-24_10-51-37

After a little searching I found an option to skip the library check on @bable/types.

By adding:
"skipLibCheck": true
to the tsconfig.json file inside the ui directory.

Not sure if you want to update the scaffold to include this setting on the tsconfig.json so just documenting the issue here for you to process.

And if it's not need for other people why do I have to do this?

CI runtime improvements

  • #93 proposes to use the nix built hc-scaffold for the integration tests.

  • #95 proposes running cargo test. instead of cargo test we could add a crane-based test derivation so the dependencies could be shared between the tests and the CLI. this assume we can agree on using a common cargo profile. any objections to using "release" for the test derivation?

  • the script run_tests.sh could be parallelized using a matrix on github actions.

npm start fails with svelte ui

Hi - have run this on a new project selecting Svelte as UI template.
After doing:

nix-shell
npm run build:happ

successfully,
npm start
fails with the message:

[1] [1] Could not find a config file at /data/holochain/radhis-tmp/radsvelte/ui/wds.config.mjs
[1] [1] wds --config wds.config.mjs exited with code 1

Can't change zome name

Hello

When I run npx @holochain/create@latest , in the selection of the zome name, I cannot change from the default name which is: zome_0_integrity. If I try and edit it, the button SCAFFOLD APP will not trigger.

entry-type: vec<string> adds broken code to Lit UI

If you add a vec string you get bad code in:

  1. create-X.ts file:
  async createFoo() {
    const cellData = this.appInfo.cell_data.find((c: InstalledCell) => c.role_id === 'test_app')!;

    const foo: Foo = { 
        vec_str: this._vecStras Array<string>,,
    };

note the as is concatenated to the vecStr and there is an extra comma a the end of the line.

  1. update-X.ts file:
  async updateFoo() {
    const cellData = this.appInfo.cell_data.find((c: InstalledCell) => c.role_id === 'test_app')!;

    const foo: Foo = { 
      vec_str: this._vecStr as Array<string,
    };

note missing close >

  1. there is a typeScript error in the edit-X.ts file: The .value=${ el } portion of the mwc widget reports the error: Type 'string | undefined' is not assignable to 'string' Note this also happens for an option of string field.

hc-scaffold version: 0.0.4

Call to google API's breaks offline behavior

Do we really need this call to a CDN? I would prefer if the scaffolding tool's default templates were offline-first. Currently if an app with the scaffolding tool is opened offline, the screen turns blank until name resolution times out.

image

Scaffolding config

It would be so clutch to create a scaffold config that can be edited and then passed back into hc scaffold as a param so it creates all the things… and users don’t have to go back through all the questions again.

I found myself running the scaffolding tool multiple times for the same app after needing a minor change or just wanting to try again with a different option. It would be really really helpful to have some sort of config that can be edited then passed for a re-run.

convenience tweeks

so in the readme it tells you to do:
nix-shell http://holochain.love
that takes you down an hour long "love hole"

faster way is :
nix run github:holochain/holochain#hc-scaffold -- example forum

secondly when you have scaffolded "the quick way"
there is no way to see what version of scaffold has been used
would be helpful if that was included in one of the text/script files

link-type that is self-referencing from same entry-type to same entry-type yields error

link-entry scaffold tool creates code that doesn’t compile
Compiling name_graph v0.0.1 (/Users/jmday/dev/holo/hello_link/dnas/name_graph/zomes/coordinator/name_graph)
error[E0124]: field name_entry_hash is already declared
--> dnas/name_graph/zomes/coordinator/name_graph/src/name_entry_to_name_entries.rs:6:5
|
5 | pub name_entry_hash: ActionHash,
| ------------------------------- name_entry_hash first declared here
6 | pub name_entry_hash: ActionHash,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field already declared

Collections cannot (ergonomically) be sorted by a property of the Records

With the current pattern of only returning hashes instead of records from the backend and then the frontend pattern being like this it is not possible to sort entries in the UI by properties of their records (for example creation time or any property of the entry or derived from it) without quite extensive rewriting of the generated UI code.

Maybe that's something that's outweighed by other advantages of the current pattern but it's probably worth having a closer look at whether there are better patterns.

Plural filename vs. Singular import in Svelte

Using svelte (not sure of Vue or Lit)
With plural entry-type name
Creating a collection on that (plural-named) entry-type
results in an import statement for singular XDetail.svelte filename
but the actual filename it appears to be looking for is plural XsDetail.svelte

npm install fails with svelte and date time entry

npm install fails when svelte is selected as UI framework and an entry of date time type is added.

npm ERR! code 1
npm ERR! command failed
npm ERR! command sh -c npm run build
npm ERR! > [email protected] build
npm ERR! > rollup -c
npm ERR! 
npm ERR! src/main.ts → public/build/bundle.js...
npm ERR! (!) `this` has been rewritten to `undefined`
npm ERR! https://rollupjs.org/guide/en/#error-this-is-undefined
npm ERR! ../node_modules/@type-craft/title/dist/definitions/title-detail.js
npm ERR! 1: var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
npm ERR!                      ^
npm ERR! 2:     var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
npm ERR! 3:     if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
npm ERR! ...and 1 other occurrence
npm ERR! ../node_modules/@type-craft/content/dist/definitions/content-detail.js
npm ERR! 1: var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
npm ERR!                      ^
npm ERR! 2:     var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
npm ERR! 3:     if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
npm ERR! ...and 1 other occurrence
npm ERR! ../node_modules/@type-craft/title/dist/definitions/create-title.js
npm ERR! 1: var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
npm ERR!                      ^
npm ERR! 2:     var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
npm ERR! 3:     if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
npm ERR! ...and 1 other occurrence
npm ERR! 
npm ERR! ...and 15 other files
npm ERR! (!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
npm ERR! (!) Plugin svelte: Unused CSS selector "h1"
npm ERR! src/App.svelte
npm ERR! 47:   }
npm ERR! 48: 
npm ERR! 49:   h1 {
npm ERR!       ^
npm ERR! 50:     color: #ff3e00;
npm ERR! 51:     text-transform: uppercase;
npm ERR! [!] (plugin commonjs) SyntaxError: Unexpected keyword 'this' (170:11) in ...

[feat] scaffolding of headless apps

It would be nice if there were an option to explicitly scaffold a headless app (i.e. without UI). Currently one is forced to select a UI framework and have UI components generated in any case and then must delete the UI folder manually. It's merely a question of convenience though.

infinite install loop

I followed the instructions on the readme for developer..
doing
npm install
and then
npm start
it seem to go into an infinite install loop .. i had to control c on it

Feature Request: ability to go back when adding entries

I had the experience of realizing I made a mistake while adding a field, and had to ctrl-c out and start over. It would be really nice to be able to navigate through the fields you have created, maybe with a list of the created fields so far, or something like that.

Deserialization error for Author-only collection when missing `author={client.myPubKey}`

Using svelte (not sure of Vue or Lit)
When a collection is not getting Global (all) entries but only author’s entries:
it could be really helpful to provide the user some guidance on ensuring the svelte collection HTML tag should have a required param:
author={client.myPubKey}

e.g. Instead of:

it needs:

The resulting error is a Deserialization error, which isn't totally intuitive as to why.

Failed to load resource: .launcher-env.json (the server responded with a status of 404)

I tried to follow and recreate the scaffolding example from @guillemcordoba tutorial video (great video btw!). I chose the exact same settings and zome/dna definitions from the video. Everything seemed to work but when I run npm run start or npm run network 3 I am not able to create wiki pages, the create button is greyed out.
Bildschirmfoto vom 2022-05-21 13-57-09

I suspect it has something to do with the console error I got, somehow it can't load the browser polyfil:

Failed to load resource: the server responded with a status of 404 (Not Found)

Screenshot:
Bildschirmfoto vom 2022-05-21 13-51-45

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.