0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-28 15:41:25 -05:00

refactor: replace lein with cli tools and update some deps

- also removes docker files from source directories
- minor assets reorganization on back (make it more production ready)
This commit is contained in:
Andrey Antukh 2019-06-03 16:51:20 +02:00
parent 8a5c1498e9
commit 3b648f5aa5
86 changed files with 6831 additions and 1143 deletions

View file

@ -1,80 +0,0 @@
FROM monogramm/docker-uxbox-builder:latest
ENV LEIN_ROOT=TRUE
# Copy backend source and build release
COPY . /home/uxbox/backend
RUN set -ex; \
cd backend; \
rm -f Dockerfile; \
bash -c "/home/uxbox/backend/scripts/dist.sh"
# Once application has been built, prepare production image
FROM openjdk:8-jre
LABEL maintainer="Monogramm Maintainers <opensource at monogramm dot io>"
# Add uxbox as provided by builder
COPY --from=0 /home/uxbox/backend/dist/uxbox-backend.jar /srv/uxbox/app.jar
COPY --from=0 /home/uxbox/backend/docker-entrypoint.sh /entrypoint.sh
ENV LANG=en_US.UTF-8 \
LC_ALL=C.UTF-8 \
UXBOX_HTTP_SERVER_DEBUG=false \
UXBOX_MEDIA_URI="http://localhost:6060/media/" \
UXBOX_MEDIA_DIRECTORY="resources/public/media" \
UXBOX_ASSETS_URI="http://localhost:6060/static/" \
UXBOX_ASSETS_DIRECTORY="resources/public/static" \
UXBOX_DATABASE_USERNAME="uxbox" \
UXBOX_DATABASE_PASSWORD="youshouldoverwritethiswithsomethingelse" \
UXBOX_DATABASE_NAME="uxbox" \
UXBOX_DATABASE_SERVER="localhost" \
UXBOX_DATABASE_PORT=5432 \
UXBOX_EMAIL_REPLY_TO="no-reply@uxbox.io" \
UXBOX_EMAIL_FROM="no-reply@uxbox.io" \
UXBOX_SMTP_HOST="localhost" \
UXBOX_SMTP_PORT=25 \
UXBOX_SMTP_USER="uxbox" \
UXBOX_SMTP_PASSWORD="youshouldoverwritethiswithsomethingelse" \
UXBOX_SMTP_SSL=false \
UXBOX_SMTP_TLS=false \
UXBOX_SMTP_ENABLED=false \
UXBOX_SECRET=""
RUN set -ex; \
chmod 755 /entrypoint.sh; \
mkdir -p /srv/uxbox/resources/public/media; \
mkdir -p /srv/uxbox/resources/public/static; \
apt-get update -yq && \
apt-get install -yq \
git \
imagemagick \
webp \
; \
apt-get update -yq; \
apt-get install -yq \
libbz2-dev liblzma-dev zlib1g-dev libfftw3-dev \
libfreetype6-dev libfontconfig1-dev libxt-dev \
libexif-dev libjpeg-dev libpng-dev libtiff-dev \
libwmf-dev libpango1.0-dev librsvg2-bin librsvg2-dev \
libxml2-dev libwebp-dev webp \
; \
git clone https://github.com/ImageMagick/ImageMagick.git imagemagick && \
cd imagemagick && \
git checkout -f 7.0.8-27 && \
./configure --prefix=/opt/img && \
make -j2 && \
make install && \
cd .. && \
rm -rf ./imagemagick
VOLUME /srv/uxbox/resources/public
WORKDIR /srv/uxbox/
EXPOSE 6060
ENTRYPOINT ["sh", "/entrypoint.sh"]
CMD ["java", "-jar", "app.jar"]

40
backend/deps.edn Normal file
View file

@ -0,0 +1,40 @@
{:deps {org.clojure/clojure {:mvn/version "1.10.0"}
org.clojure/tools.logging {:mvn/version "0.3.1"}
org.clojure/data.xml {:mvn/version "0.1.0-beta2"}
funcool/suricatta {:mvn/version "1.3.1"}
funcool/promesa {:mvn/version "2.0.0"}
funcool/catacumba {:mvn/version "2.1.0"}
funcool/cuerdas {:mvn/version "2.2.0"}
funcool/datoteka {:mvn/version "1.0.0"}
org.jsoup/jsoup {:mvn/version "1.10.2"}
hiccup/hiccup {:mvn/version "1.0.5"}
org.im4java/im4java {:mvn/version "1.4.0"}
org.slf4j/slf4j-simple {:mvn/version "1.7.24"}
com.layerware/hugsql-core {:mvn/version "0.4.7"
:exclusions [org.clojure/tools.reader]}
niwinz/migrante {:mvn/version "0.1.0"}
buddy/buddy-sign {:mvn/version "2.2.0"}
buddy/buddy-hashers {:mvn/version "1.3.0"}
org.xerial.snappy/snappy-java {:mvn/version "1.1.2.6"}
com.github.spullara.mustache.java/compiler {:mvn/version "0.9.4"}
org.postgresql/postgresql {:mvn/version "42.0.0"}
org.quartz-scheduler/quartz {:mvn/version "2.2.3"}
org.quartz-scheduler/quartz-jobs {:mvn/version "2.2.3"}
commons-io/commons-io {:mvn/version "2.5"}
com.draines/postal {:mvn/version "2.0.2"
:exclusions [commons-codec/commons-codec]}
hikari-cp/hikari-cp {:mvn/version "1.7.5"}
mount/mount {:mvn/version "0.1.11"}
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.2.11"}
}
:extra-paths ["test"]}
}}

View file

@ -1,7 +0,0 @@
#!/usr/bin/env bash
set -e
echo "UXBOX backend Docker entrypoint initialization..."
echo 'Running UXBOX backend'
exec "$@"

View file

