elm-pages-v3-beta/docs/upgrade-guide.md
2020-01-03 16:19:39 -08:00

2.1 KiB

elm-pages Upgrade Guide

Upgrading to Elm Package 1.1.0 and NPM Package 1.1.3

Here's a diff to help guide you through the change: 5de5102d70.

High level changes

  • A few modules that were previously copied to the gen folder are now part of the published package. This makes it easier to discover the functionality through the package site and understand how to initialize an elm-pages app.
  • The new StaticHttp API now allows you to make HTTP requests during the build step that are built into your app's assets (see the StaticHttp announcement blog post). If you don't have any StaticHttp data for a given page, you can use StaticHttp.succeed (see the changes to the view function in the elm-pages-starter diff).

Step by step upgrade checklist

  • Be sure to install the latest NPM package and the latest elm package (NPM version 1.1.3 and Elm package version 1.1.0 at the time of this writing).
  • elm install elm/time (the generated Pages.elm has a new builtAt value of type Time so this needs to be installed for it to compile).
  • The init function now takes an additional argument, the page you're on when you load the app. You can just add a discarded argument like this.
  • The head function is no longer called from Pages.application because it now has access to StaticHttp data. Instead, it is part of the view function, see this diff.