Skip to content

Commit

Permalink
fix: boot error in prod mode (athensresearch#41)
Browse files Browse the repository at this point in the history
* Add source maps

* Add build script for self-hosted app

* Build step for app

* Tweak artifact name

* Freestyling now

* Enable building..

* Run yarn

* Add comments to explain the commands

* fix: boot error when compiling for production
  • Loading branch information
jeroenvandijk committed May 8, 2020
1 parent 318faaf commit 76d0881
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 1 deletion.
42 changes: 42 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,45 @@ jobs:
- name: Lint
run: |
script/lint
build-app:
needs: [test]
# ubuntu 18.04 comes with lein + java8 installed
runs-on: ubuntu-18.04
steps:
- name: Git checkout
uses: actions/checkout@v1
with:
fetch-depth: 1
submodules: 'true'

- name: Cache deps
uses: actions/cache@v1
id: cache-deps
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('project.clj') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Fetch deps
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
lein deps
- name: Athens version
id: athens-version
run: |
ATHENS_VERSION=$(echo $GITHUB_SHA | head -c 7)
echo "##[set-output name=version;]${ATHENS_VERSION}"
echo "##[set-output name=release-name;]athens-app-${ATHENS_VERSION}"
- name: Release
run: |
RELEASE_NAME=${{ steps.athens-version.outputs.release-name }} script/build/athens-app
- uses: actions/upload-artifact@v1
with:
name: app
path: ${{ steps.athens-version.outputs.release-name }}.tar.gz


23 changes: 23 additions & 0 deletions script/build/athens-app
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -eo pipefail

# Make sure all JS deps are available
yarn

# Build app (see shadow-cljs.edn config)
lein prod

RELEASE_NAME=${RELEASE_NAME:-"athens-app"}

# Clean before
rm -rf $RELEASE_NAME

cp -R resources/public $RELEASE_NAME

tar -zcvf $RELEASE_NAME.tar.gz $RELEASE_NAME

# Clean after
rm -rf $RELEASE_NAME


4 changes: 4 additions & 0 deletions shadow-cljs.edn
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
:modules {:app {:init-fn athens.core/init
:preloads [devtools.preload
day8.re-frame-10x.preload]}}
:compiler-options {:source-map true
:source-map-detail-level :all
:source-map-include-sources-content true}

:dev {:compiler-options
{:closure-defines {re-frame.trace.trace-enabled? true
day8.re-frame.tracing.trace-enabled? true}}}
Expand Down
3 changes: 2 additions & 1 deletion src/cljs/athens/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
(defn init []
(rf/dispatch-sync [:init-rfdb])
;; when dev, download datoms directly
(when config/debug?
;; FIXME without this dispatch nothing works, so enabling it for now
(when true #_config/debug?
(rf/dispatch [:boot]))
(dev-setup)
(mount-root))

0 comments on commit 76d0881

Please sign in to comment.