From 57903e7ac37447fec2f230ab9c0c2812638b037c Mon Sep 17 00:00:00 2001 From: Steven Vandevelde Date: Mon, 24 Feb 2020 15:20:46 +0100 Subject: [PATCH] Make -> Just --- Justfile | 220 +++++++++++++++++++++++ Makefile | 228 ------------------------ README.md | 3 +- package.json | 2 +- src/Applications/UI/Equalizer/State.elm | 1 + yarn.lock | 22 +-- 6 files changed, 235 insertions(+), 241 deletions(-) create mode 100644 Justfile delete mode 100644 Makefile diff --git a/Justfile b/Justfile new file mode 100644 index 00000000..af0c61e2 --- /dev/null +++ b/Justfile @@ -0,0 +1,220 @@ +BUILD_DIR := "./build" +NPM_DIR := "./node_modules" +SRC_DIR := "./src" +SYSTEM_DIR := "./system" +TEMPORARY_DIR := "./tmp" + + +default: dev + + +# Tasks +# ===== + +@build: clean system css elm js + echo "> Build completed ⚡" + + +@build-prod: clean system css-prod elm-prod js-prod + echo "> Production build completed 🛳" + + +@clean: + echo "> Cleaning build directory" + rm -rf {{BUILD_DIR}} || true + + +@css: + echo "> Compiling CSS" + mkdir -p {{BUILD_DIR}} + mkdir -p {{TEMPORARY_DIR}} + {{NPM_DIR}}/.bin/postcss \ + "{{SRC_DIR}}/Css/About.css" \ + --output "{{BUILD_DIR}}/about.css" \ + --config "{{SYSTEM_DIR}}/Css/" + {{NPM_DIR}}/.bin/postcss \ + "{{SRC_DIR}}/Css/Application.css" \ + --output "{{BUILD_DIR}}/application.css" \ + --config "{{SYSTEM_DIR}}/Css/" + + +@css-prod: css + echo "> Optimizing CSS" + {{NPM_DIR}}/.bin/purgecss \ + --config {{SYSTEM_DIR}}/Css/purgecss.about.js \ + --out {{BUILD_DIR}} + {{NPM_DIR}}/.bin/purgecss \ + --config {{SYSTEM_DIR}}/Css/purgecss.application.js \ + --out {{BUILD_DIR}} + {{NPM_DIR}}/.bin/csso \ + "{{BUILD_DIR}}/about.css" \ + --output "{{BUILD_DIR}}/about.css" + {{NPM_DIR}}/.bin/csso \ + "{{BUILD_DIR}}/application.css" \ + --output "{{BUILD_DIR}}/application.css" + + +@elm: + echo "> Compiling Elm application" + elm make {{SRC_DIR}}/Applications/Brain.elm --output {{BUILD_DIR}}/brain.elm.js + elm make {{SRC_DIR}}/Applications/UI.elm --output {{BUILD_DIR}}/ui.elm.js + + +@elm-prod: + echo "> Compiling Elm application (optimized)" + elm make {{SRC_DIR}}/Applications/Brain.elm --output {{BUILD_DIR}}/brain.elm.js --optimize + elm make {{SRC_DIR}}/Applications/UI.elm --output {{BUILD_DIR}}/ui.elm.js --optimize + + {{NPM_DIR}}/.bin/terser {{BUILD_DIR}}/brain.elm.js \ + --output {{BUILD_DIR}}/brain.elm.tmp.js \ + --compress --mangle + + {{NPM_DIR}}/.bin/terser {{BUILD_DIR}}/ui.elm.js \ + --output {{BUILD_DIR}}/ui.elm.tmp.js \ + --compress --mangle + + rm {{BUILD_DIR}}/brain.elm.js + mv {{BUILD_DIR}}/brain.elm.tmp.js {{BUILD_DIR}}/brain.elm.js + rm {{BUILD_DIR}}/ui.elm.js + mv {{BUILD_DIR}}/ui.elm.tmp.js {{BUILD_DIR}}/ui.elm.js + + +@js: vendor-js + echo "> Compiling Javascript code" + + # ... + cp {{NPM_DIR}}/subworkers/subworkers.js {{BUILD_DIR}}/subworkers.js + + # Main builds + {{NPM_DIR}}/.bin/webpack-cli \ + --entry ./src/Javascript/index.js \ + --mode none \ + --output {{BUILD_DIR}}/ui.js + + {{NPM_DIR}}/.bin/webpack-cli \ + --entry ./src/Javascript/Brain/index.js \ + --mode none \ + --target webworker \ + --output {{BUILD_DIR}}/brain.js + + # Workers + {{NPM_DIR}}/.bin/webpack-cli \ + --entry ./src/Javascript/Workers/search.js \ + --mode none \ + --target webworker \ + --output {{BUILD_DIR}}/search.js + + {{NPM_DIR}}/.bin/webpack-cli \ + --entry ./src/Javascript/Workers/service.js \ + --mode none \ + --target webworker \ + --output {{BUILD_DIR}}/service-worker.js + + +@js-prod: vendor-js + echo "> Compiling Javascript code (optimized)" + + # ... + cp {{NPM_DIR}}/subworkers/subworkers.js {{BUILD_DIR}}/subworkers.js + + # Main builds + {{NPM_DIR}}/.bin/webpack-cli \ + --entry ./src/Javascript/index.js \ + --mode production \ + --output {{BUILD_DIR}}/ui.js + + {{NPM_DIR}}/.bin/webpack-cli \ + --entry ./src/Javascript/Brain/index.js \ + --mode production \ + --target webworker \ + --output {{BUILD_DIR}}/brain.js + + # Workers + {{NPM_DIR}}/.bin/webpack-cli \ + --entry ./src/Javascript/Workers/search.js \ + --mode production \ + --target webworker \ + --output {{BUILD_DIR}}/search.js + + {{NPM_DIR}}/.bin/webpack-cli \ + --entry ./src/Javascript/Workers/service.js \ + --mode production \ + --target webworker \ + --output {{BUILD_DIR}}/service-worker.js + + +@system: + echo "> Compiling system" + stack build && stack exec build + + +@vendor-js: + mkdir -p {{BUILD_DIR}}/vendor + cp {{NPM_DIR}}/remotestoragejs/release/remotestorage.js {{BUILD_DIR}}/vendor/remotestorage.min.js + cp {{NPM_DIR}}/blockstack/blockstack.min.js {{BUILD_DIR}}/vendor/blockstack.min.js + + {{NPM_DIR}}/.bin/terser {{NPM_DIR}}/pep/elm-pep.js \ + --output {{BUILD_DIR}}/vendor/pep.js \ + --compress --mangle + + +# +# Dev tasks +# + +@dev: build + make -j watch-wo-build server + + +@doc-tests: + echo "> Running documentation tests" + ( cd src && \ + find . -name "*.elm" -print0 | \ + xargs -0 -n 1 -I % sh -c 'elm-proofread -- % || exit 255; echo "\n\n"' \ + ) + + +@quality: + echo "> Running es-lint" + {{NPM_DIR}}/.bin/eslint src/Javascript/** + echo "> Running elm-review" + {{NPM_DIR}}/.bin/elm-review src --config system/Review + + +@quality-fix: + echo "> Running elm-review" + {{NPM_DIR}}/.bin/elm-review src --config system/Review --fix + + +@server: + echo "> Booting up web server on port 5000" + devd --port 5000 --all --crossdomain --quiet --notfound=301.html {{BUILD_DIR}} + + +@test: + make -j doc-tests + + +@watch: build + make watch-wo-build + + +@watch-wo-build: + echo "> Watching" + make -j watch-css watch-elm watch-js watch-system + + +@watch-css: + watchexec -p -w {{SRC_DIR}}/Css -w {{SYSTEM_DIR}}/Css -- make css + + +@watch-elm: + watchexec -p -w {{SRC_DIR}} -e elm -- make elm + + +@watch-js: + watchexec -p -w {{SRC_DIR}} -e js -- make js + + +@watch-system: + watchexec -p --ignore *.elm --ignore *.js --ignore *.css -- make system diff --git a/Makefile b/Makefile deleted file mode 100644 index 744a8de6..00000000 --- a/Makefile +++ /dev/null @@ -1,228 +0,0 @@ -.PHONY: build system vendor - - -# Variables - -BUILD_DIR=./build -NPM_DIR=./node_modules -SRC_DIR=./src -SYSTEM_DIR=./system -TEMPORARY_DIR=./tmp - - -# Default task - -all: dev - - -# -# Build tasks -# - -build: clean system css elm js - @echo "> Build completed ⚡" - - -build-prod: clean system css-prod elm-prod js-prod - @echo "> Production build completed 🛳" - - -clean: - @echo "> Cleaning build directory" - @rm -rf $(BUILD_DIR) || true - - -css: - @echo "> Compiling CSS" - @mkdir -p $(BUILD_DIR) - @mkdir -p $(TEMPORARY_DIR) - @$(NPM_DIR)/.bin/postcss \ - "${SRC_DIR}/Css/About.css" \ - --output "${BUILD_DIR}/about.css" \ - --config "${SYSTEM_DIR}/Css/" - @$(NPM_DIR)/.bin/postcss \ - "${SRC_DIR}/Css/Application.css" \ - --output "${BUILD_DIR}/application.css" \ - --config "${SYSTEM_DIR}/Css/" - - -css-prod: css - @echo "> Optimizing CSS" - @$(NPM_DIR)/.bin/purgecss \ - --config $(SYSTEM_DIR)/Css/purgecss.about.js \ - --out $(BUILD_DIR) - @$(NPM_DIR)/.bin/purgecss \ - --config $(SYSTEM_DIR)/Css/purgecss.application.js \ - --out $(BUILD_DIR) - @$(NPM_DIR)/.bin/csso \ - "${BUILD_DIR}/about.css" \ - --output "${BUILD_DIR}/about.css" - @$(NPM_DIR)/.bin/csso \ - "${BUILD_DIR}/application.css" \ - --output "${BUILD_DIR}/application.css" - - -elm: - @echo "> Compiling Elm application" - @elm make $(SRC_DIR)/Applications/Brain.elm --output $(BUILD_DIR)/brain.elm.js - @elm make $(SRC_DIR)/Applications/UI.elm --output $(BUILD_DIR)/ui.elm.js - - -elm-prod: - @echo "> Compiling Elm application (optimized)" - @elm make $(SRC_DIR)/Applications/Brain.elm --output $(BUILD_DIR)/brain.elm.js --optimize - @elm make $(SRC_DIR)/Applications/UI.elm --output $(BUILD_DIR)/ui.elm.js --optimize - - @$(NPM_DIR)/.bin/terser $(BUILD_DIR)/brain.elm.js \ - --output $(BUILD_DIR)/brain.elm.tmp.js \ - --compress --mangle - - @$(NPM_DIR)/.bin/terser $(BUILD_DIR)/ui.elm.js \ - --output $(BUILD_DIR)/ui.elm.tmp.js \ - --compress --mangle - - @rm $(BUILD_DIR)/brain.elm.js - @mv $(BUILD_DIR)/brain.elm.tmp.js $(BUILD_DIR)/brain.elm.js - @rm $(BUILD_DIR)/ui.elm.js - @mv $(BUILD_DIR)/ui.elm.tmp.js $(BUILD_DIR)/ui.elm.js - - -js: vendor-js - @echo "> Compiling Javascript code" - - @# ... - @cp $(NPM_DIR)/subworkers/subworkers.js $(BUILD_DIR)/subworkers.js - - @# Main builds - @$(NPM_DIR)/.bin/webpack-cli \ - --entry ./src/Javascript/index.js \ - --mode none \ - --output $(BUILD_DIR)/ui.js - - @$(NPM_DIR)/.bin/webpack-cli \ - --entry ./src/Javascript/Brain/index.js \ - --mode none \ - --target webworker \ - --output $(BUILD_DIR)/brain.js - - @# Workers - @$(NPM_DIR)/.bin/webpack-cli \ - --entry ./src/Javascript/Workers/search.js \ - --mode none \ - --target webworker \ - --output $(BUILD_DIR)/search.js - - @$(NPM_DIR)/.bin/webpack-cli \ - --entry ./src/Javascript/Workers/service.js \ - --mode none \ - --target webworker \ - --output $(BUILD_DIR)/service-worker.js - - -js-prod: vendor-js - @echo "> Compiling Javascript code (optimized)" - - @# ... - @cp $(NPM_DIR)/subworkers/subworkers.js $(BUILD_DIR)/subworkers.js - - @# Main builds - @$(NPM_DIR)/.bin/webpack-cli \ - --entry ./src/Javascript/index.js \ - --mode production \ - --output $(BUILD_DIR)/ui.js - - @$(NPM_DIR)/.bin/webpack-cli \ - --entry ./src/Javascript/Brain/index.js \ - --mode production \ - --target webworker \ - --output $(BUILD_DIR)/brain.js - - @# Workers - @$(NPM_DIR)/.bin/webpack-cli \ - --entry ./src/Javascript/Workers/search.js \ - --mode production \ - --target webworker \ - --output $(BUILD_DIR)/search.js - - @$(NPM_DIR)/.bin/webpack-cli \ - --entry ./src/Javascript/Workers/service.js \ - --mode production \ - --target webworker \ - --output $(BUILD_DIR)/service-worker.js - - -system: - @echo "> Compiling system" - @stack build && stack exec build - - -vendor-js: - @mkdir -p $(BUILD_DIR)/vendor - @cp $(NPM_DIR)/remotestoragejs/release/remotestorage.js $(BUILD_DIR)/vendor/remotestorage.min.js - @cp $(NPM_DIR)/blockstack/blockstack.min.js $(BUILD_DIR)/vendor/blockstack.min.js - - @$(NPM_DIR)/.bin/terser $(NPM_DIR)/pep/elm-pep.js \ - --output $(BUILD_DIR)/vendor/pep.js \ - --compress --mangle - - -# -# Dev tasks -# - -dev: build - @make -j watch-wo-build server - - -doc-tests: - @echo "> Running documentation tests" - @( cd src && \ - find . -name "*.elm" -print0 | \ - xargs -0 -n 1 -I % sh -c 'elm-proofread -- % || exit 255; echo "\n\n"' \ - ) - - -quality: - @echo "> Running es-lint" - @$(NPM_DIR)/.bin/eslint src/Javascript/** - @echo "> Running elm-review" - @$(NPM_DIR)/.bin/elm-review src --config system/Review - - -quality-fix: - @echo "> Running elm-review" - @$(NPM_DIR)/.bin/elm-review src --config system/Review --fix - - -server: - @echo "> Booting up web server on port 5000" - @devd --port 5000 --all --crossdomain --quiet --notfound=301.html $(BUILD_DIR) - - -test: - @make -j doc-tests - - -watch: build - @make watch-wo-build - - -watch-wo-build: - @echo "> Watching" - @make -j watch-css watch-elm watch-js watch-system - - -watch-css: - @watchexec -p -w $(SRC_DIR)/Css -w $(SYSTEM_DIR)/Css -- make css - - -watch-elm: - @watchexec -p -w $(SRC_DIR) -e elm -- make elm - - -watch-js: - @watchexec -p -w $(SRC_DIR) -e js -- make js - - -watch-system: - @watchexec -p --ignore *.elm --ignore *.js --ignore *.css -- make system diff --git a/README.md b/README.md index 9fee6c08..3b229066 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ All of these, except the last one, can be install using [homebrew](https://brew. - [Elm](https://elm-lang.org/) programming language - [Haskell](https://docs.haskellstack.org/en/stable/README/) programming language - [Node.js](https://nodejs.org/) programming language with the [Yarn](https://yarnpkg.com/) package manager +- [Just](https://github.com/casey/just) command runner (improved `make`) - [Devd](https://github.com/cortesi/devd) web server for development (optional) - [Watchexec](https://github.com/watchexec/watchexec) watching for file changes (optional) - [Elm Proofread](https://github.com/icidasset/elm-proofread) documentation tests (optional) @@ -80,5 +81,5 @@ All of these, except the last one, can be install using [homebrew](https://brew. yarn install # 3. Build, start server & watch for changes -make +just ``` diff --git a/package.json b/package.json index b0cf4853..96bd35b0 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "devDependencies": { "autoprefixer": "^9.7.3", "csso-cli": "^3.0.0", - "elm-review": "^1.0.1", + "elm-review": "^1.0.2", "eslint": "^6.8.0", "postcss": "^7.0.23", "postcss-cli": "^6.1.3", diff --git a/src/Applications/UI/Equalizer/State.elm b/src/Applications/UI/Equalizer/State.elm index 9f3c0bcb..0e3b2837 100644 --- a/src/Applications/UI/Equalizer/State.elm +++ b/src/Applications/UI/Equalizer/State.elm @@ -4,6 +4,7 @@ import Color exposing (Color) import Color.Ext as Color import Coordinates exposing (Coordinates) import Equalizer exposing (..) +import Html.Events.Extra.Pointer as Pointer import Json.Decode as Decode import Management import Material.Icons as Icons diff --git a/yarn.lock b/yarn.lock index b7a82e3f..e8b05760 100644 --- a/yarn.lock +++ b/yarn.lock @@ -529,7 +529,7 @@ binary@^0.3.0: buffers "~0.1.1" chainsaw "~0.1.0" -binwrap@^0.2.0: +binwrap@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/binwrap/-/binwrap-0.2.2.tgz#7d1ea74b28332f18dfdc75548aef993041ffafc9" integrity sha512-Y+Wvypk3JhH5GPZAvlwJAWOVH/OsOhQMSj37vySuWHwQivoALplPxfBA8b973rFJI7OS+O+1YmmYXIiEXVMAcw== @@ -1338,21 +1338,21 @@ elliptic@^6.0.0: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.0" -elm-json@^0.2.1: - version "0.2.2" - resolved "https://registry.yarnpkg.com/elm-json/-/elm-json-0.2.2.tgz#fc8d2331c506a261ad56172ee3db23f879ddb41a" - integrity sha512-5xAEWQfw0jsWUYC7Xz2fN1VN8raLu14s2qo51IGpL/dnMW8N9vnOUy9cGoxfQDQshBmgT9GJvpATzFZNwHYzmA== +elm-json@^0.2.6: + version "0.2.6" + resolved "https://registry.yarnpkg.com/elm-json/-/elm-json-0.2.6.tgz#d73305fe1ed1e833508d1a614b083360aab089ac" + integrity sha512-ExZYy9bml4EnHr0fRU/Wt907o7MqHsHWQj7e6j3vqRTK0Uod3bXFCR79N9MQkHm9ko8tY6nkjRQJ87O0X7ZE/Q== dependencies: - binwrap "^0.2.0" + binwrap "^0.2.2" -elm-review@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/elm-review/-/elm-review-1.0.1.tgz#9769baf54fc4f735b34f7d6b3d6e7b65b07a17bb" - integrity sha512-TqXgbwTm/CpN+ZzjnvJyenl5U0+rzHoEeUnfW05IOx2ajgeeu2ibOXAZQLmRl6fDiVG0gIHRRsmBreQjoVq/0Q== +elm-review@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/elm-review/-/elm-review-1.0.2.tgz#48c297a55b93fcc54ca3ee62e0aca5089172bdd2" + integrity sha512-DkDRJUchPsopoUduZAeHFZb3aHToPCPXcpu51QiCYCWMB8YqH9njk79PH/kR26i1yC2kQ4p3PMsDwuSVhDRG/A== dependencies: chalk "^2.4.2" cross-spawn "^6.0.5" - elm-json "^0.2.1" + elm-json "^0.2.6" find-up "^4.1.0" fs-extra "^7.0.1" glob "^7.1.4" -- knotmirror 0.0.1