All Projects → gkubisa → Elm App Boilerplate

gkubisa / Elm App Boilerplate

Licence: mit
Base project for Elm applications

Programming Languages

elm
856 projects

Projects that are alternatives of or similar to Elm App Boilerplate

Caldera
Caldera allows you to create a boilerplate service that ready to run inside the container (Go language)
Stars: ✭ 114 (-5.79%)
Mutual labels:  boilerplate
Go Postgres Jwt React Starter
A go, gin, and postgres API with jwt auth, complete with a react frontend
Stars: ✭ 115 (-4.96%)
Mutual labels:  boilerplate
Django Crud Ajax Login Register Fileupload
Django Crud, Django Crud Application, Django ajax CRUD,Django Boilerplate application, Django Register, Django Login,Django fileupload, CRUD, Bootstrap, AJAX, sample App
Stars: ✭ 118 (-2.48%)
Mutual labels:  boilerplate
Golang Gin Realworld Example App
Exemplary real world application built with Golang + Gin
Stars: ✭ 1,780 (+1371.07%)
Mutual labels:  boilerplate
Express Rest Boilerplate
⌛️ Express starter for building RESTful APIs
Stars: ✭ 1,794 (+1382.64%)
Mutual labels:  boilerplate
Docker Nginx Gunicorn Flask Letsencrypt
Boilerplate code for setting up Nginx + Gunicorn + Flask + automated LetsEncrypt certificates (https) using docker-compose.
Stars: ✭ 117 (-3.31%)
Mutual labels:  boilerplate
Kebs
Scala library to eliminate boilerplate
Stars: ✭ 113 (-6.61%)
Mutual labels:  boilerplate
Angular5 Example Shopping App
Angular 5 Example Shopping App + Angular Material + Responsive
Stars: ✭ 120 (-0.83%)
Mutual labels:  boilerplate
Electron Boilerplate
Boilerplate to kickstart creating an app with Electron
Stars: ✭ 1,560 (+1189.26%)
Mutual labels:  boilerplate
Static Site Boilerplate
A better workflow for building modern static websites.
Stars: ✭ 1,633 (+1249.59%)
Mutual labels:  boilerplate
Base App Nestjs
Base application using nest JS focused on DDD architecture and SOLID principles
Stars: ✭ 115 (-4.96%)
Mutual labels:  boilerplate
React Redux Auth0 Kit
Minimal starter boilerplate project with CRA, React, Redux, React Router and Auth0 authentication
Stars: ✭ 115 (-4.96%)
Mutual labels:  boilerplate
Flask Full
starter/boilerplate flask application with celery, mongoengine, signals, shell commands, swagger api docs and sphinx docs integration
Stars: ✭ 117 (-3.31%)
Mutual labels:  boilerplate
Vue Plugin Simple
A template to create vue plugins and shareable components.
Stars: ✭ 114 (-5.79%)
Mutual labels:  boilerplate
Koalerplate
Simple Koa Boilerplate for APIs
Stars: ✭ 118 (-2.48%)
Mutual labels:  boilerplate
Prodo
Prodo is a React framework to build apps faster.
Stars: ✭ 114 (-5.79%)
Mutual labels:  boilerplate
Simple Boilerplate
A simple webpack boilerplate for your comfortable work with HTML, JS and CSS.
Stars: ✭ 116 (-4.13%)
Mutual labels:  boilerplate
Elixir Telegram Bot Boilerplate
A boilerplate for making telegram bots with Elixir and Nadia
Stars: ✭ 120 (-0.83%)
Mutual labels:  boilerplate
Vue Ts Lib
Vue 3 library starter in TS with lint, auto release, changelog and tests
Stars: ✭ 119 (-1.65%)
Mutual labels:  boilerplate
Razzle Material Ui Styled Example
Razzle Material-UI example with Styled Components using Express with compression
Stars: ✭ 117 (-3.31%)
Mutual labels:  boilerplate

Elm App Boilerplate

Run Status

Provides an efficient development workflow and a starting point for building Elm applications.

Features

  • automated build of all application resources using webpack
  • Hot Module Replacement for the Elm code using elm-hot-loader
  • styling using elm-css
  • automatic re-execution of tests on source change for Elm and JavaScript code
  • test coverage using istanbul for the JavaScript tests
  • JavaScript code written in ES6, transpiled using Babel
  • JavaScript linted using eslint
  • continuous integration and deployment based on Shippable
  • dependency checking using npm-check-updates
  • consistent code formatting using elm-format

Getting Started

Fork and clone this repo.

npm install
npm start

Open http://localhost:8080/ in a browser.

For an alternative host or port run:

npm start -- --host=0.0.0.0 --port=8081

Testing

Run tests once off:

npm test # Elm and JavaScript tests
npm run test:elm # only Elm tests
npm run test:js # only JavaScript tests

Restart the tests on code change:

npm run tdd # Elm and JavaScript tests
npm run tdd:elm # only Elm tests
npm run tdd:js # only JavaScript tests

Deployment

The deployment is automated using Shippable and is triggered as follows:

  1. Run npm version [major|minor|patch] on the master branch.
  2. Add release notes in GitHub.

On success, the demo app is deployed to elm-app-boilerplate GitHub Pages.

Build Configuration Using Environment Variables

The default environment variables used by the build scripts are defined in the .env file. The defaults are always overridden by the variables defined in the environment. They are useful for abstracting away the differences between the development and production environments. For example, the following command builds the application with a custom BASE_PATH suitable for deployment to GitHub Project Pages.

