This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-19
Channels
- # announcements (1)
- # architecture (24)
- # beginners (7)
- # boot (7)
- # cider (1)
- # cljdoc (4)
- # clojure (20)
- # clojure-austin (1)
- # clojure-brasil (2)
- # clojure-dev (1)
- # clojure-italy (1)
- # clojure-spec (36)
- # clojure-uk (11)
- # clojurescript (44)
- # data-science (3)
- # datascript (1)
- # datomic (8)
- # figwheel-main (2)
- # fulcro (29)
- # graphql (9)
- # kaocha (2)
- # keyboards (1)
- # leiningen (3)
- # lumo (5)
- # nrepl (4)
- # off-topic (39)
- # onyx (5)
- # re-frame (2)
- # shadow-cljs (42)
- # tools-deps (18)
- # yada (65)
I have a shadow-cljs server running which I’d like to use for both development and release. Can I do something like
BACKEND=localhost npx shadow-cljs start
# from repl: (shadow.cljs.devtools.api/watch :my-app)
# do some development ... then release:
BACKEND= npx shadow-cljs release my-app
that is, setting the environment differently for dev and release, given the same server?
I know there’s --force-spawn
but in my case I have several builds, so reusing the server would be of great benefit
@grav no. that is why I do not recommend using environment variables at all. you can however use the REPL to modify your build config however you want
(defn my-release []
(-> (api/get-build-config :your-build)
(assoc-in [:closure-defines '] "foo.bar")
(api/release* {})))
be careful when using it at the REPL though. this returns the entire build state and will blow up your REPL if it tries to print that since it fairly large
@grav there is also https://shadow-cljs.github.io/docs/UsersGuide.html#_release_specific_vs_development_configuration
so just :release {:closure-defines {your.backend/url "foo.bar"}}
will take care of everything
Ah, that also looks interesting. I need to share the values with the rest of my home-made setup, so I’ll probably be using environment variables (`#shadow/env`) at least for the release part. Or I’ll make the rest of my tooling integrate with the shadow-cljs.edn
file and let that be the source of truth
the most flexible is just using run
with a custom release function as you can make any edit you want. environment variables always seem very brittle to me so I don't use them ever
actually I recommend passing variables such as your at runtime rather than build time
easier to adjust and everything uses the same build. no need to recompile to change backend url (good when you have multiple environments)
they certainly are. I have a lot of bash scripts interacting with the aws cli
. porting those to cljs would be an option, but the aws apis are often more tedious than the cli.
well, a lot of options to evaluate 🙂 in any case, it’s cool how flexible shadow-cljs is!
do you have any good stories about integrating with AWS Lambda? Currently I’m using serverless together with a cljs-plugin that supports Lumo, but it’s pretty slow
no, not currently. I hope to get the clorurists together funding to better document and enhance support for those
Ok. I see there’s already a GH issue about supporting Shadow-cljs. https://github.com/nervous-systems/serverless-cljs-plugin/issues/15
https://github.com/thheller/shadow-cljs/commit/0b7b22855be0f2272e3b8e90fdf4e2f4e2a637f7
Oh that’s pretty interesting. Maybe now
could be an option for my use-case. I’ll have to look into that.
still running here https://demo-now-7n7jyrfcg.now.sh/
pretty smooth overall. I'm still thinking about creating a custom builder for their platform so that you don't have to compile locally at all
Sure. I’m building on an AWS Fargate instance currently which just has a copy of my local setup and checks out the source. Pretty generic
But of course, leaving even that to http://zeit.co would be a lot easier.
here is one setup using travis to build and push to zeit from there https://github.com/jntn/haiku/blob/master/.travis.yml