1
Fork 0

Replace makefile with bash scripts

This commit is contained in:
Jake Howard 2018-05-18 20:59:30 +01:00
parent e17520cfaa
commit f133277b08
Signed by: jake
GPG key ID: 57AFB45680EDD477
10 changed files with 71 additions and 75 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

1
buildpack-run.sh Symbolic link
View file

@ -0,0 +1 @@
./scripts/build.sh

23
scripts/build.sh Executable file
View file

@ -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

8
scripts/common.sh Executable file
View file

@ -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

9
scripts/release.sh Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -e
source ./scripts/common.sh
bash ./scripts/build.sh
speedpack $OUTPUT_DIR -o $OUTPUT_DIR

7
scripts/server.sh Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -e
bash ./scripts/build.sh
hugo server --noHTTPCache --disableFastRender --gc

19
scripts/test.sh Executable file
View file

@ -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