liveview-native / live_view_native

A framework for building native applications with Phoenix LiveView
https://native.live/
MIT License
458 stars 19 forks source link

lvn.install task typos and bugs #177

Closed BrooklinJazz closed 2 months ago

BrooklinJazz commented 2 months ago

The current instructions printed after running lvn.setup seem to have some bugs. Here's the version printed for me:

# config/config.exs

# LVN - Required
# Registers each available plugin
config :live_view_native, plugins: [
  LiveViewNative.SwiftUI
]

# LVN - Required
# Each format must be registered as a mime type add to
# existing configuration if one exists as this will overwrite
config :mime, :types, %{
  "text/swiftui" => ["swiftui"]
}

# LVN - Required
# Phoenix must know how to encode each LVN format
config :phoenix_template, :format_encoders, [
  swiftui: Phoenix.HTML.Engine
]

# LVN - Required
# Phoenix must know how to compile neex templates
config :phoenix, :template_engines, [
  neex: LiveViewNative.Engine
]

# config/dev.exs

# LVN - Optional
# Allows LVN templates to be subject to LiveReload changes
config :, LvnWorkshopWeb.Endpoint,
  live_reload: [
    patterns: [
      ~r"priv/static/(?!uploads/).*(js|css|png|jpeg|jpg|gif|svg)$",
      ~r"priv/gettext/.*(po)$",
      ~r"lib/anotherone_web/(controllers|live|components)/.*(ex|heex|neex)$"
    ]
  ]

# lib/lvn_workshop_web/router.ex

# LVN - Required
# add the formats to the `accepts` plug for the pipeline used by your LiveView Native app
plug :accepts, [
  "html",
  "swiftui"
]

# LVN - Required
# add the root layout for each format
plug :put_root_layout, [
  html: {LvnWorkshopWeb.Layouts, :root},
  swiftui: {LvnWorkshopWeb.Layouts.SwiftUI, :root}
]

# lib/lvn_workshop_web/endpoint.ex

# LVN - Optional
# Add the LiveViewNative.LiveRealoder to your endpoint
if code_reloading? do
  socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
  plug Phoenix.LiveReloader
  plug LiveViewNative.LiveReloader
  plug Phoenix.CodeReloader
  plug Phoenix.Ecto.CheckRepoStatus, otp_app: :form_demo
end

# config/config.exs

LVN - Required
# You must configure LiveView Native Stylesheets
# on which file path patterns class names should be extracted from
config :live_view_native_stylesheet,
  content: [
    swiftui: [
      "lib/**/*swiftui*"
    ]
  ],
  output: "priv/static/assets"

# LVN - Optional
# If you want to inspect LVN stylesheets from your browser add the `style` type
config :mime, :types, %{
  "text/styles" => ["styles"]
}

# config/dev.exs

# LVN - Optional
# Allows LVN stylesheets to be subject to LiveReload changes
config :, LvnWorkshopWeb.Endpoint,
  live_reload: [
    patterns: [
      ~r"priv/static/(?!uploads/).*(js|css|png|jpeg|jpg|gif|svg)$",
      ~r"priv/gettext/.*(po)$",
      ~r"lib/anotherone_web/(controllers|live|components|styles)/.*(ex|heex)$"
    ]
  ]

# LVN - Optional
# Adds dev mode stylesheet annotations for client IDEs and expands stylsheets visually
config :live_view_native_stylesheet,
  annotations: true,
  pretty: true

Bugs noted:

Also, this instruction has a missing atom config :.

# LVN - Optional
# Allows LVN templates to be subject to LiveReload changes
config :, LvnWorkshopWeb.Endpoint,
  live_reload: [
    patterns: [
      ~r"priv/static/(?!uploads/).*(js|css|png|jpeg|jpg|gif|svg)$",
      ~r"priv/gettext/.*(po)$",
      ~r"lib/anotherone_web/(controllers|live|components)/.*(ex|heex|neex)$"
    ]
  ]
BrooklinJazz commented 2 months ago
Screenshot 2024-05-03 at 12 47 39 PM

The text "anotherone" appears here for some reason

BrooklinJazz commented 2 months ago

This wording is confusing:

# Each format must be registered as a mime type add to
# existing configuration if one exists as this will overwrite