diff --git a/.gitignore b/.gitignore index 119cba0..4c747ca 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ ehthumbs.db Thumbs.db DalaFloda* +dist/* +hgnm-2014.zip # Created by https://www.gitignore.io/api/node ### Node ### diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c2c6c5f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: node_js +node_js: +- '4' +- '4.2' +- '5.1' +install: + - npm install +script: + - npm run build +deploy: + provider: releases + api_key: + secure: CJa6+7F3KMRxjwdAx/4zgLU55l1uUE3CPUN0ezitehbcJX+yQoKfM0LevIgZw2UVjyGD3xXttTe3YDG0ypG9jqqxhJSa3bA7dV9OnP4+rY/vPvjZLRmBTqSjb5S/d4oB78l4hxgxw7+RuwEr0DXhaFJ4BzJ00zplQ9TAmlPOZPs= + file: hgnm-2014.zip + skip_cleanup: true + on: + repo: HGNM/hgnm-2014 + tags: true + node: '4.2' diff --git a/install-dependencies.sh b/install-dependencies.sh new file mode 100755 index 0000000..ab58038 --- /dev/null +++ b/install-dependencies.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Check all required CLIs are available +dependencies=( wget unzip ) +for dependency in "${dependencies[@]}"; do + command -v $dependency >/dev/null 2>&1 || { echo >&2 "‘$dependency’ command is required but it’s not installed. Aborting."; exit 1; } +done + +# Get required proprietary fonts for theme +wget -O df.zip "http://chrisswithinbank.net/wp-content/uploads/2016/06/1407-HRGQJV.zip" +if [[ -f "df.zip" ]]; then + unzip df.zip -d font/ + rm df.zip +else + echo "Can’t find file: df.zip. Fatal error…" + exit 1 +fi diff --git a/package.json b/package.json index b1c1752..63bed23 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,12 @@ "description": "Repository for WordPress theme development for hgnm.org", "scripts": { "start": "npm run css:build && npm run css:watch", + "build": "npm run css:build && npm run copy && npm run zip", "css:build": "node-sass --include-path scss scss/style.scss style.css", - "css:watch": "node-sass --include-path scss scss/style.scss style.css -w" + "css:watch": "node-sass --include-path scss scss/style.scss style.css -w", + "copy": "cpy '**/*' '!scss/*' '!dist/*' '!.gitignore' '!.travis.yml' '!install-dependencies.sh' '!node_modules/**/*' '!hgnm-2014.zip' 'dist/' --parents --nodir", + "zip": "bestzip hgnm-2014.zip dist/", + "postinstall": "./install-dependencies.sh" }, "repository": "HGNM/hgnm-2014", "keywords": [ @@ -19,6 +23,11 @@ }, "homepage": "https://github.com/HGNM/hgnm-2014#readme", "devDependencies": { + "bestzip": "^1.1.3", + "cpy-cli": "git+https://github.com/chimon2000/cpy-cli.git", "node-sass": "^3.7.0" + }, + "engines": { + "node": ">=4.0.0" } }