wasmCloud / wasmcloud-otp

wasmCloud host runtime that leverages Elixir/OTP and Rust to provide simple, secure, distributed application development using the actor model
Apache License 2.0
229 stars 49 forks source link

Upgrade wasmcloud_host to Phoenix 1.6.0 #205

Closed brooksmtownsend closed 2 years ago

brooksmtownsend commented 2 years ago

Phoenix 1.6.0 has been released, https://www.phoenixframework.org/blog/phoenix-1.6-released, which includes numerous improvements, notably:

Of course, the second bullet point there is the more impactful one. This will allow us to ditch npm from our build actions, dependencies, etc. Using ESbuild will also let us embed wasmcloud-js into the dashboard itself, which is awesome.

From @ks2211 , here's a few notes on how he got it all working:

if you do update, theres 2 things I had to update inside the config to get it working

in the config/config.exs , need to drop the --target=es2016 and just let it use the defalut cjs/iife target
and then in config/dev.esx , need to add this into the watchers cp: ["assets/node_modules/@wasmcloud/wasmcloud-js/dist/wasmcloud-rs-js/pkg/wasmcloud.wasm", "priv/static/assets/"]

We can also leverage the 1.5.x -> 1.6.x step-by-step upgrade guide as found here https://gist.github.com/chrismccord/2ab350f154235ad4a4d0f4de6decba7b

ks2211 commented 2 years ago

So this upgrade process should be pretty simple

  1. rename all leex files to heex
  2. in the new heex template files, update any reference to variables from the @ to {} format that's used in phx1.6
  3. No esbuild configuration needed, you can use the default options generated by phx since all of the front end assets are vendored in assets/vendor. If stuff is being imported via npm, in theory that should all get bundled too with the default options....its only if you use something like postCSS or tailwindCSS, you'll have to introduce either the config OR additional cli tooling

will wait for brooks to get back from vacation to avoid stepping on any toes/overwriting any in flight changes (especially since file names being changed/content being updated)