Skip to content

lependu/marko-boilerplate

Repository files navigation

Marko Boilerplate

This repo demos how

plays together. Minimal lasso config and few basic test with nyc coverage included.

Prepare

You need to ensure that chrome based mocha tests can run in your envitonment. For start take a look at the puppeteer project.

Tested with node:8.8.1-slim docker based docker image on debian 8.9 host. Dockerfile included.

  1. Clone the repo $ git clone https://github.com/lependu/marko-boilerplate
  2. $ cd marko-boilerplate
  3. Build the container: $ docker build -t [image-name] .
  4. Install dependencies: $ docker run -ti [--rm] -v $(pwd):/home/node/app -p [host-port]:8080 [image-name] -c "npm install"
  5. Run the container: $ docker run -ti [--rm] -v $(pwd):/home/node/app -p [host-port]:8080 [image-name] -c "npm run [start|build|serve|lint|test]"

Be advised that the image size is ~ 600Mb + it will take ~400Mb more in the ./node_modules after install.

I am not intend to test it in Windows or Mac environments, but any PR appreciated.

Starting the server

$ npm start

Start the server in production mode (minification enabled, etc.):

$ NODE_ENV=production npm start

Build a static site

Build the project in production mode:

$ npm run build

Tests

$ npm run lint

Eslint

$ npm run test

Test with mocha.

$ npm run coverage

Generates istanbul coverage report into coverage directory. For further configuration take a look at the .nycrc file.

Known issues

Handling click() events in tests

I could not make Element.click() test to work. I guess it is related with this or this puppeteer issue. Any help appreciated.

Lasso incompability

The marko-starter@2.x.x has lasso@3.0.0-beta.x dependency,

while marko-cli@2.x.x has lassso@2.x.x dependency.

Thats why we have to add "lasso": "*" in the package.json

Which is a bit messy, but works...

Which works until you $ npm i ... something. After that you have to

$ npm i lasso@3.0.0-beta.x before run marko-starter commands and

$ npm i lasso@2 before run tests.