npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

elm-prefab

v0.1.16

Published

Maintainable code scaffolding for Elm Apps

Downloads

393

Readme

Elm Prefab

Prefab (Noun)
A prefabricated building or structure that is manufactured in sections, typically in a factory, and then transported and assembled on site to form a complete structure.

Prefab (Adjective) A portmanteau of "Pretty" and "Fabulous" :sparkles:

Elm Prefab is a codegeneration tool for generating and maintaining Elm apps.

It's organized via plugins, where each plugin is independent. You can pick and choose what you want.

  • App - A base app architecture that has

    • Page-level state caching
    • Notion-like flexibility for viewing multiple pages at once.
    • Routing generation - Spend as little time futzing with routes as possible!
    • Built-in support for elm-program-test for full end-to-end testing of your Elm app.
  • Assets - Be able to link to a static asset

  • GraphQL - Write GraphQL queries and mutations and get Elm code to use them! (Powered by vendrinc/elm-gql)

The Elm Architecture is a very stable way to build apps, but there are some nuances to master.

This project is born out of years of experience working on large (>500k lines) Elm apps at Blissfully and now Vendr.

This is for those who want to speed up development for new projects, avoid some tricky situations that can be expensive to fix, and get some super powers along the way 🚀.

Getting started

Generate a new Elm project!:

npx elm-prefab

Or, if you want to get started more "traditionally":

# navigate to your project directory and install `elm-prefab`
npm install --save-dev elm-prefab

# Running `elm-prefab` will generate working
npm run elm-prefab

Starting the Vite development server

npm run dev will start a dev server using Vite so you can get coding!

Running npm run build will build things for production, with the resultant files in the dist folder. Feel free to check out the ViteJS docs.

The first place to look

elm-prefab has generated src/Page/Home.elm for you, let's take a look.

If you've worked with Elm before it should be pretty familiar as a standard model/update/Msg/view thing.

The next place to look is src/Main.elm.

This is the global part of the app. This is where you can control:

  • Global layout, including showing multiple pages in one layout.
  • Authentication logic.
  • Any other "App-wide" thing you might want.

Now go build something! If you have questions, check out the below guides.

FAQ