Skip to content

Commit

Permalink
Migrate to shadow-cljs (#134)
Browse files Browse the repository at this point in the history
* Initial refactor attempt to use shadow-cljs

Not building the worker, yet, and we also will need to update it
to handle worker update requests

* Add web-worker module

* Refactor prod config to live in shadow-cljs.edn

* Begin to set up shadow-cljs CI

* Fix js module imports

* Tweak nav handling

We may switch back to using fragment-based nav locally since that may
more closely match how things will actually work on github pages. In
particular, the worker gets into a loop trying to cache assets in the
current version if you don't load from the root.

Also, still need to fix shadow hotloading

* Use npm in travis instead of lein

Also, we shouldn't need to delete node_modules anymore

* Fix ignored package.json; tweak travis config

* Fix worker path + disable worker handling of shadow-cljs updates

* Ensure mount-root is called on shadow update

* Fix script load order in index.html

* Update re-frame-10x to resolve compile warnings

* Upgrade other dependencies

* Fix recursive loop error with splash icon locally

* Add convenience util to auto-reconnect shadow

We retry *once* in case the server is still running and we just
lost connection because the machine was put to sleep or something.

* Update build scripts

Move some configuration into package.json using --config-merge

* Compile css as part of build script

* Upgrade spade to fix bug

* Fix js loading after redirect

Since its script tag is happening *after* the redirect, we need to
always use the absolute path

* Enable fn-invoke-direct

* Refactor web worker to a separate build to maintain root scope

* Downgrade react to the expected versions for reagent et al

* Add npm-based linting and fix new lint warnings

* Install `clojure` cli for linting; use npm ci instead of install

* Delete now-unused leiningen project.clj
  • Loading branch information
dhleong authored Sep 29, 2019
1 parent 8f71ab7 commit ac77d99
Show file tree
Hide file tree
Showing 21 changed files with 1,850 additions and 2,151 deletions.
3 changes: 1 addition & 2 deletions .clj-kondo/config.edn
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
{:linters
{:unused-namespace {:exclude [cljs-css-modules.macro]}}}
{:linters {}}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ out
.bin
nashorn_code_cache
.planck_cache
package.json
.shadow-cljs
build-report.html
cljs-runtime
manifest.edn
22 changes: 12 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,27 @@ sudo: true
addons:
chrome: stable

install:
# install clj
- curl -O https://download.clojure.org/install/linux-install-1.10.1.466.sh
- chmod +x linux-install-1.10.1.466.sh
- sudo ./linux-install-1.10.1.466.sh

# install npm and clojure dependencies (plus start shadow server)
- npm ci
- npm run start

before_script:
# set the version variable
- export WISH_VERSION=$(git rev-parse --short HEAD)

script:
- lein test
- npm run lint && npm test
- scripts/compile-builtin-sources

after_success:
# For some reason, the node_modules used for running the karma tests seems
# to interfere with production build, breaking the SwipeableViews component
# in some way. It's unclear why (maybe cljsbuild is using the wrong version
# of react, or some dependency, that it's pulling from node_modules?) but
# simply deleting node_modules seems to fix it. Since we only use
# node_modules for testing, that seems a reasonable fix
- rm -rf node_modules

# build if on the master branch (in prep for deploy)
- if [ "$TRAVIS_BRANCH" = master ] && [ -z "$TRAVIS_PULL_REQUEST_BRANCH" ]; then lein build || travis_terminate 1; fi
- if [ "$TRAVIS_BRANCH" = master ] && [ -z "$TRAVIS_PULL_REQUEST_BRANCH" ]; then npm run build || travis_terminate 1; fi

cache:
directories:
Expand Down
15 changes: 0 additions & 15 deletions dev/cljs/wish/config.cljs

This file was deleted.

18 changes: 18 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = function (config) {
config.set({
browsers: ['ChromeHeadless'],
// The directory where the output file lives
basePath: 'target',
// The file itself
files: ['ci.js'],
frameworks: ['cljs-test'],
plugins: ['karma-cljs-test', 'karma-chrome-launcher'],
colors: true,
logLevel: config.LOG_INFO,
client: {
args: ["shadow.test.karma.init"],
singleRun: true,
},
});
};

Loading

0 comments on commit ac77d99

Please sign in to comment.