Git Product home page Git Product logo

hyperapptemplate's Introduction

Small Hyperapp template with testing included

Hyperapp template with Parcel bundler. Small and fast! Example unit and end to end test with Jest & Cypress.

JavaScript Style Guide code style: prettier tested with jest Cypress.io tests

What's inside?

  • hyperapp (Library for building web apps)

and for development time

  • parcel-bundler (Blazing fast, zero configuration web application bundler)
  • hyperapp-redux-devtools (Debugging hyperapp statechanges with Redux devtools)
  • jest (Delightful JavaScript Testing)
  • cypress (Fast, easy and reliable testing for anything that runs in a browser)
  • standard (JavaScript Standard Style)
  • prettier-standard (Code formatter)

Bundling is handled with parcel bundler (https://parceljs.org/) which provides fast bundles.

Getting started

Clone and install deps

git clone https://github.com/tkivela/hyperapptemplate.git
cd hyperapptemplate
yarn
yarn start

Then open http://localhost:1234 and edit ./src/ -files and press save. You must manually refresh browser window after editing sources. Bundling the application this way will generate unoptimized build with sourcemaps to 'build' directory.

Directory structure

Majority of code lives in src directory:

src/
├── actions
├── components
├── state
├── index.js
  • actions: actions which modify the state
  • components: components which can be using jsx
  • state: application's state tree
  • index.js: main entry point

End to end browser tests are located in cypress -directory.

Building for Production

yarn build

This will compile your JS and copy your assets to the dist folder which you can deploy wherever as a webpage. dist folder also includes hyperapp-redux-devtools.js, you can delete that file if you don't run the code in development environment.

Testing

yarn test

Running formats and lints code (Prettier & Standard) and then runs unit tests (Jest) and end to end tests (Cypress). If there are any errors in the end to end tests the script will leave a screenshot of the browser window which reproduces the error to cypress/screenshot folder. Screenshot folder is automatically deleted with each test run. If you want to create a video of the e2e testing run automatically to cypress/videos folder, just change videoRecording=false to videoRecording=true from package.json.

If you want to test steps in the Cypress UI first start the dev server (yarn start) and then run

yarn cy:open

I've included example tests for actions, UI snapshot with jest and end to end test with Cypress.

Debugging

By using Redux Devtools extions for Chrome you can debug state changes in development build. Also normal debugging (with sourcemaps) can be done from browser's devtools.

hyperapptemplate's People

Contributors

tkivela avatar tokivela avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

selvacodes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.