Skip to content

zwrawr/www.zakwest.co.uk

Repository files navigation

ww.zakwest.co.uk

Build Status Coverage Status License: CC BY 3.0

This is the source for my website www.zakwest.co.uk. It's built using Node.js on the server side and preact on the client side. jest and enzyme are used for testing whilst eslint and stylelint are the linters.

Image of the zakwest.co.uk site

Development CLI Commands

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# run tests with jest and preact-render-spy
npm run test

# run eslint and stylelint
npm run lint

Folder Structure

  • www.zakwest.tech
    • config service files for systemd and config files for apache when using dev.zakwest.co.uk
    • coverage code coverage reports produced by jest and consumed by coveralls
    • public files that are made accessable to webrequests by webpack or express
      • data json files, currently for the link boxes on the home page and the file tree
      • img all the dynamic/large/raster image assets are here
      • files all file downloads are served from here
    • src source code for the site
      • assets small image assets that can be bake into the build are here
      • components preact components and their styles
      • routes preact routes and their styles are here
      • style Site wide styles (font familys, coulor scheme) are here
    • server server side code run by node
    • tests tests for the site
      • __mocks__ testing mocks
      • __setup__ enzyme setup script
      • components tests for the preact components
      • routes tests for the preact routes

Building and Running the pseudo Production enviroment

Setup

Head over to the dev.zakwest.co.uk repo to find out how to use vagrant to host this project. The provisioning script deals with all the installation and setup and make the site avaliable at www.dev.zakwest.co.uk .

Rebuild

To rebuild the site via npm run the following commands.

    cd /var/www/www.zakwest.tech/
    npm run build

Restart

If changes have been made to the site, then you'll have to restart the node app.

	sudo service www.dev.zakwest.tech restart

If changes have been made to the nginx config, then you'll have to restart nginx.

	sudo restart nginx service

Clean

To remove all the built files do

    cd /var/www/www.zakwest.tech/
    npm run clean