add separate instructions for Netlify builds

This commit is contained in:
Brian Hicks 2020-10-29 08:31:19 -05:00
parent 09401dcfe6
commit 83d2b7a82c
2 changed files with 23 additions and 1 deletions

View File

@ -1,3 +1,3 @@
[build]
command = "shake public"
command = "script/netlify.sh"
publish = "public"

22
script/netlify.sh Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -xeuo pipefail
# Netlify doesn't support building stuff via Haskell or
# Nix. Those things are vaguely on the horizon (check the issues at
# https://github.com/netlify/build-image) but for now it's way simpler to just
# accept that Netlify will need separate instructions.
# get our dependencies
npm install
npm install elm
# make sure we're building into a clean folder
if test -d public; then rm -rf public; fi
mkdir public
# build the interactive parts
(cd styleguide-app && npx elm make Main.elm --output ../public/elm.js)
npx browserify --entry styleguide-app/manifest.js --outfile public/bundle.js
# copy assets
cp -r styleguide-app/assets public/assets