Install new features in old apps with Elm Review

Mateus Leite and I have just published a set of elm-review rules for installing new features in existing Elm apps (adding pages, adding magic-link authentication). The task of transporting a feature from one app to another is usually routine but can require a lot of work. Part of it is easy: copy some new modules into the target app. But then these modules need to be “wired up” to the target. That is a a task that a program rather than a human should be able to do. The code discussed here is an experiment to that end.

See codeinstaller-rulesets 1.0.1 .

This package depends on a previous set of tools that you will find in codeinstaller-rulesets 1.0.1

We welcome suggestions and feedback of all kinds including pull requests. We expect this package to change a lot as we get more experience.

Experimenting with the package

Clone or fork the repo. Take a look at preview/src/ReviewCongi.elm:

config : List Rule
config  = pagesConfig

magicLinkConfig = RuleSet.Add.magicLinkAuth "Jim Carlson" "jxxcarlson" "jxxcarlson@gmail.com"

pagesConfig = RuleSet.Add.pages [ ("Quotes", "quotes"), ("Jokes", "jokes") ]

1. Running the demo

Modify pagesConfig as desired, then run make app at the root level.

2. Go to demo/ and run lamdera live.

You should see a simple app that looks like this:

3. Then go back to the root of the directory

and run make app. The app will now look like this:

Magic Link Authentication

Same procedure, except use a different rule set, which you should configure with your own name, username, and email address. You will be the first registered user of the app, and you will have admin privileges, including being able to view the Admin page.

For things to be fully operational, you will need a Postmark.com API key. Put it in vendor-secret/Env.elm like this:

module Env exposing (postmarkApiKey)

postmarkApiKey =
    "TOP_SECRET"

Put that file path in your .gitgnore file so that you don’t accidentally commit it.

1. Signing in:

2. Type in your email address and press “Sign in”. Then you get this screen:

3. Get your sign-in code from your email. Put it in the box above, then go to the admin tab:

7 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.