Question: is a server running?

Asked By
thheller
Asked At
2017-12-21 16:34:49

Found 15 possible answers.

User Answered At Possible Answer
jiyinyiyong 2017-12-21 16:35:04 no server turned out not a good idea to start watch server from a scriptd
thheller 2017-12-21 16:35:55 you can do that no problem
jiyinyiyong 2017-12-21 16:37:30 what's the right code to start a watch server in Clojure code?
thheller 2017-12-21 16:37:47 (api/watch :browser) I did not expect anything to run watch via clj-run but watch needs the embedded server so the issue is that clj-run only does a with-runtime which is a lightweight runtime that doesn’t start the embedded server hang on. I think I found the issue.
jiyinyiyong 2017-12-21 16:47:21 a worker?
thheller 2017-12-21 16:47:30 I think I’ll change it so it just launches the full runtime instead what are you trying to do exactly that shadow-cljs watch the-build doesn’t do? not what you want so it starts, compiles once and then just exits that background thread does not keep the process itself running the issue with watch is that it starts a background thread
jiyinyiyong 2017-12-21 16:53:46 just exploring, never tried it before if that feels better, maybe I would rely on npm scripts less
thheller 2017-12-21 16:54:40 I can make it work easily but it does require you managing threads which is not very fun these or which npm scripts are we talking about?
    "build": "yarn del && yarn release && yarn compile-ssr && yarn html"
    "html": "node target/ssr.js && cp entry/manifest.json dist/",
    "compile-ssr": "shadow-cljs compile ssr",
    "release": "shadow-cljs release browser",
"del": "rm -rf dist/*",
jiyinyiyong 2017-12-21 16:57:22 never mind, actually I would use shadow-cljs command line, if launching it from Clojure is not better.
thheller 2017-12-21 16:57:44 I’m trying to help you here but I first need to understand what you are doing there are several things I can do … just need to figure out which makes the most sense
jiyinyiyong 2017-12-21 16:58:13 these lines does not include watching part, they are for releasing. I added this script, and it does run faster than my previous version
  (println (sh "cp" "entry/manifest.json" "dist/")))
  (println (sh "node" "target/ssr.js"))
  (api/with-runtime (api/compile :ssr))
  (api/with-runtime (api/release :browser))
  (println (sh "rm" "-rf" "dist/*"))
(defn -main []
            [clojure.java.shell :refer [sh]]))
            [shadow.cljs.devtools.server :as server]
  (:require [shadow.cljs.devtools.api :as api]
(ns build.release
thheller 2017-12-21 16:58:47 please stop doing a new ns for everything (ns app.build) (defn release [] ...) (defn watch [] ...)
jiyinyiyong 2017-12-21 16:59:30 will merge them into one file later...
thheller 2017-12-21 16:59:30 you can invoke functions directly with clj-run , makes things much easier to organize imho ok so the build.release works with clj-run right?
jiyinyiyong 2017-12-21 17:00:03 it's a feature from shadow-cljs, I didn't see clj calls a specific function from CLI

Related Questions