From f133277b08cdd5836412ad5891ede0745510ead8 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 18 May 2018 20:59:30 +0100 Subject: [PATCH] Replace makefile with bash scripts --- .buildpacks | 2 +- .circleci/config.yml | 4 +-- Makefile | 63 -------------------------------------------- README.md | 10 +------ buildpack-run.sh | 1 + scripts/build.sh | 23 ++++++++++++++++ scripts/common.sh | 8 ++++++ scripts/release.sh | 9 +++++++ scripts/server.sh | 7 +++++ scripts/test.sh | 19 +++++++++++++ 10 files changed, 71 insertions(+), 75 deletions(-) delete mode 100644 Makefile create mode 120000 buildpack-run.sh create mode 100755 scripts/build.sh create mode 100755 scripts/common.sh create mode 100755 scripts/release.sh create mode 100755 scripts/server.sh create mode 100755 scripts/test.sh diff --git a/.buildpacks b/.buildpacks index fff027c..4036f18 100644 --- a/.buildpacks +++ b/.buildpacks @@ -1,3 +1,3 @@ https://github.com/heroku/heroku-buildpack-nodejs https://github.com/RealOrangeOne/heroku-buildpack-hugo -https://github.com/RealOrangeOne/heroku-buildpack-make +https://github.com/weibeld/heroku-buildpack-run diff --git a/.circleci/config.yml b/.circleci/config.yml index 8a5874b..4fc0161 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,7 +22,7 @@ jobs: - node_modules - run: name: Build site - command: make release + command: ./scripts/release.sh - run: name: Run Tests - command: make test + command: ./scripts/test.sh diff --git a/Makefile b/Makefile deleted file mode 100644 index 510de32..0000000 --- a/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -BASEDIR=$(PWD) -NODE_BIN=$(BASEDIR)/node_modules/.bin - -STATIC_SRC=$(BASEDIR)/static/src -STATIC_BUILD=$(BASEDIR)/static/build -OUTPUT_DIR=$(BASEDIR)/public - - -release: build - $(NODE_BIN)/speedpack $(OUTPUT_DIR) -o $(OUTPUT_DIR) - - -build: install - rm -rf $(OUTPUT_DIR) - rm -rf $(STATIC_BUILD) - rm -rf $(BASEDIR)/resources - mkdir -p $(STATIC_BUILD)/js $(STATIC_BUILD)/css - hugo gen chromastyles --style=tango > $(STATIC_SRC)/scss/highlight.css - $(NODE_BIN)/browserify $(STATIC_SRC)/js/index.js -o $(STATIC_BUILD)/js/app.js - $(NODE_BIN)/node-sass $(STATIC_SRC)/scss/style.scss $(STATIC_BUILD)/css/style.css --source-map-embed - cp -r $(BASEDIR)/node_modules/lightgallery/dist/fonts $(STATIC_BUILD) - cp -r $(STATIC_SRC)/img $(STATIC_BUILD)/img - cp node_modules/mermaid/dist/mermaid.min.js $(STATIC_BUILD)/js/mermaid.min.js - @hugo -vDEF --stepAnalysis --gc - mkdir -p $(OUTPUT_DIR)/.well-known/ - cp $(BASEDIR)/static/keybase.txt $(OUTPUT_DIR)/keybase.txt - cp $(BASEDIR)/static/security.txt $(OUTPUT_DIR)/.well-known/security.txt - -server: build - hugo server --noHTTPCache --disableFastRender --gc - - -clean: - rm -rf $(STATIC_BUILD) - rm -rf $(OUTPUT_DIR) - rm -rf $(BASEDIR)/node_modules - - -install: node_modules - @hugo version - -node_modules: - npm install - - -test: - $(NODE_BIN)/sass-lint -vqc .sass-lint.yml - $(NODE_BIN)/eslint $(STATIC_SRC)/js - $(NODE_BIN)/yamllint data/*.yml - $(NODE_BIN)/yamllint config.yml - $(NODE_BIN)/mdspell --en-gb -ranx 'content/**/*.md' - $(NODE_BIN)/blcl -ero ./public/ - -deadlink: - $(NODE_BIN)/blcl -ro ./public/ \ - --exclude "open.spotify.com"\ - --exclude "p.scdn.co"\ - --exclude "staticflickr.com"\ - --exclude "twitter.com/intent"\ - --exclude "facebook.com/sharer"\ - --exclude "reddit.com/submit" - -.PHONY: build clean install test diff --git a/README.md b/README.md index 12ff3fa..f8956d0 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,4 @@ [![Circle CI](https://circleci.com/gh/RealOrangeOne/theorangeone.net.svg?style=svg)](https://circleci.com/gh/RealOrangeOne/theorangeone.net) -## Installation -```bash -make -``` - -## Run Tests -```bash -make test -``` +https://theorangeone.net diff --git a/buildpack-run.sh b/buildpack-run.sh new file mode 120000 index 0000000..c6665c2 --- /dev/null +++ b/buildpack-run.sh @@ -0,0 +1 @@ +./scripts/build.sh \ No newline at end of file diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..22c42e9 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -e + +source ./scripts/common.sh + +rm -rf $OUTPUT_DIR +rm -rf $STATIC_BUILD +rm -rf $BASEDIR/resources +mkdir -p $STATIC_BUILD/js $STATIC_BUILD/css +hugo gen chromastyles --style=tango > $STATIC_SRC/scss/highlight.css +browserify $STATIC_SRC/js/index.js -o $STATIC_BUILD/js/app.js +node-sass $STATIC_SRC/scss/style.scss $STATIC_BUILD/css/style.css --source-map-embed + +cp -r $BASEDIR/node_modules/lightgallery/dist/fonts $STATIC_BUILD +cp -r $STATIC_SRC/img $STATIC_BUILD/img +cp node_modules/mermaid/dist/mermaid.min.js $STATIC_BUILD/js/mermaid.min.js + +hugo -vDEF --stepAnalysis --gc +mkdir -p $OUTPUT_DIR/.well-known/ + +cp $BASEDIR/static/keybase.txt $OUTPUT_DIR/keybase.txt +cp $BASEDIR/static/security.txt $OUTPUT_DIR/.well-known/security.txt diff --git a/scripts/common.sh b/scripts/common.sh new file mode 100755 index 0000000..1d7d983 --- /dev/null +++ b/scripts/common.sh @@ -0,0 +1,8 @@ +BASEDIR=$PWD +NODE_BIN=$BASEDIR/node_modules/.bin + +STATIC_SRC=$BASEDIR/static/src +STATIC_BUILD=$BASEDIR/static/build +OUTPUT_DIR=$BASEDIR/public + +export PATH=$BASEDIR/node_modules/.bin/:$PATH diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..92fe391 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +source ./scripts/common.sh + +bash ./scripts/build.sh + +speedpack $OUTPUT_DIR -o $OUTPUT_DIR diff --git a/scripts/server.sh b/scripts/server.sh new file mode 100755 index 0000000..1f7857a --- /dev/null +++ b/scripts/server.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -e + +bash ./scripts/build.sh + +hugo server --noHTTPCache --disableFastRender --gc diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 0000000..cd24421 --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -e + +source ./scripts/common.sh + +sass-lint -vqc .sass-lint.yml +eslint $STATIC_SRC/js +yamllint data/*.yml +yamllint config.yml +mdspell --en-gb -ranx 'content/**/*.md' + +blcl -ro ./public/ \ + --exclude "open.spotify.com"\ + --exclude "p.scdn.co"\ + --exclude "staticflickr.com"\ + --exclude "twitter.com/intent"\ + --exclude "facebook.com/sharer"\ + --exclude "reddit.com/submit" || true