@ -1,13 +0,0 @@
{:dev
{:plugins [[lein-ancient "0.6.10"]]
:dependencies [[clj-http "2.1.0"]]
:jvm-opts ["-Xms50m" "-Xmx200m" "-XX:+UseG1GC"]
:main ^:skip-aot uxbox.main}
:uberjar
{:jar-exclusions [#"\.swp|\.swo|user\.clj" #"^media"]
:jar-name "uxbox.jar"
:uberjar-name "uxbox-backend.jar"
:main uxbox.main
:aot :all
:target-path "dist/"}}

View file

@ -1,44 +0,0 @@
(defproject uxbox-backend "0.1.0-SNAPSHOT"
:description "UXBox backend."
:url "http://uxbox.github.io"
:license {:name "MPL 2.0" :url "https://www.mozilla.org/en-US/MPL/2.0/"}
:source-paths ["src" "vendor"]
:javac-options ["-target" "1.8" "-source" "1.8" "-Xlint:-options"]
;; :jvm-opts ["-Dcom.sun.management.jmxremote.port=9090"
;; "-Dcom.sun.management.jmxremote.authenticate=false"
;; "-Dcom.sun.management.jmxremote.ssl=false"
;; "-Dcom.sun.management.jmxremote.rmi.port=9090"
;; "-Djava.rmi.server.hostname=0.0.0.0"]
:dependencies [[org.clojure/clojure "1.9.0-alpha14"]
[org.clojure/tools.logging "0.3.1"]
[funcool/suricatta "1.3.1"]
[funcool/promesa "1.8.0"]
[funcool/catacumba "2.1.0"]
[funcool/cuerdas "2.0.3"]
[funcool/datoteka "1.0.0"]
[org.clojure/data.xml "0.1.0-beta2"]
[org.jsoup/jsoup "1.10.2"]
[hiccup "1.0.5"]
[org.im4java/im4java "1.4.0"]
[org.slf4j/slf4j-simple "1.7.24"]
[com.layerware/hugsql-core "0.4.7"
:exclusions [org.clojure/tools.reader]]
[niwinz/migrante "0.1.0"]
[buddy/buddy-sign "2.2.0"]
[buddy/buddy-hashers "1.3.0"]
[org.xerial.snappy/snappy-java "1.1.2.6"]
[com.github.spullara.mustache.java/compiler "0.9.4"]
[org.postgresql/postgresql "42.0.0"]
[org.quartz-scheduler/quartz "2.2.3"]
[org.quartz-scheduler/quartz-jobs "2.2.3"]
[commons-io/commons-io "2.5"]
[com.draines/postal "2.0.2" :exclusions [commons-codec]]
[hikari-cp "1.7.5"]
[mount "0.1.11"]
[environ "1.1.0"]])

View file

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

Before

Width:  |  Height:  |  Size: 750 B

After

Width:  |  Height:  |  Size: 750 B

View file

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -6,7 +6,7 @@
(ns uxbox.cli.collimp
"Collection importer command line helper."
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[clojure.pprint :refer [pprint]]
[clojure.java.io :as io]
[mount.core :as mount]

View file

@ -40,9 +40,9 @@
:database-name (lookup-env env :uxbox-database-name "uxbox")
:database-server (lookup-env env :uxbox-database-server "localhost")
:database-port (lookup-env env :uxbox-database-port 5432)
:media-directory (lookup-env env :uxbox-media-directory "resources/media")
:media-directory (lookup-env env :uxbox-media-directory "resources/public/media")
:media-uri (lookup-env env :uxbox-media-uri "http://localhost:6060/media/")
:assets-directory (lookup-env env :uxbox-assets-directory "resources/static")
:assets-directory (lookup-env env :uxbox-assets-directory "resources/public/static")
:assets-uri (lookup-env env :uxbox-assets-uri "http://localhost:6060/static/")
:email-reply-to (lookup-env env :uxbox-email-reply-to "no-reply@uxbox.io")

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.frontend.auth
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[catacumba.core :as ct]
[catacumba.http :as http]
[promesa.core :as p]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.frontend.icons
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[promesa.core :as p]
[catacumba.http :as http]
[uxbox.util.spec :as us]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.frontend.images
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[promesa.core :as p]
[catacumba.http :as http]
[datoteka.storages :as st]

View file

@ -6,7 +6,7 @@
(ns uxbox.frontend.kvstore
(:refer-clojure :exclude [update])
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[promesa.core :as p]
[catacumba.http :as http]
[uxbox.media :as media]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.frontend.pages
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[promesa.core :as p]
[catacumba.http :as http]
[uxbox.util.spec :as us]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.frontend.projects
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[promesa.core :as p]
[catacumba.http :as http]
[uxbox.util.spec :as us]

View file

@ -6,7 +6,7 @@
(ns uxbox.frontend.svgparse
"A frontend exposed endpoints for svgparse functionality."
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[promesa.core :as p]
[catacumba.http :as http]
[uxbox.util.spec :as us]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.frontend.users
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[promesa.core :as p]
[catacumba.http :as http]
[datoteka.storages :as st]

View file

@ -6,7 +6,7 @@
(ns uxbox.images
"Image postprocessing."
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[clojure.java.io :as io]
[datoteka.storages :as st]
[datoteka.core :as fs]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.auth
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[suricatta.core :as sc]
[buddy.hashers :as hashers]
[buddy.sign.jwt :as jwt]

View file

@ -6,7 +6,7 @@
(ns uxbox.services.icons
"Icons library related services."
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[suricatta.core :as sc]
[uxbox.util.spec :as us]
[uxbox.sql :as sql]

View file

@ -6,7 +6,7 @@
(ns uxbox.services.images
"Images library related services."
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[promesa.core :as p]
[suricatta.core :as sc]
[datoteka.storages :as st]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.kvstore
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[suricatta.core :as sc]
[buddy.core.codecs :as codecs]
[uxbox.config :as ucfg]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.pages
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[suricatta.core :as sc]
[buddy.core.codecs :as codecs]
[uxbox.config :as ucfg]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.projects
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[suricatta.core :as sc]
[buddy.core.codecs :as codecs]
[uxbox.config :as ucfg]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.svgparse
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[cuerdas.core :as str]
[uxbox.util.spec :as us]
[uxbox.services.core :as core]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.services.users
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[mount.core :as mount :refer (defstate)]
[suricatta.core :as sc]
[buddy.hashers :as hashers]

View file

@ -0,0 +1,3 @@
(ns uxbox.test)
(defn kaka [] 1)

View file

@ -6,7 +6,7 @@
(ns uxbox.util.spec
(:refer-clojure :exclude [keyword uuid vector boolean map set])
(:require [clojure.spec :as s]
(:require [clojure.spec.alpha :as s]
[cuerdas.core :as str]
[uxbox.util.exceptions :as ex])
(:import java.time.Instant))

View file

@ -1,40 +0,0 @@
FROM monogramm/docker-uxbox-builder:latest
ENV LEIN_ROOT=TRUE \
UXBOX_CONFIG_URL="/api" \
UXBOX_DEMO=false \
UXBOX_DEBUG=false
# Copy frontend source and build release
COPY . /home/uxbox/frontend
RUN set -ex; \
cd frontend; \
rm -f Dockerfile; \
rm -rf ./dist ./node_modules; \
sed -i \
-e 's|"uxbox.config.url" ".*"|"uxbox.config.url" "${UXBOX_CONFIG_URL}"|g' \
scripts/figwheel.clj; \
sed -i \
-e 's|url ".*")|url "${UXBOX_CONFIG_URL}")|g' \
src/uxbox/config.cljs; \
npm install; \
npm run prod; \
bash -c "/home/uxbox/frontend/scripts/dist-main"; \
bash -c "/home/uxbox/frontend/scripts/dist-view"; \
bash -c "/home/uxbox/frontend/scripts/dist-worker"
# Once application has been built, prepare production image
FROM nginx:alpine
LABEL maintainer="Monogramm Maintainers <opensource at monogramm dot io>"
ENV LANG=en_US.UTF-8 \
LC_ALL=C.UTF-8
# Copy built app to www root
COPY --from=0 /home/uxbox/frontend/dist /usr/share/nginx/html
# NGINX configurations
COPY ./docker-nginx/conf.d /etc/nginx/conf.d

30
frontend/deps.edn Normal file
View file

@ -0,0 +1,30 @@
{:deps {org.clojure/clojurescript {:mvn/version "1.10.516"}
org.clojure/clojure {:mvn/version "1.10.0"}
funcool/rumext {:mvn/version "1.0.0"}
funcool/promesa {:mvn/version "2.0.0"}
com.cognitect/transit-cljs {:mvn/version "0.8.239"}
rum/rum {:mvn/version "0.10.8" :exclusions [cljsjs/react cljsjs/react-dom]}
cljsjs/react {:mvn/version "15.5.0-0"}
cljsjs/react-dom {:mvn/version "15.5.0-0"}
cljsjs/react-dom-server {:mvn/version "15.5.0-0"}
environ/environ {:mvn/version "1.1.0"}
funcool/beicon {:mvn/version "3.2.0"}
funcool/bide {:mvn/version "1.6.0"}
funcool/cuerdas {:mvn/version "2.2.0"}
funcool/lentes {:mvn/version "1.2.0"}
funcool/potok {:mvn/version "2.1.0"}
}
:paths ["src" "vendor"]
: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.0"}
org.clojure/tools.namespace {:mvn/version "0.2.11"}
}
:extra-paths ["test" "resources"]}
}}

View file

@ -1,40 +0,0 @@
# Setting up NGNIX
You will need to complete the following tasks to setup your dockerized proxy server:
1. Include/Create SSL keys
2. Alter your backend upstream
3. Confirm your backend's path
## Include/Create SSL Keys
Have your key and csr in the nginx/keys directory as server.key and server.crt. These are copied into the docker image on build and used to serve your website or proxy your services.
### Generate your own self signed certificate
```bash
openssl req \
-newkey rsa:2048 -nodes -keyout nginx/keys/server.key \
-x509 -out nginx/keys/server.crt
```
This command from your project root will create the keys needed to start docker with self signed certificates. Note that if you are going to deploy this site for production you will want to replace these and rebuild your image with valid (purchased) SSL certificates. All the fields are optional. Do not set any challenge passwords.
If you want validated certificates but are not looking to purchase them; then checkout [Let's Encrypt](https://letsencrypt.org) which is a free SSL certification service.
## Alter your backend upstream
The upstream is a block used to load balance different destinations important to your proxy. In this example the upstream is used to proxy requests to your backend without worrying about XSS configurations.
We have preloaded some examples of what this looks like in the `nginx/conf.d/default.conf` file. You can certainly only specify one server in the block if that is your only server.
## Confirm your backend's path
Assuming your website uses a backend collection of APIs, you can setup your nginx service to reverse proxy to them avoiding any XSS configuration needs. The provided default.conf includes a `/api/` location block to serve as an example. You can replace api in `/api/` with any path you want to have forwarded to your backend.
There is only one setting you need to adjust in this block and that is the `proxy_cookie_domain`. Assuming you have a production domain you would change `my.uxbox.com` to be your domain. If you do not have a production domain it is safe to leave this as is or delete.
## Extending the configuration
You can include more servers or configuration settings by adding any named file in `nginx/conf.d`. These files are automatically consumed by nginx on startup.
[Visit NGINX's beginnner's guide](http://nginx.org/en/docs/beginners_guide.html) for additional help.

View file

@ -1,68 +0,0 @@
# This will load balance your backend to one or more destinations.
upstream uxboxbackend {
# server api1.uxbox.{{ DOMAIN }}:3000;
# server api1.uxbox.{{ DOMAIN }}:3001;
# server api2.uxbox.{{ DOMAIN }}:3000;
server uxbackend:6060; # This is a circular reference that allows docker to start as the example project
}
server {
listen 80 default_server;
listen [::]:80 default_server;
#listen 443 ssl http2 default_server;
#listen [::]:443 ssl http2 default_server;
#ssl_certificate /etc/nginx/keys/server.crt;
#ssl_certificate_key /etc/nginx/keys/server.key;
#ssl on;
#ssl_session_cache builtin:1000 shared:SSL:10m;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
#ssl_prefer_server_ciphers on;
#server_name uxbox.{{ DOMAIN }};
server_name _;
# Frontend
location / {
root /usr/share/nginx/html/;
try_files $uri /index.html;
gzip on;
gzip_types text/css text/javascript application/x-javascript application/javascript application/json;
add_header Cache-Control "max-age=15552000" always;
}
location /view {
alias /usr/share/nginx/html/view;
}
location /media {
alias /srv/uxbox/resources/media;
}
location /static {
alias /srv/uxbox/resources/static;
}
# Backend
location /api/ {
# Reverse Proxy to Backend (Avoids XSS concerns) --Update backend to be whatever your site uses to access your backend
proxy_pass http://uxboxbackend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# IMPORTANT: Update uxbox.{{ DOMAIN }} to your production site. This will allow cookies to work as expected when using your deployment locally
#proxy_cookie_domain localhost uxbox.{{ DOMAIN }};
}
}

View file

@ -1,4 +0,0 @@
server {
listen *:80;
return 301 https://$host$request_uri;
}

View file

@ -1,3 +0,0 @@
log_format gzip '[$time_local] ' '"$request" $status $bytes_sent';
access_log /dev/stdout;
charset utf-8;

View file

@ -26,6 +26,10 @@ gulp.task("clean", function(next) {
});
});
gulp.task("dist:clean", function(next) {
rimraf(paths.dist, next);
});
function makeAutoprefixer() {
return autoprefixer('last 2 version',
'safari 5',
@ -185,12 +189,9 @@ gulp.task("dist:gzip", function() {
// Entry Point
gulp.task("dist", gulp.series(
gulp.task("dist:clean"),
gulp.parallel(
gulp.task("dist:template"),
gulp.task("dist:scss"),
gulp.task("dist:copy")
)
gulp.task("dist", gulp.parallel(
gulp.task("dist:template"),
gulp.task("dist:scss"),
gulp.task("dist:copy")
));

6613
frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -9,13 +9,16 @@
"url": "https://github.com/uxbox/uxbox"
},
"scripts": {
"watch": "gulp",
"dist": "gulp dist",
"watch": "gulp watch",
"dist:clean": "gulp dist:clean",
"dist:main": "clojure -Adev tools.clj dist main",
"dist:view": "clojure -Adev tools.clj dist view",
"dist:worker": "clojure -Adev tools.clj dist worker",
"dist:assets": "gulp dist",
"prod": "gulp dist --production",
"clean": "gulp clean",
"figwheel": "PATH=./scripts:$PATH ./scripts/build-worker && PATH=./scripts:$PATH ./scripts/figwheel",
"test-watch": "PATH=./scripts:$PATH ./scripts/watch",
"test-build": "PATH=./scripts:$PATH ./scripts/build"
"start": "npm run build:worker && npm run figwheel",
"build:worker": "clojure -Adev tools.clj build worker",
"figwheel": "clojure -Adev tools.clj figwheel"
},
"devDependencies": {
"gulp": "4.0.2",

View file

@ -1,39 +0,0 @@
(defproject uxbox "0.1.0-SNAPSHOT"
:description "UXBox UI"
:url "http://uxbox.github.io"
:license {:name "MPL 2.0" :url "https://www.mozilla.org/en-US/MPL/2.0/"}
:jvm-opts ["-Dclojure.compiler.direct-linking=true"]
:source-paths ["src" "vendor"]
:test-paths ["test"]
:profiles {:dev {:source-paths ["dev"]}}
:dependencies [[org.clojure/clojure "1.9.0-alpha14" :scope "provided"]
[org.clojure/clojurescript "1.9.495" :scope "provided"]
;; Build
[figwheel-sidecar "0.5.9" :scope "provided"]
[environ "1.1.0"]
;; Runtime
[com.cognitect/transit-cljs "0.8.239"]
[funcool/rumext "1.0.0"]
[rum "0.10.8" :exclusions [cljsjs/react cljsjs/react-dom]]
[cljsjs/react "15.5.0-0"]
[cljsjs/react-dom "15.5.0-0"]
[cljsjs/react-dom-server "15.5.0-0"]
[funcool/beicon "3.2.0"]
[funcool/bide "1.4.0"]
[funcool/cuerdas "2.0.3"]
[funcool/lentes "1.2.0"]
[funcool/potok "2.1.0"]]
:plugins [[lein-ancient "0.6.10"]]
:clean-targets ^{:protect false} ["resources/public/js" "target"]
)

View file

@ -1,2 +0,0 @@
#!/bin/sh
lein trampoline run -m clojure.main scripts/build-main.clj

View file

@ -1,23 +0,0 @@
(require '[cljs.build.api :as b])
(println "Building ...")
(let [start (System/nanoTime)]
(b/build
(b/inputs "src")
{:main 'uxbox.main
:parallel-build false
:output-to "resources/public/js/main.js"
:source-map "resources/public/js/main.js.map"
:output-dir "resources/public/js/main"
:closure-defines {"uxbox.config.url" "https://test.uxbox.io/api"
"uxbox.config.viewurl" "https://test.uxbox.io/view/"}
:optimizations :advanced
:externs ["externs/main.js"]
:static-fns true
:elide-asserts true
:pretty-print false
:language-in :ecmascript6
:language-out :ecmascript5
:verbose true})
(println "... done. Elapsed" (/ (- (System/nanoTime) start) 1e9) "seconds"))

View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
source ~/.bashrc
npm install
npm run dist:clean || exit 1;
npm run dist:assets || exit 1;
npm run dist:main || exit 1;
npm run dist:view || exit 1;
npm run dist:worker || exit 1;

View file

@ -1,2 +0,0 @@
#!/bin/sh
lein trampoline run -m clojure.main scripts/build-tests.clj

View file

@ -1,20 +0,0 @@
(require '[cljs.build.api :as b])
(def options
{:main 'uxbox.tests.main
:parallel-build false
:output-to "out/tests.js"
:source-map true
:output-dir "out/tests"
:optimizations :none
:static-fns true
:pretty-print true
:target :nodejs
:language-in :ecmascript6
:language-out :ecmascript5
:verbose true})
(let [start (System/nanoTime)]
(println "Building ...")
(b/build (b/inputs "src" "test") options)
(println "... done. Elapsed" (/ (- (System/nanoTime) start) 1e9) "seconds"))

View file

@ -1,2 +0,0 @@
#!/bin/sh
lein trampoline run -m clojure.main scripts/build-worker.clj

View file

@ -1,20 +0,0 @@
(require '[cljs.build.api :as b])
(println "Building ...")
(let [start (System/nanoTime)]
(b/build
(b/inputs "src")
{:main 'uxbox.worker
:parallel-build false
:output-to "resources/public/js/worker.js"
:source-map "resources/public/js/worker.js.map"
:output-dir "resources/public/js/worker"
:asset-path "js"
:optimizations :simple
:static-fns true
:language-in :ecmascript6
:language-out :ecmascript5
:pretty-print true
:verbose true})
(println "... done. Elapsed" (/ (- (System/nanoTime) start) 1e9) "seconds"))

View file

@ -1,14 +0,0 @@
#!/bin/sh
DIR=`dirname $0`
LEIN="$DIR/lein"
LEIN_FAST_TRAMPOLINE=y $LEIN trampoline run -m clojure.main scripts/dist-main.clj
#if [ -x "$(command -v gzip)" ]; then
# gzip -9c dist/js/main.js > dist/js/main.js.gz
#fi
#
#if [ -x "$(command -v bro)" ]; then
# bro --verbose --input dist/js/main.js --output dist/js/main.js.br
#fi

View file

@ -1,35 +0,0 @@
(require '[cljs.build.api :as b])
(require '[environ.core :refer [env]])
(def debug?
(boolean (:uxbox-debug env nil)))
(def demo?
(boolean (:uxbox-demo env nil)))
(def defines
{"uxbox.config.url" "/api"
"uxbox.config.viewurl" "/view/"
"uxbox.config.isdemo" demo?})
(def options
{:main 'uxbox.main
:parallel-build false
:output-to "dist/js/main.js"
:source-map "dist/js/main.js.map"
:output-dir "dist/js/main"
:closure-defines defines
:language-in :ecmascript6
:language-out :ecmascript5
:optimizations :advanced
:cache-analysis false
:static-fns true
:elide-asserts true
:pretty-print debug?
:verbose true
:pseudo-names debug?})
(let [start (System/nanoTime)]
(println "Building ...")
(b/build (b/inputs "src" "vendor") options)
(println "... done. Elapsed" (/ (- (System/nanoTime) start) 1e9) "seconds"))

View file

@ -1,14 +0,0 @@
#!/bin/sh
DIR=`dirname $0`
LEIN="$DIR/lein"
LEIN_FAST_TRAMPOLINE=y $LEIN trampoline run -m clojure.main scripts/dist-view.clj
#if [ -x "$(command -v gzip)" ]; then
# gzip -9c dist/js/view.js > dist/js/view.js.gz
#fi
#
#if [ -x "$(command -v bro)" ]; then
# bro --verbose --input dist/js/view.js --output dist/js/view.js.br
#fi

View file

@ -1,37 +0,0 @@
(require '[cljs.build.api :as b])
(require '[environ.core :refer [env]])
(def debug?
(boolean (:uxbox-debug env nil)))
(def demo?
(boolean (:uxbox-demo env nil)))
(def defines
{"uxbox.config.url" "/api"
"uxbox.config.viewurl" "/view/"
"uxbox.config.isdemo" demo?})
(def options
{:main 'uxbox.view
:parallel-build false
:output-to "dist/js/view.js"
:source-map "dist/js/view.js.map"
:output-dir "dist/js/view"
:externs ["externs/main.js"]
:closure-defines defines
:language-in :ecmascript6
:language-out :ecmascript5
:optimizations :advanced
:cache-analysis false
:static-fns true
:elide-asserts true
:pretty-print debug?
:verbose true
:pseudo-names debug?
:compiler-stats true})
(let [start (System/nanoTime)]
(println "Building ...")
(b/build (b/inputs "src") options)
(println "... done. Elapsed" (/ (- (System/nanoTime) start) 1e9) "seconds"))

View file

@ -1,14 +0,0 @@
#!/bin/sh
DIR=`dirname $0`
LEIN="$DIR/lein"
LEIN_FAST_TRAMPOLINE=y $LEIN trampoline run -m clojure.main scripts/dist-worker.clj
#if [ -x "$(command -v gzip)" ]; then
# gzip -9c dist/js/worker.js > dist/js/worker.js.gz
#fi
#
#if [ -x "$(command -v bro)" ]; then
# bro --verbose --input dist/js/worker.js --output dist/js/worker.js.br
#fi

View file

@ -1,28 +0,0 @@
(require '[cljs.build.api :as b])
(require '[environ.core :refer [env]])
(def debug?
(boolean (:uxbox-debug env nil)))
(def options
{:main 'uxbox.worker
:parallel-build false
:output-to "dist/js/worker.js"
:source-map "dist/js/worker.js.map"
:output-dir "dist/js/worker"
:externs ["externs/main.js"]
:language-in :ecmascript6
:language-out :ecmascript5
:optimizations :advanced
:cache-analysis false
:static-fns true
:elide-asserts true
:pretty-print debug?
:verbose true
:pseudo-names debug?
:compiler-stats true})
(let [start (System/nanoTime)]
(println "Building ...")
(b/build (b/inputs "src") options)
(println "... done. Elapsed" (/ (- (System/nanoTime) start) 1e9) "seconds"))

View file

@ -1,11 +0,0 @@
#!/usr/bin/env bash
DIR=`dirname $0`
LEIN="$DIR/lein"
RLWRAP=`which rlwrap`
if [ $? != 0 ]; then
RLWRAP="";
fi
LEIN_FAST_TRAMPOLINE=y $RLWRAP $LEIN trampoline run -m clojure.main scripts/figwheel.clj || exit 1

View file

@ -1,52 +0,0 @@
(require '[figwheel-sidecar.repl :as r]
'[figwheel-sidecar.repl-api :as ra])
(def options
{
"uxbox.config.url" "http://127.0.0.1:6060/api"
})
(ra/start-figwheel!
{:figwheel-options {:css-dirs ["resources/public/css"
"resources/public/view/css"]
:validate-config false
:server-port 3449
:server-ip "0.0.0.0"}
:build-ids ["main", "view"]
:all-builds
[{:id "main"
:figwheel {:websocket-host :js-client-host
:on-jsload "uxbox.main.ui/init"}
:source-paths ["src" "vendor"]
:compiler
{:main 'uxbox.main
:cache-analysis false
:parallel-build false
:optimizations :none
:closure-defines options
:language-in :ecmascript6
:language-out :ecmascript5
:output-to "resources/public/js/main.js"
:output-dir "resources/public/js/main"
:asset-path "/js/main"
:verbose true}}
{:id "view"
:figwheel {:websocket-host :js-client-host
:on-jsload "uxbox.view.ui/init"}
:source-paths ["src" "vendor"]
:compiler
{:main 'uxbox.view
:parallel-build false
:cache-analysis false
:optimizations :none
:closure-defines options
:language-in :ecmascript6
:language-out :ecmascript5
:output-to "resources/public/js/view.js"
:output-dir "resources/public/js/view"
:asset-path "/js/view"
:verbose true}}
]})
(ra/cljs-repl "main")

View file

@ -1,396 +0,0 @@
#!/usr/bin/env bash
# Ensure this file is executable via `chmod a+x lein`, then place it
# somewhere on your $PATH, like ~/bin. The rest of Leiningen will be
# installed upon first run into the ~/.lein/self-installs directory.
export LEIN_VERSION="2.7.1"
case $LEIN_VERSION in
*SNAPSHOT) SNAPSHOT="YES" ;;
*) SNAPSHOT="NO" ;;
esac
if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]]; then
delimiter=";"
else
delimiter=":"
fi
if [[ "$OSTYPE" == "cygwin" ]]; then
cygwin=true
else
cygwin=false
fi
function command_not_found {
>&2 echo "Leiningen coundn't find $1 in your \$PATH ($PATH), which is required."
exit 1
}
function make_native_path {
# ensure we have native paths
if $cygwin && [[ "$1" == /* ]]; then
echo -n "$(cygpath -wp "$1")"
elif [[ "$OSTYPE" == "msys" && "$1" == /?/* ]]; then
echo -n "$(sh -c "(cd $1 2</dev/null && pwd -W) || echo $1 | sed 's/^\\/\([a-z]\)/\\1:/g'")"
else
echo -n "$1"
fi
}
# usage : add_path PATH_VAR [PATH]...
function add_path {
local path_var="$1"
shift
while [ -n "$1" ];do
# http://bashify.com/?Useful_Techniques:Indirect_Variables:Indirect_Assignment
if [[ -z ${!path_var} ]]; then
export ${path_var}="$(make_native_path "$1")"
else
export ${path_var}="${!path_var}${delimiter}$(make_native_path "$1")"
fi
shift
done
}
function download_failed_message {
echo "Failed to download $1 (exit code $2)"
echo "It's possible your HTTP client's certificate store does not have the"
echo "correct certificate authority needed. This is often caused by an"
echo "out-of-date version of libssl. It's also possible that you're behind a"
echo "firewall and haven't set HTTP_PROXY and HTTPS_PROXY."
}
function self_install {
if [ -r "$LEIN_JAR" ]; then
echo "The self-install jar already exists at $LEIN_JAR."
echo "If you wish to re-download, delete it and rerun \"$0 self-install\"."
exit 1
fi
echo "Downloading Leiningen to $LEIN_JAR now..."
mkdir -p "$(dirname "$LEIN_JAR")"
LEIN_URL="https://github.com/technomancy/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.zip"
$HTTP_CLIENT "$LEIN_JAR.pending" "$LEIN_URL"
local exit_code=$?
if [ $exit_code == 0 ]; then
# TODO: checksum
mv -f "$LEIN_JAR.pending" "$LEIN_JAR"
else
rm "$LEIN_JAR.pending" 2> /dev/null
download_failed_message "$LEIN_URL" "$exit_code"
exit 1
fi
}
function check_root {
local -i user_id
# Thank you for the complexity, Solaris
if [ `uname` = "SunOS" -a -x /usr/xpg4/bin/id ]; then
user_id=$(/usr/xpg4/bin/id -u 2>/dev/null || echo 0)
else
user_id=$(id -u 2>/dev/null || echo 0)
fi
[ $user_id -eq 0 -a "$LEIN_ROOT" = "" ] && return 0
return 1
}
if check_root; then
echo "WARNING: You're currently running as root; probably by accident."
echo "Press control-C to abort or Enter to continue as root."
echo "Set LEIN_ROOT to disable this warning."
read _
fi
NOT_FOUND=1
ORIGINAL_PWD="$PWD"
while [ ! -r "$PWD/project.clj" ] && [ "$PWD" != "/" ] && [ $NOT_FOUND -ne 0 ]
do
cd ..
if [ "$(dirname "$PWD")" = "/" ]; then
NOT_FOUND=0
cd "$ORIGINAL_PWD"
fi
done
export LEIN_HOME="${LEIN_HOME:-"$HOME/.lein"}"
for f in "/etc/leinrc" "$LEIN_HOME/leinrc" ".leinrc"; do
if [ -e "$f" ]; then
source "$f"
fi
done
if $cygwin; then
export LEIN_HOME=$(cygpath -w "$LEIN_HOME")
fi
LEIN_JAR="$LEIN_HOME/self-installs/leiningen-$LEIN_VERSION-standalone.jar"
# normalize $0 on certain BSDs
if [ "$(dirname "$0")" = "." ]; then
SCRIPT="$(which "$(basename "$0")")"
if [ -z "$SCRIPT" ]; then
SCRIPT="$0"
fi
else
SCRIPT="$0"
fi
# resolve symlinks to the script itself portably
while [ -h "$SCRIPT" ] ; do
ls=$(ls -ld "$SCRIPT")
link=$(expr "$ls" : '.*-> \(.*\)$')
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT="$(dirname "$SCRIPT"$)/$link"
fi
done
BIN_DIR="$(dirname "$SCRIPT")"
export LEIN_JVM_OPTS="${LEIN_JVM_OPTS-"-XX:+TieredCompilation -XX:TieredStopAtLevel=1"}"
# This needs to be defined before we call HTTP_CLIENT below
if [ "$HTTP_CLIENT" = "" ]; then
if type -p curl >/dev/null 2>&1; then
if [ "$https_proxy" != "" ]; then
CURL_PROXY="-x $https_proxy"
fi
HTTP_CLIENT="curl $CURL_PROXY -f -L -o"
else
HTTP_CLIENT="wget -O"
fi
fi
# When :eval-in :classloader we need more memory
grep -E -q '^\s*:eval-in\s+:classloader\s*$' project.clj 2> /dev/null && \
export LEIN_JVM_OPTS="$LEIN_JVM_OPTS -Xms64m -Xmx512m"
if [ -r "$BIN_DIR/../src/leiningen/version.clj" ]; then
# Running from source checkout
LEIN_DIR="$(dirname "$BIN_DIR")"
# Need to use lein release to bootstrap the leiningen-core library (for aether)
if [ ! -r "$LEIN_DIR/leiningen-core/.lein-bootstrap" ]; then
echo "Leiningen is missing its dependencies."
echo "Please run \"lein bootstrap\" in the leiningen-core/ directory"
echo "with a stable release of Leiningen. See CONTRIBUTING.md for details."
exit 1
fi
# If project.clj for lein or leiningen-core changes, we must recalculate
LAST_PROJECT_CHECKSUM=$(cat "$LEIN_DIR/.lein-project-checksum" 2> /dev/null)
PROJECT_CHECKSUM=$(sum "$LEIN_DIR/project.clj" "$LEIN_DIR/leiningen-core/project.clj")
if [ "$PROJECT_CHECKSUM" != "$LAST_PROJECT_CHECKSUM" ]; then
if [ -r "$LEIN_DIR/.lein-classpath" ]; then
rm "$LEIN_DIR/.lein-classpath"
fi
fi
# Use bin/lein to calculate its own classpath.
if [ ! -r "$LEIN_DIR/.lein-classpath" ] && [ "$1" != "classpath" ]; then
echo "Recalculating Leiningen's classpath."
ORIG_PWD="$PWD"
cd "$LEIN_DIR"
LEIN_NO_USER_PROFILES=1 $0 classpath .lein-classpath
sum "$LEIN_DIR/project.clj" "$LEIN_DIR/leiningen-core/project.clj" > \
.lein-project-checksum
cd "$ORIG_PWD"
fi
mkdir -p "$LEIN_DIR/target/classes"
export LEIN_JVM_OPTS="$LEIN_JVM_OPTS -Dclojure.compile.path=$LEIN_DIR/target/classes"
add_path CLASSPATH "$LEIN_DIR/leiningen-core/src/" "$LEIN_DIR/leiningen-core/resources/" \
"$LEIN_DIR/test:$LEIN_DIR/target/classes" "$LEIN_DIR/src" ":$LEIN_DIR/resources"
if [ -r "$LEIN_DIR/.lein-classpath" ]; then
add_path CLASSPATH "$(cat "$LEIN_DIR/.lein-classpath" 2> /dev/null)"
else
add_path CLASSPATH "$(cat "$LEIN_DIR/leiningen-core/.lein-bootstrap" 2> /dev/null)"
fi
else # Not running from a checkout
add_path CLASSPATH "$LEIN_JAR"
BOOTCLASSPATH="-Xbootclasspath/a:$LEIN_JAR"
if [ ! -r "$LEIN_JAR" -a "$1" != "self-install" ]; then
self_install
fi
fi
if [ ! -x "$JAVA_CMD" ] && ! type -f java >/dev/null
then
>&2 echo "Leiningen coundn't find 'java' executable, which is required."
>&2 echo "Please either set JAVA_CMD or put java (>=1.6) in your \$PATH ($PATH)."
exit 1
fi
export LEIN_JAVA_CMD="${LEIN_JAVA_CMD:-${JAVA_CMD:-java}}"
if [[ -z "${DRIP_INIT+x}" && "$(basename "$LEIN_JAVA_CMD")" == *drip* ]]; then
export DRIP_INIT="$(printf -- '-e\n(require (quote leiningen.repl))')"
export DRIP_INIT_CLASS="clojure.main"
fi
# Support $JAVA_OPTS for backwards-compatibility.
export JVM_OPTS="${JVM_OPTS:-"$JAVA_OPTS"}"
# Handle jline issue with cygwin not propagating OSTYPE through java subprocesses: https://github.com/jline/jline2/issues/62
cygterm=false
if $cygwin; then
case "$TERM" in
rxvt* | xterm* | vt*) cygterm=true ;;
esac
fi
if $cygterm; then
LEIN_JVM_OPTS="$LEIN_JVM_OPTS -Djline.terminal=jline.UnixTerminal"
stty -icanon min 1 -echo > /dev/null 2>&1
fi
# TODO: investigate http://skife.org/java/unix/2011/06/20/really_executable_jars.html
# If you're packaging this for a package manager (.deb, homebrew, etc)
# you need to remove the self-install and upgrade functionality or see lein-pkg.
if [ "$1" = "self-install" ]; then
if [ -r "$BIN_DIR/../src/leiningen/version.clj" ]; then
echo "Running self-install from a checkout is not supported."
echo "See CONTRIBUTING.md for SNAPSHOT-specific build instructions."
exit 1
fi
echo "Manual self-install is deprecated; it will run automatically when necessary."
self_install
elif [ "$1" = "upgrade" ] || [ "$1" = "downgrade" ]; then
if [ "$LEIN_DIR" != "" ]; then
echo "The upgrade task is not meant to be run from a checkout."
exit 1
fi
if [ $SNAPSHOT = "YES" ]; then
echo "The upgrade task is only meant for stable releases."
echo "See the \"Bootstrapping\" section of CONTRIBUTING.md."
exit 1
fi
if [ ! -w "$SCRIPT" ]; then
echo "You do not have permission to upgrade the installation in $SCRIPT"
exit 1
else
TARGET_VERSION="${2:-stable}"
echo "The script at $SCRIPT will be upgraded to the latest $TARGET_VERSION version."
echo -n "Do you want to continue [Y/n]? "
read RESP
case "$RESP" in
y|Y|"")
echo
echo "Upgrading..."
TARGET="/tmp/lein-$$-upgrade"
if $cygwin; then
TARGET=$(cygpath -w "$TARGET")
fi
LEIN_SCRIPT_URL="https://github.com/technomancy/leiningen/raw/$TARGET_VERSION/bin/lein"
$HTTP_CLIENT "$TARGET" "$LEIN_SCRIPT_URL"
if [ $? == 0 ]; then
cmp -s "$TARGET" "$SCRIPT"
if [ $? == 0 ]; then
echo "Leiningen is already up-to-date."
fi
mv "$TARGET" "$SCRIPT" && chmod +x "$SCRIPT"
exec "$SCRIPT" version
else
download_failed_message "$LEIN_SCRIPT_URL"
fi;;
*)
echo "Aborted."
exit 1;;
esac
fi
else
if $cygwin; then
# When running on Cygwin, use Windows-style paths for java
ORIGINAL_PWD=$(cygpath -w "$ORIGINAL_PWD")
fi
# apply context specific CLASSPATH entries
if [ -f .lein-classpath ]; then
add_path CLASSPATH "$(cat .lein-classpath)"
fi
if [ -n "$DEBUG" ]; then
echo "Leiningen's classpath: $CLASSPATH"
fi
if [ -r .lein-fast-trampoline ]; then
export LEIN_FAST_TRAMPOLINE='y'
fi
if [ "$LEIN_FAST_TRAMPOLINE" != "" ] && [ -r project.clj ]; then
INPUTS="$* $(cat project.clj) $LEIN_VERSION $(test -f "$LEIN_HOME/profiles.clj" && cat "$LEIN_HOME/profiles.clj")"
if command -v shasum >/dev/null 2>&1; then
SUM="shasum"
elif command -v sha1sum >/dev/null 2>&1; then
SUM="sha1sum"
else
command_not_found "sha1sum or shasum"
fi
export INPUT_CHECKSUM=$(echo "$INPUTS" | $SUM | cut -f 1 -d " ")
# Just don't change :target-path in project.clj, mkay?
TRAMPOLINE_FILE="target/trampolines/$INPUT_CHECKSUM"
else
if hash mktemp 2>/dev/null; then
# Check if mktemp is available before using it
TRAMPOLINE_FILE="$(mktemp /tmp/lein-trampoline-XXXXXXXXXXXXX)"
else
TRAMPOLINE_FILE="/tmp/lein-trampoline-$$"
fi
trap "rm -f $TRAMPOLINE_FILE" EXIT
fi
if $cygwin; then
TRAMPOLINE_FILE=$(cygpath -w "$TRAMPOLINE_FILE")
fi
if [ "$INPUT_CHECKSUM" != "" ] && [ -r "$TRAMPOLINE_FILE" ]; then
if [ -n "$DEBUG" ]; then
echo "Fast trampoline with $TRAMPOLINE_FILE."
fi
exec sh -c "exec $(cat "$TRAMPOLINE_FILE")"
else
export TRAMPOLINE_FILE
"$LEIN_JAVA_CMD" \
"${BOOTCLASSPATH[@]}" \
-Dfile.encoding=UTF-8 \
-Dmaven.wagon.http.ssl.easy=false \
-Dmaven.wagon.rto=10000 \
$LEIN_JVM_OPTS \
-Dleiningen.original.pwd="$ORIGINAL_PWD" \
-Dleiningen.script="$SCRIPT" \
-classpath "$CLASSPATH" \
clojure.main -m leiningen.core.main "$@"
EXIT_CODE=$?
if $cygterm ; then
stty icanon echo > /dev/null 2>&1
fi
## TODO: [ -r "$TRAMPOLINE_FILE" ] may be redundant? A trampoline file
## is always generated these days.
if [ -r "$TRAMPOLINE_FILE" ] && [ "$LEIN_TRAMPOLINE_WARMUP" = "" ]; then
TRAMPOLINE="$(cat "$TRAMPOLINE_FILE")"
if [ "$INPUT_CHECKSUM" = "" ]; then
rm "$TRAMPOLINE_FILE"
fi
if [ "$TRAMPOLINE" = "" ]; then
exit $EXIT_CODE
else
exec sh -c "exec $TRAMPOLINE"
fi
else
exit $EXIT_CODE
fi
fi
fi

View file

@ -1,2 +0,0 @@
#!/bin/sh
rlwrap lein trampoline run -m clojure.main scripts/repl.clj

View file

@ -1,6 +0,0 @@
(require '[cljs.repl :as repl])
(require '[cljs.repl.node :as node])
(def options {:output-dir "out/repl"})
(repl/repl* (node/repl-env) options)

View file

@ -1,2 +0,0 @@
#!/bin/sh
lein trampoline run -m clojure.main scripts/watch-bench.clj

View file

@ -1,15 +0,0 @@
(require '[cljs.build.api :as b])
(b/watch
(b/inputs "dev" "src")
{:main 'bench.core
:output-to "out/bench.js"
:output-dir "out/bench"
:parallel-build false
:optimizations :none
:static-fns false
:target :nodejs
:language-in :ecmascript6
:language-out :ecmascript5
:pretty-print true
:verbose true})

View file

@ -1,2 +0,0 @@
#!/bin/sh
lein trampoline run -m clojure.main scripts/watch-main.clj

View file

@ -1,18 +0,0 @@
(require '[cljs.build.api :as b])
(b/watch
(b/inputs "src")
{:main 'uxbox.main
:parallel-build false
:output-to "resources/public/js/main.js"
:output-dir "resources/public/js/main"
:closure-defines {"uxbox.config.url" "https://test.uxbox.io/api"
"uxbox.config.viewurl" "https://test.uxbox.io/view/"}
:optimizations :advanced
:externs ["externs/main.js"]
:static-fns true
:elide-asserts true
:pretty-print false
:language-in :ecmascript6
:language-out :ecmascript5
:verbose true})

View file

@ -1,2 +0,0 @@
#!/bin/sh
lein trampoline run -m clojure.main scripts/watch-tests.clj

View file

@ -1,17 +0,0 @@
(require '[cljs.build.api :as b])
(def options
{:main 'uxbox.tests.main
:parallel-build false
:output-to "out/tests.js"
:source-map true
:output-dir "out/tests"
:optimizations :none
:static-fns true
:pretty-print true
:target :nodejs
:language-in :ecmascript6
:language-out :ecmascript5
:verbose true})
(b/watch (b/inputs "src" "test") options)

View file

@ -1,2 +0,0 @@
#!/bin/sh
lein trampoline run -m clojure.main scripts/watch-worker.clj

View file

@ -1,16 +0,0 @@
(require '[cljs.build.api :as b])
(b/watch
(b/inputs "src")
{:main 'uxbox.worker
:parallel-build false
:output-to "resources/public/js/worker.js"
:source-map "resources/public/js/worker.js.map"
:output-dir "resources/public/js/worker"
:asset-path "js"
:optimizations :simple
:static-fns true
:language-in :ecmascript6
:language-out :ecmascript5
:pretty-print true
:verbose true})

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2015-2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.main.data.auth
(:require [cljs.spec :as s]
(:require [cljs.spec.alpha :as s]
[beicon.core :as rx]
[potok.core :as ptk]
[uxbox.main.store :as st]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.main.data.images
(:require [cljs.spec :as s]
(:require [cljs.spec.alpha :as s]
[cuerdas.core :as str]
[beicon.core :as rx]
[potok.core :as ptk]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2015-2017 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.main.data.pages
(:require [cljs.spec :as s]
(:require [cljs.spec.alpha :as s]
[cuerdas.core :as str]
[beicon.core :as rx]
[lentes.core :as l]
@ -322,7 +322,7 @@
(defn metadata-persisted?
[v]
(instance? MetadataPersisted. v))
(instance? MetadataPersisted v))
(defn metadata-persisted
[{:keys [id] :as data}]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2015-2017 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.main.data.projects
(:require [cljs.spec :as s]
(:require [cljs.spec.alpha :as s]
[cuerdas.core :as str]
[beicon.core :as rx]
[potok.core :as ptk]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2015-2017 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.main.data.shapes
(:require [cljs.spec :as s :include-macros true]
(:require [cljs.spec.alpha :as s :include-macros true]
[lentes.core :as l]
[beicon.core :as rx]
[potok.core :as ptk]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.main.data.users
(:require [cljs.spec :as s]
(:require [cljs.spec.alpha :as s]
[beicon.core :as rx]
[potok.core :as ptk]
[uxbox.main.repo :as rp]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2015-2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.main.data.workspace
(:require [cljs.spec :as s]
(:require [cljs.spec.alpha :as s]
[beicon.core :as rx]
[potok.core :as ptk]
[uxbox.main.store :as st]

View file

@ -6,7 +6,7 @@
;; Copyright (c) 2015-2016 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.main.ui.auth.login
(:require [cljs.spec :as s :include-macros true]
(:require [cljs.spec.alpha :as s :include-macros true]
[lentes.core :as l]
[cuerdas.core :as str]
[uxbox.builtins.icons :as i]

View file

@ -6,7 +6,7 @@
;; Copyright (c) 2015-2017 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.main.ui.auth.recovery
(:require [cljs.spec :as s :include-macros true]
(:require [cljs.spec.alpha :as s :include-macros true]
[lentes.core :as l]
[cuerdas.core :as str]
[uxbox.builtins.icons :as i]

View file

@ -6,7 +6,7 @@
;; Copyright (c) 2015-2017 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.main.ui.auth.recovery-request
(:require [cljs.spec :as s :include-macros true]
(:require [cljs.spec.alpha :as s :include-macros true]
[lentes.core :as l]
[cuerdas.core :as str]
[uxbox.builtins.icons :as i]

View file

@ -6,7 +6,7 @@
;; Copyright (c) 2015-2017 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.main.ui.auth.register
(:require [cljs.spec :as s :include-macros true]
(:require [cljs.spec.alpha :as s :include-macros true]
[lentes.core :as l]
[cuerdas.core :as str]
[uxbox.builtins.icons :as i]

View file

@ -6,7 +6,7 @@
;; Copyright (c) 2015-2017 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.main.ui.dashboard.projects-createform
(:require [cljs.spec :as s :include-macros true]
(:require [cljs.spec.alpha :as s :include-macros true]
[lentes.core :as l]
[cuerdas.core :as str]
[uxbox.builtins.icons :as i]

View file

@ -6,7 +6,7 @@
;; Copyright (c) 2016-2017 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.main.ui.settings.password
(:require [cljs.spec :as s :include-macros true]
(:require [cljs.spec.alpha :as s :include-macros true]
[lentes.core :as l]
[cuerdas.core :as str]
[potok.core :as ptk]

View file

@ -6,7 +6,7 @@
;; Copyright (c) 2016-2017 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.main.ui.settings.profile
(:require [cljs.spec :as s :include-macros true]
(:require [cljs.spec.alpha :as s :include-macros true]
[cuerdas.core :as str]
[lentes.core :as l]
[potok.core :as ptk]

View file

@ -6,7 +6,7 @@
;; Copyright (c) 2015-2016 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.main.ui.workspace.sidebar.sitemap-pageform
(:require [cljs.spec :as s :include-macros true]
(:require [cljs.spec.alpha :as s :include-macros true]
[lentes.core :as l]
[uxbox.builtins.icons :as i]
[uxbox.main.store :as st]

View file

@ -6,7 +6,7 @@
(ns uxbox.main.workers
"A interface to webworkers exposed functionality."
(:require [cljs.spec :as s]
(:require [cljs.spec.alpha :as s]
[beicon.core :as rx]
[potok.core :as ptk]
[uxbox.util.spec :as us]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2015-2017 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.forms
(:require [cljs.spec :as s :include-macros true]
(:require [cljs.spec.alpha :as s :include-macros true]
[cuerdas.core :as str]
[lentes.core :as l]
[beicon.core :as rx]

View file

@ -5,7 +5,7 @@
;; Copyright (c) 2015-2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.spec
(:require [cljs.spec :as s]))
(:require [cljs.spec.alpha :as s]))
;; --- Constants

79
frontend/tools.clj Normal file
View file

@ -0,0 +1,79 @@
(require '[clojure.java.shell :as shell])
(require '[figwheel.main.api :as figwheel])
(require '[cljs.build.api :as api])
(require '[environ.core :refer [env]])
(defmulti task first)
(defmethod task :default
[args]
(let [all-tasks (-> task methods (dissoc :default) keys sort)
interposed (->> all-tasks (interpose ", ") (apply str))]
(println "Unknown or missing task. Choose one of:" interposed)
(System/exit 1)))
(def debug? (boolean (:uxbox-debug env nil)))
(def demo? (boolean (:uxbox-demo env nil)))
(def closure-defines
{"uxbox.config.url" (:uxbox-api-url env "http://127.0.0.1:6060/api")
"uxbox.config.viewurl" (:uxbox-view-url env "/view/")
"uxbox.config.isdemo" demo?})
(def default-build-options
{:cache-analysis false
:parallel-build false
:language-in :ecmascript6
:language-out :ecmascript5
:closure-defines closure-defines
:optimizations :none
:verbose true
:static-fns false
:pretty-print true
:elide-asserts false})
(defn get-output-options
[name dist? map?]
(let [prefix (if dist? "dist/js" "resources/public/js")
opts {:main (symbol (str "uxbox." name))
:output-to (str prefix "/" name ".js")
:output-dir (str prefix "/" name)
:source-map (str prefix "/" name ".js.map")
:asset-path (str "js/" name)}]
(cond-> opts
dist? (dissoc opts :source-map))))
(defmethod task "dist"
[[_ name]]
(api/build (api/inputs "src" "test")
(merge default-build-options
(get-output-options name true true)
{:optimizations :advanced
:static-fns true
:elide-asserts true})))
(defmethod task "build"
[[_ name]]
(api/build (api/inputs "src" "test")
(merge default-build-options
(get-output-options name false true)
{:optimizations :simple})))
(defmethod task "figwheel"
[args]
(figwheel/start
{:open-url false
:auto-testing false
:css-dirs ["resources/public/css"
"resources/public/view/css"]
:watch-dirs ["src" "test"]}
{:id "main"
:options (merge default-build-options
(get-output-options "main" false false))}
{:id "view"
:options (merge default-build-options
(get-output-options "view" false false))}))
;;; Build script entrypoint. This should be the last expression.
(task *command-line-args*)