BASE_PATH=/elm-app-boilerplate npm run build

The environment variables are first available to the webpack.config.babel.js script, so that the build itself can be parameterized. From there, the variables can be passed to JavaScript using DefinePlugin, and from JavaScript to Elm using flags.

Currently the following variables are supported:

  • BASE_PATH - defines the location of the generated JS and CSS files, and is prepended to all pathnames handled by the Elm application.

Updating Version

This project customizes the standard npm version script to also:

  • ensure that the dependencies are up to date
  • execute all tests
  • update the version in elm-package.json and tests/elm-package.json
  • push the branch on which the version change was made
  • push the created tag

Updating Dependencies

Dependency check and update is handled by ncu. A check runs automatically every time npm version is executed but can also be triggered explicitly.

npm run ncu # checks the dependencies in package.json
npm run ncu -- -a # updates all dependencies in node_modules and package.json

Note: all ncu parameters and flags have to be specified after --.

Elm Commands

The following Elm commands are exposed through npm scripts:

  • npm run elm
  • npm run elm-reactor
  • npm run elm-repl
  • npm run elm-package
  • npm run elm-make
  • npm run elm-test

The parameters to those commands must be specified after --, for example: npm run elm-package -- install evancz/elm-effects. See npm run-script.

Directory Structure

General

  • .editorconfig - configures the white space rules for text editors
  • .env - defines the default environment variables used by webpack
  • .gitignore - defines files and directories ignored by git
  • .npmrc - configuration for npm, currently used to provide a message template for npm version
  • package.json - defines dependencies and scripts for building, testing and running the application
  • shippable.yml - configuration of the continuous integration and deployment process based on Shippable
  • webpack.config.babel.js - webpack configuration used for building and running the application
  • dist/ - built application artifacts produced by npm run build

Elm

  • elm-package.json - describes the Elm application and its dependencies
  • src/ - Elm source files
  • src/Main.elm - Elm application entry point
  • src/Stylesheets.elm - elm-css entry point, lists all the stylesheets which need to be processed
  • src/App/ - the namespace for all application Elm modules
  • src/App/Etc/ - contains configuration modules
  • src/App/Etc/Config.elm - the Elm app configuration
  • src/App/Etc/Style.elm - the configuration for stylesheets, including the color palette, device breakpoints, font sizes, etc
  • src/App/Section/ - contains all sections. A section groups related pages and manages routing within its group
  • src/App/Section/<SomeSection>/Route.elm - contains route mappings and helpers for <SomeSection>
  • src/App/Page/ - contains all pages. Page are responsible for the main contents of their sections
  • src/App/Widget/ - contains all reusable widgets
  • src/App/**/<SomeModule>/Css.elm - contains the CSS rules for <SomeModule> defined using elm-css
  • src/App/**/<SomeModule>/Style.elm - contains style-related types and definitions for <SomeModule>, which are shared between the application and the Elm CSS modules
  • tests/elm-package.json - defines dependencies for running tests
  • tests/App/**/<SomeModule>Test.elm - contains tests for <SomeModule>

JavaScript

  • .babelrc - configures the JavaScript babel transpiler
  • .eslintrc.test.yml - eslint config for JavaScript tests
  • .eslintrc.yml - eslint config for JavaScript application code
  • karma.conf.js - Krama configuration used for running the JavaScript tests in a browser
  • coverage/ - JavaScript test coverage reports
  • js/ - contains JavaScript code
  • js/main.js - entry point to the application JavaScript code
  • js/tests.js - entry point for JavaScript tests - automatically loads all *.test.js files in js/

HTML

  • html-minifier.json - configuration file used by the html-minifier
  • html/index.html - overall application entry point

Styling Conventions

Use a BEM-like methodology for styling.

Because the CSS class names are generated from the Elm class names, it is not feasible to follow the BEM class name format. So, here's an alternative:

  • Using the elm-css namespace's, prefix the CSS class names with a letter "p", "s", "w" corresponding to the folder in which the component is located - "Page", "Section", "Widget" respectively. It allows to quickly find the Elm components based on the CSS class names during debugging.
  • Specify longer namespaces when you're creating specializations of other components. For example, the Menu component uses "w" prefix by default. The MainMenu component is a specialization of the Menu component, so it uses "wMain" prefix. When combined with the Menu's CssClass'es, the generated CSS class names correspond to the MainMenu component name, that is, block-level class is wMainMenu.
  • Separate the blocks, elements and modifiers with a single underscore.
  • Use PascalCase for the block and element names.
  • Use camelCase for the modifier names.
  • Avoid passing parameters to CssClass constructors as much as possible, because they limit the safety guarantees afforded by elm-css. If the parameters are really necessary, try to limit yourself to Int only.

Here's an example - using the following Elm definitions:

namespace = withNamespace "w"
type CssClass
  = Block
  | Block_modifier
  | Block_modifierWithParam Int
  | Block_Element
  | Block_Element_modifier
  | Block_Element_modifierWithParam Int

we can get CSS class names like these:

.wBlock
.wBlock_modifier
.wBlock_modifierWithParam-1
.wBlock_modifierWithParam-2
.wBlock_modifierWithParam-3
.wBlock_Element
.wBlock_Element_modifier
.wBlock_Element_modifierWithParam-1
.wBlock_Element_modifierWithParam-2
.wBlock_Element_modifierWithParam-3
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].