0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 06:02:32 -05:00

🚧 Improve build scripts.

This commit is contained in:
Andrey Antukh 2019-12-09 16:29:26 +01:00
parent b5c8afe69f
commit 94fe18b4ae
12 changed files with 649 additions and 449 deletions

2
backend/bin/kaocha Executable file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env bash
clojure -A:dev:test -m kaocha.runner "$@"

14
backend/bin/start Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
set -e
if [ ! -e ~/local/.fixtures-loaded ]; then
echo "Loading fixtures..."
clojure -Adev -m uxbox.fixtures
touch ~/local/.fixtures-loaded
fi
clojure -J-XX:-OmitStackTraceInFastThrow -m uxbox.main

View file

@ -1,64 +1,74 @@
{:deps {org.clojure/clojure {:mvn/version "1.10.1"}
funcool/promesa {:mvn/version "5.0.0-SNAPSHOT"}
funcool/cuerdas {:mvn/version "2.2.1"}
{:deps
{org.clojure/clojure {:mvn/version "1.10.1"}
funcool/promesa {:mvn/version "5.0.0-SNAPSHOT"}
funcool/cuerdas {:mvn/version "2.2.1"}
;; Logging
org.clojure/tools.logging {:mvn/version "0.5.0"}
org.apache.logging.log4j/log4j-api {:mvn/version "2.12.1"}
org.apache.logging.log4j/log4j-core {:mvn/version "2.12.1"}
org.apache.logging.log4j/log4j-jul {:mvn/version "2.12.1"}
funcool/datoteka {:mvn/version "1.1.0"}
expound/expound {:mvn/version "0.7.2"}
instaparse/instaparse {:mvn/version "1.4.10"}
com.cognitect/transit-clj {:mvn/version "0.8.319"}
;; Logging
org.clojure/tools.logging {:mvn/version "0.5.0"}
org.apache.logging.log4j/log4j-api {:mvn/version "2.12.1"}
org.apache.logging.log4j/log4j-core {:mvn/version "2.12.1"}
org.apache.logging.log4j/log4j-jul {:mvn/version "2.12.1"}
funcool/datoteka {:mvn/version "1.1.0"}
expound/expound {:mvn/version "0.7.2"}
instaparse/instaparse {:mvn/version "1.4.10"}
com.cognitect/transit-clj {:mvn/version "0.8.319"}
;; vertx deps
;; vertx-clojure/vertx {:mvn/version "0.0.0-SNAPSHOT"}
metosin/reitit-core {:mvn/version "0.3.10"}
metosin/sieppari {:mvn/version "0.0.0-alpha8"}
io.vertx/vertx-core {:mvn/version "3.8.4"}
io.vertx/vertx-web {:mvn/version "3.8.4"}
io.vertx/vertx-web-client {:mvn/version "3.8.4"}
io.vertx/vertx-pg-client {:mvn/version "3.8.4"}
;; end verx deps
;; vertx deps
;; vertx-clojure/vertx {:mvn/version "0.0.0-SNAPSHOT"}
metosin/reitit-core {:mvn/version "0.3.10"}
metosin/sieppari {:mvn/version "0.0.0-alpha8"}
io.vertx/vertx-core {:mvn/version "3.8.4"}
io.vertx/vertx-web {:mvn/version "3.8.4"}
io.vertx/vertx-web-client {:mvn/version "3.8.4"}
io.vertx/vertx-pg-client {:mvn/version "3.8.4"}
;; end verx deps
lambdaisland/uri {:mvn/version "1.1.0"}
lambdaisland/uri {:mvn/version "1.1.0"}
danlentz/clj-uuid {:mvn/version "0.1.9"}
org.jsoup/jsoup {:mvn/version "1.12.1"}
hiccup/hiccup {:mvn/version "1.0.5"}
org.im4java/im4java {:mvn/version "1.4.0"}
danlentz/clj-uuid {:mvn/version "0.1.9"}
org.jsoup/jsoup {:mvn/version "1.12.1"}
hiccup/hiccup {:mvn/version "1.0.5"}
org.im4java/im4java {:mvn/version "1.4.0"}
buddy/buddy-sign {:mvn/version "3.1.0"}
buddy/buddy-hashers {:mvn/version "1.4.0"}
buddy/buddy-sign {:mvn/version "3.1.0"}
buddy/buddy-hashers {:mvn/version "1.4.0"}
org.xerial.snappy/snappy-java {:mvn/version "1.1.7.3"}
com.github.spullara.mustache.java/compiler {:mvn/version "0.9.6"}
commons-io/commons-io {:mvn/version "2.6"}
com.draines/postal {:mvn/version "2.0.3"
:exclusions [commons-codec/commons-codec]}
org.xerial.snappy/snappy-java {:mvn/version "1.1.7.3"}
com.github.spullara.mustache.java/compiler {:mvn/version "0.9.6"}
commons-io/commons-io {:mvn/version "2.6"}
com.draines/postal {:mvn/version "2.0.3"
:exclusions [commons-codec/commons-codec]}
;; exception printing
io.aviso/pretty {:mvn/version "0.1.37"}
;; exception printing
io.aviso/pretty {:mvn/version "0.1.37"}
mount/mount {:mvn/version "0.1.16"}
environ/environ {:mvn/version "1.1.0"}
}
mount/mount {:mvn/version "0.1.16"}
environ/environ {:mvn/version "1.1.0"}}
:paths ["src" "vendor" "resources"]
:aliases
{:dev
{:extra-deps {com.bhauman/rebel-readline {:mvn/version "0.1.4"}
org.clojure/tools.namespace {:mvn/version "0.3.1"}
fipp/fipp {:mvn/version "0.6.21"}
criterium/criterium {:mvn/version "0.4.5"}
mockery/mockery {:mvn/version "0.1.4"}
}
{:extra-deps
{com.bhauman/rebel-readline {:mvn/version "0.1.4"}
org.clojure/tools.namespace {:mvn/version "0.3.1"}
fipp/fipp {:mvn/version "0.6.21"}
criterium/criterium {:mvn/version "0.4.5"}
mockery/mockery {:mvn/version "0.1.4"}}
:extra-paths ["test"]}
:repl {:main-opts ["-m" "rebel-readline.main"]}
:nrepl {:extra-deps {nrepl/nrepl {:mvn/version "0.6.0"}}
:main-opts ["-m" "nrepl.cmdline"]}
:ancient {:main-opts ["-m" "deps-ancient.deps-ancient"]
:extra-deps {deps-ancient {:mvn/version "RELEASE"}}}
:repl
{:main-opts ["-m" "rebel-readline.main"]}
:test
{:extra-deps {lambdaisland/kaocha {:mvn/version "0.0-554"}}}
:nrepl
{:extra-deps {nrepl/nrepl {:mvn/version "0.6.0"}}
:main-opts ["-m" "nrepl.cmdline"]}
:ancient
{:main-opts ["-m" "deps-ancient.deps-ancient"]
:extra-deps {deps-ancient {:mvn/version "RELEASE"}}}
}}

5
backend/tests.edn Normal file
View file

@ -0,0 +1,5 @@
#kaocha/v1
{:tests
[{:id :unit
:test-paths ["test" "src"]
:ns-patterns ["test-.*"]}]}

View file

@ -49,6 +49,7 @@ services:
postgres:
image: postgres:12
# command: postgres -c config_file=/etc/postgresql.conf
hostname: 'uxbox-devenv-postgres'
container_name: 'uxbox-devenv-postgres'
restart: always
@ -61,4 +62,5 @@ services:
- POSTGRES_USER=uxbox
- POSTGRES_PASSWORD=uxbox
volumes:
# - ./files/postgresql.conf:/etc/postgresql.conf
- postgres_data:/var/lib/postgresql/data

File diff suppressed because it is too large Load diff

View file

@ -10,8 +10,7 @@ tmux send-keys -t uxbox 'clojure -Adev tools.clj figwheel' enter
tmux new-window -t uxbox:2 -n 'backend'
tmux select-window -t uxbox:2
tmux send-keys -t uxbox 'cd uxbox/backend' enter C-l
# tmux send-keys -t uxbox 'clojure -Adev -m uxbox.fixtures' enter C-l
tmux send-keys -t uxbox 'clojure -Adev:repl' enter
tmux send-keys -t uxbox './bin/start' enter
tmux rename-window -t uxbox:0 'gulp'
tmux select-window -t uxbox:0

View file

@ -14,7 +14,7 @@ networks:
services:
postgres:
image: postgres:11
image: postgres:12
restart: always
stop_signal: SIGINT
ports:
@ -26,46 +26,51 @@ services:
- POSTGRES_PASSWORD=uxbox_postgres_password
volumes:
- postgres_data:/var/lib/postgresql/data
# - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro
backend:
image: uxbox-backend:latest
restart: always
depends_on:
- postgres
- smtp
ports:
- 6060
volumes:
- backend_data:/srv/uxbox/data
- backend_m2:/root/.m2
# - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro
environment:
# HTTP setup
- UXBOX_HTTP_SERVER_DEBUG=false
- UXBOX_HTTP_SERVER_CORS=*
# Media & Assets
- UXBOX_MEDIA_URI="/media/"
- UXBOX_ASSETS_URI="/static/"
- UXBOX_MEDIA_DIRECTORY="data/media"
- UXBOX_ASSETS_DIRECTORY="data/static"
# Database setup
- UXBOX_DATABASE_URI="jdbc:postgresql://postgres/uxbox"
# Database setup (using the `postgres` container)
- UXBOX_DATABASE_URI="postgresql://postgres/uxbox"
- UXBOX_DATABASE_USERNAME="uxbox"
- UXBOX_DATABASE_PASSWORD="uxbox_postgres_password"
# Mail setup
- UXBOX_EMAIL_REPLY_TO="no-reply@uxbox.io"
- UXBOX_EMAIL_FROM="no-reply@uxbox.io"
# STMP setup
- UXBOX_SMTP_HOST="localhost"
# STMP setup (using the `smtp` container)
- UXBOX_SMTP_HOST="smtp"
- UXBOX_SMTP_PORT=25
- UXBOX_SMTP_USER="uxbox"
- UXBOX_SMTP_PASSWORD="youshouldoverwritethiswithsomethingelse"
# - UXBOX_SMTP_PASSWORD=""
- UXBOX_SMTP_SSL=false
- UXBOX_SMTP_TLS=false
- UXBOX_SMTP_ENABLED=false
# Security setup
- UXBOX_SECRET="foobar"
## Security setup
# Overwrite with a randomy generated string. Mainly used as
# shared key for sign cookies, tokens, etc.
- UXBOX_SECRET="the very secret string"
frontend:
image: uxbox-frontend:latest
@ -76,8 +81,6 @@ services:
- 8080:8080
volumes:
- backend_data:/srv/uxbox/
# - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro
frontend-dev:
image: uxbox-frontend-dbg:latest
@ -88,6 +91,12 @@ services:
- 8081:8080
volumes:
- backend_data:/srv/uxbox/
# - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro
smtp:
image: mwader/postfix-relay
restart: always
environment:
- POSTFIX_myhostname=smtp.uxbox.io
- OPENDKIM_DOMAINS=smtp.uxbox.io

View file

@ -1,30 +1,39 @@
{:deps {org.clojure/clojurescript {:mvn/version "1.10.520"}
org.clojure/clojure {:mvn/version "1.10.1"}
com.cognitect/transit-cljs {:mvn/version "0.8.256"}
{:deps
{org.clojure/clojurescript {:mvn/version "1.10.597"}
org.clojure/clojure {:mvn/version "1.10.1"}
com.cognitect/transit-cljs {:mvn/version "0.8.256"}
cljsjs/react-dom-server {:mvn/version "16.9.0-0"}
cljsjs/react {:mvn/version "16.11.0-0"}
cljsjs/react-dom {:mvn/version "16.11.0-0"}
cljsjs/react-dom-server {:mvn/version "16.11.0-0"}
environ/environ {:mvn/version "1.1.0"}
metosin/reitit-core {:mvn/version "0.3.10"}
expound/expound {:mvn/version "0.7.2"}
environ/environ {:mvn/version "1.1.0"}
metosin/reitit-core {:mvn/version "0.3.10"}
expound/expound {:mvn/version "0.7.2"}
funcool/beicon {:mvn/version "5.1.0"}
funcool/cuerdas {:mvn/version "2.2.0"}
funcool/lentes {:mvn/version "1.3.3"}
funcool/potok {:mvn/version "2.7.0"}
funcool/promesa {:mvn/version "4.0.2"}
funcool/rumext {:mvn/version "2.0.0-SNAPSHOT"}
}
funcool/beicon {:mvn/version "5.1.0"}
funcool/cuerdas {:mvn/version "2.2.0"}
funcool/lentes {:mvn/version "1.3.3"}
funcool/potok {:mvn/version "2.7.0"}
funcool/promesa {:mvn/version "4.0.2"}
funcool/rumext {:mvn/version "2.0.0-SNAPSHOT"}
}
:paths ["src" "vendor" "resources"]
:aliases
{:dev {:extra-deps {com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
com.bhauman/rebel-readline {:mvn/version "0.1.4"}
com.bhauman/figwheel-main {:mvn/version "0.2.3"}
org.clojure/tools.namespace {:mvn/version "0.3.1"}}
:extra-paths ["test"]}
{:dev
{:extra-deps
{com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
com.bhauman/rebel-readline {:mvn/version "0.1.4"}
com.bhauman/figwheel-main {:mvn/version "0.2.3"}
org.clojure/tools.namespace {:mvn/version "0.3.1"}}
:extra-paths ["test"]}
:repl
{:main-opts ["-m" "rebel-readline.main"]}
:ancient
{:main-opts ["-m" "deps-ancient.deps-ancient"]
:extra-deps {deps-ancient {:mvn/version "RELEASE"}}}
:repl {:main-opts ["-m" "rebel-readline.main"]}
:ancient {:main-opts ["-m" "deps-ancient.deps-ancient"]
:extra-deps {deps-ancient {:mvn/version "RELEASE"}}}
}}

View file

@ -149,7 +149,7 @@
[:ul.library-elements
(when own?
[:li
[:a.btn-primary {:on-click #(st/emit! (di/create-collection))}
[:a.btn-primary {:on-click #(st/emit! di/create-collection)}
(tr "ds.icons-collection.new")]])
(when own?
[:& nav-item {:selected? (nil? id)}])

View file

@ -49,14 +49,11 @@
(def main-build-options
{:output-dir "resources/public/js"
:asset-path "/js"
:modules {:common {:entries #{}
:output-to "resources/public/js/common.js"}
:main {:entries #{"uxbox.main"}
:output-to "resources/public/js/main.js"
:depends-on #{:common}}
:modules {:main {:entries #{"uxbox.main"}
:output-to "resources/public/js/main.js"}
:view {:entries #{"uxbox.view"}
:output-to "resources/public/js/view.js"
:depends-on #{:common}}}})
}}})
(def worker-build-options
{:main 'uxbox.worker
@ -70,7 +67,6 @@
main-build-options
dist-build-options)
(assoc :output-dir "dist/js")
(assoc-in [:modules :common :output-to] "dist/js/common.js")
(assoc-in [:modules :main :output-to] "dist/js/main.js")
(assoc-in [:modules :view :output-to] "dist/js/view.js")))
@ -99,7 +95,7 @@
(defmethod task "dist:main"
[args]
(let [cfg main-dist-build-options]
;; (pprint cfg)
(pprint cfg)
(api/build (api/inputs "src") cfg)))
(defmethod task "dist:worker"

View file

@ -92,19 +92,29 @@ function build-frontend-local {
}
function build-frontend-image {
echo "#############################################"
echo "## START build 'uxbox-frontend' image. ##"
echo "#############################################"
build-frontend-local "dist" || exit 1;
rm -rf docker/frontend/dist || exit 1;
cp -vr frontend/dist docker/frontend/ || exit 1;
# rm -rf docker/frontend/dist || exit 1;
# cp -vr frontend/dist docker/frontend/ || exit 1;
docker build --rm=true \
-t uxbox-frontend:$REV \
-t uxbox-frontend:latest \
docker/frontend/;
# docker build --rm=true \
# -t uxbox-frontend:$REV \
# -t uxbox-frontend:latest \
# docker/frontend/;
rm -rf docker/frontend/dist || exit 1;
# rm -rf docker/frontend/dist || exit 1;
echo "#############################################"
echo "## END build 'uxbox-frontend' image. ##"
echo "#############################################"
}
function build-frontend-dbg-image {
echo "#############################################"
echo "## START build 'uxbox-frontend-dbg' image. ##"
echo "#############################################"
build-frontend-local "dbg-dist" || exit 1;
rm -rf docker/frontend/dist || exit 1;
cp -vr frontend/dist docker/frontend/ || exit 1;
@ -115,6 +125,11 @@ function build-frontend-dbg-image {
docker/frontend/;
rm -rf docker/frontend/dist || exit 1;
echo "#############################################"
echo "## END build 'uxbox-frontend-dbg' image. ##"
echo "#############################################"
}
function build-backend-local {
@ -132,6 +147,10 @@ function build-backend-local {
}
function build-backend-image {
echo "#############################################"
echo "## START build 'uxbox-backend' image. ##"
echo "#############################################"
build-backend-local || exit 1;
rm -rf docker/backend/dist || exit 1;
cp -vr backend/dist docker/backend/ || exit 1;
@ -142,6 +161,11 @@ function build-backend-image {
docker/backend/;
rm -rf docker/backend/dist || exit 1;
echo "#############################################"
echo "## END build 'uxbox-backend' image. ##"
echo "#############################################"
}
function build-images {
@ -176,6 +200,10 @@ function log {
docker-compose -p uxbox -f docker/docker-compose.yml logs -f --tail=50
}
function log-devenv {
docker-compose -p uxbox-devenv -f docker/devenv/docker-compose.yaml logs -f --tail=50
}
function stop {
echo "Stoping containers..."
docker-compose -p uxbox -f ./docker/docker-compose.yml stop
@ -225,6 +253,9 @@ case $1 in
stop-devenv)
stop-devenv ${@:2}
;;
log-devenv)
log-devenv ${@:2}
;;
## testin related commands