From 8caeaefa98a6905269a90aa7a61de18e34462696 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 19 Sep 2023 12:16:37 +0200 Subject: [PATCH] :sparkles: Adapt frontend build process to the scss modules --- frontend/gulpfile.js | 26 ++++++++++---------------- frontend/package.json | 8 ++++++-- frontend/scripts/build | 10 ++++++---- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/frontend/gulpfile.js b/frontend/gulpfile.js index 8d98eef5e..de4423bca 100644 --- a/frontend/gulpfile.js +++ b/frontend/gulpfile.js @@ -261,14 +261,6 @@ gulp.task("polyfills", function() { .pipe(gulp.dest(paths.output + "js/")); }); -/*********************************************** - * Development - ***********************************************/ - -gulp.task("clean", function(next) { - rimraf(paths.output).finally(next) -}); - gulp.task("copy:assets:images", function() { return gulp.src(paths.resources + "images/**/*") .pipe(gulp.dest(paths.output + "images/")); @@ -297,18 +289,20 @@ gulp.task("watch:main", function() { gulp.series("templates")); }); -gulp.task("build", gulp.parallel("polyfills", "scss", "templates", "copy:assets")); -gulp.task("watch", gulp.series("dev:dirs", "build", "watch:main")); +gulp.task("clean:output", function(next) { + rimraf(paths.output).finally(next) +}); -/*********************************************** - * Production - ***********************************************/ - -gulp.task("dist:clean", function(next) { +gulp.task("clean:dist", function(next) { rimraf(paths.dist).finally(next); }); -gulp.task("dist:copy", function() { +gulp.task("build:styles", gulp.parallel("scss")); +gulp.task("build:assets", gulp.parallel("polyfills", "templates", "copy:assets")); + +gulp.task("watch", gulp.series("dev:dirs", "build:styles", "build:assets", "watch:main")); + +gulp.task("build:copy", function() { return gulp.src(paths.output + "**/*") .pipe(gulp.dest(paths.dist)); }); diff --git a/frontend/package.json b/frontend/package.json index a9e3a1f2d..49499c8df 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -18,12 +18,16 @@ "test:run": "node target/tests.js", "test:watch": "clojure -M:dev:shadow-cljs watch test", "test": "yarn run test:compile && yarn run test:run", + "test:e2e": "cypress run", + "test:e2e-gui": "cypress open", "gulp:watch": "gulp watch", "watch": "shadow-cljs watch main", "validate-translations": "node ./scripts/validate-translations.js", "find-unused-translations": "node ./scripts/find-unused-translations.js", - "test:e2e": "cypress run", - "test:e2e-gui": "cypress open" + "build:clean": "gulp clean:output && gulp clean:dist", + "build:styles": "gulp build:styles", + "build:assets": "gulp build:assets", + "build:copy": "gulp build:copy" }, "devDependencies": { "autoprefixer": "^10.4.15", diff --git a/frontend/scripts/build b/frontend/scripts/build index 434a261e8..21e972c0b 100755 --- a/frontend/scripts/build +++ b/frontend/scripts/build @@ -8,11 +8,13 @@ CURRENT_HASH=${CURRENT_HASH:-$(git rev-parse --short HEAD)}; EXTRA_PARAMS=$SHADOWCLJS_EXTRA_PARAMS; yarn install || exit 1; -npx gulp clean || exit 1; +yarn run build:clean || exit 1; +yarn run build:styles || exit 1; + clojure -J-Xms100M -J-Xmx800M -J-XX:+UseSerialGC -M:dev:shadow-cljs release main --config-merge "{:release-version \"${CURRENT_HASH}\"}" $EXTRA_PARAMS || exit 1 -npx gulp build || exit 1; -npx gulp dist:clean || exit 1; -npx gulp dist:copy || exit 1; + +yarn run build:assets || exit 1; +yarn run build:copy || exit 1; sed -i -re "s/\%version\%/$CURRENT_VERSION/g" ./target/dist/index.html; sed -i -re "s/\%buildDate\%/$BUILD_DATE/g" ./target/dist/index.html;