From bfb7136060da086600cd3dd25101ee81a4b251da Mon Sep 17 00:00:00 2001 From: Roly Perera Date: Mon, 21 Oct 2024 08:56:12 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=A9=20[consolidate]:=20Separate=20buil?= =?UTF-8?q?d=20and=20bundle=20steps.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 7 ++++--- package.json | 2 +- script/build-article.sh | 15 --------------- script/build.sh | 6 ------ ...d-ESOP-artifact.sh => bundle-ESOP-artifact.sh} | 4 ++-- script/bundle-article.sh | 12 ++++++++++++ ...standalone-all.sh => bundle-standalone-all.sh} | 2 +- .../{build-standalone.sh => bundle-standalone.sh} | 4 +--- script/{build-website.sh => bundle-website.sh} | 2 +- script/bundle.sh | 4 +++- script/util/bundle.sh | 3 +++ 11 files changed, 28 insertions(+), 33 deletions(-) delete mode 100755 script/build-article.sh delete mode 100755 script/build.sh rename script/{build-ESOP-artifact.sh => bundle-ESOP-artifact.sh} (65%) create mode 100755 script/bundle-article.sh rename script/{build-standalone-all.sh => bundle-standalone-all.sh} (78%) rename script/{build-standalone.sh => bundle-standalone.sh} (76%) rename script/{build-website.sh => bundle-website.sh} (84%) create mode 100755 script/util/bundle.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f3d414acb..52f1693ff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,8 @@ jobs: yarn install set -x -e yarn purs-tidy check src/**/*.purs test/**/*.purs - yarn build-website - yarn build - yarn build-standalone-all + ./script/compile.sh + ./script/bundle-website.sh + ./script/bundle.sh test Test.Test + ./script/bundle-standalone-all.sh yarn test-all diff --git a/package.json b/package.json index a61ada332..0d31f9d47 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "scripts": { "tidy": "./script/tidy.sh", "build-website": "./script/build-website.sh", - "build": "./script/build.sh test Test.Test", + "build-test": "./script/build.sh test Test.Test", "build-article": "./script/build-article.sh", "build-bench": "./script/build.sh bench Test.Benchmark", "build-ESOP-artifact": "./script/build-ESOP-artifact.sh", diff --git a/script/build-article.sh b/script/build-article.sh deleted file mode 100755 index 0f4b0dca8..000000000 --- a/script/build-article.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash -# run from project root -set -xe - -# TODO: some consolidation with build-standalone.sh - -rm -rf dist/article -mkdir -p dist/article - -cp -r fluid dist/article -cp -r web/css dist/article -cp web/template.html dist/article/index.html - -yarn spago build --purs-args '--strict --censor-codes=UserDefinedWarning' -yarn purs-backend-es bundle-app --main Standalone.Article --to dist/article/fluid.js diff --git a/script/build.sh b/script/build.sh deleted file mode 100755 index e34b23223..000000000 --- a/script/build.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -set -xe - -# . script/compile.sh -. script/clean.sh $1 -. script/bundle.sh ${@:1} diff --git a/script/build-ESOP-artifact.sh b/script/bundle-ESOP-artifact.sh similarity index 65% rename from script/build-ESOP-artifact.sh rename to script/bundle-ESOP-artifact.sh index 9a9723b33..37a05f98c 100755 --- a/script/build-ESOP-artifact.sh +++ b/script/bundle-ESOP-artifact.sh @@ -6,7 +6,7 @@ mkdir -p dist cp -r fluid dist cp -r web/css dist -./script/build-standalone.sh EsopFig2 -./script/build-standalone.sh EsopFig4 +./script/bundle-standalone.sh EsopFig2 +./script/bundle-standalone.sh EsopFig4 cp -r web/ESOP-artifact.html dist/index.html diff --git a/script/bundle-article.sh b/script/bundle-article.sh new file mode 100755 index 000000000..e7a595a14 --- /dev/null +++ b/script/bundle-article.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# run from project root +set -xe + +rm -rf dist/article +mkdir -p dist/article + +cp -r fluid dist/article +cp -r web/css dist/article +cp web/template.html dist/article/index.html + +./script/util/bundle.sh article Standalone.Article diff --git a/script/build-standalone-all.sh b/script/bundle-standalone-all.sh similarity index 78% rename from script/build-standalone-all.sh rename to script/bundle-standalone-all.sh index 4e351e803..e1e0273da 100755 --- a/script/build-standalone-all.sh +++ b/script/bundle-standalone-all.sh @@ -5,5 +5,5 @@ set -e for FILE in src/Standalone/*.purs; do NAME=$(basename $FILE .purs) - . script/build-standalone.sh $NAME + . script/bundle-standalone.sh $NAME done diff --git a/script/build-standalone.sh b/script/bundle-standalone.sh similarity index 76% rename from script/build-standalone.sh rename to script/bundle-standalone.sh index 4d4266472..e11cb4f11 100755 --- a/script/build-standalone.sh +++ b/script/bundle-standalone.sh @@ -10,7 +10,6 @@ if [[ ! -e "src/Standalone/$NAME.purs" ]]; then exit 1 fi -# Could factor this through build.sh but currently these are shared by all standalone figures cp -r fluid dist cp -r web/css dist @@ -20,8 +19,7 @@ echo "$1 -> $NAME_LISP_CASE" rm -rf dist/$NAME_LISP_CASE mkdir -p dist/$NAME_LISP_CASE -# ./script/compile.sh -./script/bundle.sh $NAME_LISP_CASE Standalone.$NAME +./script/util/bundle.sh $NAME_LISP_CASE Standalone.$NAME if [[ -e "src/Standalone/$NAME.html" ]]; then cp src/Standalone/$NAME.html dist/$NAME_LISP_CASE/index.html diff --git a/script/build-website.sh b/script/bundle-website.sh similarity index 84% rename from script/build-website.sh rename to script/bundle-website.sh index 31dfff3d1..7788d246c 100755 --- a/script/build-website.sh +++ b/script/bundle-website.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -xe -./script/build.sh / Standalone.Website +./script/bundle.sh / Standalone.Website # TODO: run build-standalone.sh for each separate page that features on the website diff --git a/script/bundle.sh b/script/bundle.sh index f978b954b..9a0a0ac76 100755 --- a/script/bundle.sh +++ b/script/bundle.sh @@ -1,3 +1,5 @@ #!/usr/bin/env bash set -xe -yarn purs-backend-es bundle-app --main $2 --to dist/$1/fluid.js ${@:3} + +. script/clean.sh $1 +. script/util/bundle.sh ${@:1} diff --git a/script/util/bundle.sh b/script/util/bundle.sh new file mode 100755 index 000000000..f978b954b --- /dev/null +++ b/script/util/bundle.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -xe +yarn purs-backend-es bundle-app --main $2 --to dist/$1/fluid.js ${@:3}