diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1d023ccb4..3bc8cb58e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,19 +34,22 @@ If you wish to contribute documentation, [this is a suggested read](https://www. ## Developing `spago` -If you'd like to develop spago locally, the recommended tool to use is [stack][stack] +If you'd like to develop spago locally, the recommended tool to use is [stack][stack]. -To compile the project from source you can do +We use `make` to coordinate the build, here's a compilation of useful targets: ```bash +# To compile the project from source: $ make -$ stack build --fast -``` -To install the version you're developing system-wide, do +# File-watching build: +$ make dev -```bash -$ stack install +# Running tests: +$ make test + +# Installing system-wide the current build: +$ make install ``` If you edit any title in the readme, run `doctoc` to update the Table of Contents: diff --git a/Makefile b/Makefile index a66b65b7e..9218f7569 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,16 @@ -all: fetch-templates +all: build fetch-templates: - @curl https://github.com/purescript/purescript-docs-search/releases/download/v0.0.10/docs-search-app.js -o templates/docs-search-app-0.0.10.js - @curl https://github.com/purescript/purescript-docs-search/releases/download/v0.0.10/purescript-docs-search -o templates/purescript-docs-search-0.0.10 - @chmod +x templates/purescript-docs-search-0.0.10 - @curl https://github.com/purescript/purescript-docs-search/releases/download/v0.0.11/docs-search-app.js -o templates/docs-search-app-0.0.11.js - @curl https://github.com/purescript/purescript-docs-search/releases/download/v0.0.11/purescript-docs-search -o templates/purescript-docs-search-0.0.11 - @chmod +x templates/purescript-docs-search-0.0.11 + @./scripts/fetch-templates +dev: fetch-templates + @stack build --fast --file-watch + +build: fetch-templates + @stack build --fast + +test: fetch-templates + @stack test --fast --pedantic + +install: build + @stack install --fast \ No newline at end of file diff --git a/README.md b/README.md index ae4f28285..d21c83075 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ npm install -g spago Other installation methods available: - Download the binary from the [latest GitHub release][spago-latest-release] -- Compile from source by cloning this repo and running `stack install` +- Compile from source by cloning this repo and running `make install` - With Nix, using [easy-purescript-nix][spago-nix] - On FreeBSD, install with `pkg install hs-spago`. diff --git a/scripts/fetch-templates b/scripts/fetch-templates new file mode 100755 index 000000000..f19a9791c --- /dev/null +++ b/scripts/fetch-templates @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +templatesDir="./templates" +versions="0.0.10 0.0.11" +for version in $versions; do + file1="${templatesDir}/docs-search-app-${version}.js" + if [ ! -f "${file1}" ]; then + echo "Fetching ${file1}"; + curl "https://github.com/purescript/purescript-docs-search/releases/download/v${version}/docs-search-app.js" -o ${file1} + fi + file2="${templatesDir}/purescript-docs-search-${version}" + if [ ! -f "${file2}" ]; then + echo "Fetching ${file2}"; + curl "https://github.com/purescript/purescript-docs-search/releases/download/v${version}/purescript-docs-search" -o ${file2} + chmod +x "${file2}" + fi +done