dryvPacks

@dryv/react-crud-formsv0.1.0

Pure Handlebars React forms driven by create/update operations and their input DTO semantics.

React CRUD FormsFrontendInjectPublished 7 days ago2 downloads

dryv pack add @dryv/react-crud-forms
2.0 KBRaw ↗
yaml
version: dryv.pack/v1alpha1
key: inject.frontend.react-crud-forms
source: templates

info:
  title: React CRUD Forms
  version: 0.1.0
  description: Generates typed React forms for HTTP create and update operations using bound DTO/types and operation clients.

  purpose: frontend
  summary: Pure Handlebars React forms driven by create/update operations and their input DTO semantics.
  languages: [typescript]
  frameworks: [react]
  tags: [frontend, forms, crud, handlebars]

plugins:
  - { name: handlebars, extensions: [.hbs] }

dependencies:
  runtime:
    react: "*"
  dev:
    "@types/react": "*"
    prettier: "*"

# shared:js-package-manager:start
choose:
  js.package_manager: { options: [pnpm, npm, bun, yarn] }
# shared:js-package-manager:end

selections:
  forms:
    subject: operation
    filter:
      all: { facet: http }
      any: { role: [create, update] }
    scope: each

templates:
  form:
    $ref: "#/selections/forms"
    output:
      name: $(subject.name.kebab)-form
      symbol: $(subject.name.pascal)Form
    imports:
      - $ref: "#/needs/schema.types"
      - $ref: "#/needs/operation.client"

  index:
    exports:
      - $ref: "#/templates/form"

needs:
  schema.types: { required: true }
  operation.client: { required: true }

# shared:js-prettier-tsx-actions:start
actions:
  files:
    format:
      extensions: [.ts, .tsx]
      commands:
        - run: [(pnpm|yarn), dlx, [email protected], --ignore-path, .prettier-none, --write, $(files)]
        - run: [npm, exec, --yes, --package, [email protected], --, prettier, --ignore-path, .prettier-none, --write, $(files)]
        - run: [bun, x, [email protected], --ignore-path, .prettier-none, --write, $(files)]
  final:
    install:
      dependencies:
        args:
          - dev: { (pnpm|yarn): [-D], bun: [--dev], npm: [--save-dev] }
          - { pinned: "$(name)@$(version)", any: "$(name)" }
      commands:
        - run: [(pnpm|bun|yarn), add]
        - run: [npm, install]
# shared:js-prettier-tsx-actions:end