Fork me on GitHub
#shadow-cljs
<
2018-02-12
>
Jon02:02:13

finished a prototype last night of sending code from my editor to developing webpage, https://www.youtube.com/watch?v=lOdUfa7TfW0

thheller09:02:20

@jiyinyiyong two things: can you please post you target/shadow-cljs/logging.properties? the warning you see on startup is NOT normal. Also please dont use the from-remote call, it is not part of any public API and may change at any time. Just call (shadow.cljs.devtools.api/repl :build-id) instead.

Jon15:02:13

the file path it still old, coworkflow has been renamed to calcit-workflow for some weeks.

Jon15:02:33

fixing by hand..(actually removed...)

Jon15:02:46

no error now~

thheller15:02:37

ah ok. I moved it to a relative path a while ago so that shouldn't happen again

Jon15:02:15

yeah, I saw that 🙂

thheller09:02:37

also your startup time seems excessively slow? you are probably out of memory and swapping right? maybe setting :jvm-opts ["-Xmx521M"] helps a little?

Jon10:02:22

CPU in Mac 12 inch is slow. It is obviously faster when I run shadow-cljs in Macbook Pro.

thheller10:02:17

it still seems very slow. just thinking that it might be using too much memory and start swapping

thheller10:02:26

very likely to happen if you only have 4GB or so

Jon10:02:26

is (shadow.cljs.devtools.api/repl :build-id) doing the same thing like from-remote?

thheller10:02:02

no, but that is the point. from-remote does stuff you don't need.

Jon10:02:33

> 1.2GHz dual-core 7th-generation Intel Core m3 processor Turbo Boost up to 3.0GHz 8GB 1866MHz LPDDR3 memory 256GB SSD storage1

thheller10:02:55

hmm guess that is a realyl slow CPU then 😛

Jon10:02:13

not with that device currently... looks it's 8G,

Jon10:02:36

really really slow CPU... I bought it because of the light weight.

Jon10:02:23

will do after I get home.

pepe11:02:05

Hi, may I ask how to get some other than js files from npm package in the build? In this case css from material-components-web package. I searched the User Guide and web generally, but haven't found anything.

pepe11:02:43

I can just copy it to public folder, but maybe there is some better way?

thheller11:02:50

currently shadow-cljs doesn't provide anything to build css

pepe11:02:09

well I thought something like boot sifting

thheller11:02:10

so you either need to copy manually or use a tool to do it for you

pepe11:02:23

Ok, thank you

thheller11:02:46

I eventually want to build something for css but nothing available yet

pepe11:02:00

Cause today I spent such a horrible morning with cljsjs and externs problem in production build, I have to move to shadows ASAP 😉

Jon15:02:21

just moved my build script into a .clj file, from package.json https://github.com/mvc-works/calcit-workflow/blob/master/cli/build/main.clj

Jon15:02:01

but I still too call yarn build as an alias for shadow-cljs run-cljs build.main/build.. the later is quite long.

Jon15:02:37

possible to call that piece of code in a shorter form?

thheller15:02:24

shorter form no

Jon15:02:39

😄

Jon15:02:08

thought about adding #!shadow-cljs for a while.

Jon15:02:16

if there's some improvements on clj tool, I would try to switch.

thheller15:02:51

why would you switch?

Jon15:02:19

calling clj cli/build.clj is shorter.

Jon15:02:20

and when I want to run some bash scripts from clj, I don't have to initialize shadow-cljs before running it.(although calling Bash scripts from Clojure is kind of slow.)

thheller16:02:35

I personally dislike the running of scripts but I can add an option for that if you like

thheller16:02:54

if you put things in proper namespaces you can run everything from the REPL

thheller16:02:09

scripts are kinda annoying to use imho

Jon16:02:12

I used npm scripts for long time, typing yarn build yarn html is really smooth.

thheller16:02:25

I meant cli/build.clj as "script"

Jon16:02:55

tried clj again... not feeling very good still.

Jon16:02:24

it's slow. only benefit is clj -m build.release is short to type in.

thheller16:02:54

easy fix alias x="shadow-cljs run-clj"

thheller16:02:01

x build.release

Jon16:02:57

what did you mean by REPL?

Jon16:02:22

=>> yarn shadow-cljs clj-repl
yarn run v1.3.2
$ /Users/chen/repo/mvc-works/calcit-workflow/node_modules/.bin/shadow-cljs clj-repl
shadow-cljs - config: /Users/chen/repo/mvc-works/calcit-workflow/shadow-cljs.edn version: 2.1.6
shadow-cljs - starting ...
shadow-cljs - HTTP server for ":browser" available at 
shadow-cljs - server running at 
shadow-cljs - socket repl running at localhost:5900
shadow-cljs - REPL - see (help), :repl/quit to exit
[1:0]~shadow.user=> (require '[build.main :as b])
nil
[1:0]~shadow.user=> (b/build)
{:exit 0, :out , :err }
[:browser] Compiling ...

Jon16:02:53

I actually feel better using a REPL.

schnipseljagd17:02:29

shadow-cljs node-repl
shadow-cljs - config: /home/joscha/src/realtime-playground/backend/shadow-cljs.edn version: 2.1.6
shadow-cljs - running: lein run -m shadow.cljs.devtools.cli --npm node-repl
Feb 12, 2018 6:17:05 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.3.8.Final
Feb 12, 2018 6:17:05 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.3.8.Final
shadow-cljs - server running at 
shadow-cljs - starting node-repl
[:node-repl] Configuring build.
[:node-repl] Compiling ...
[:node-repl] Build completed. (39 files, 1 compiled, 0 warnings, 1.96s)
[0:0]~cljs.user=> fs.js:642
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '/home/joscha/src/realtime-playground/backend/shadow-cljs/builds/node-repl/dev/out/cljs-runtime/goog.debug.error.js'
    at Error (native)
    at Object.fs.openSync (fs.js:642:18)
    at Object.fs.readFileSync (fs.js:510:33)
    at global.SHADOW_IMPORT ([stdin]:44:15)
    at [stdin]:3003:1
    at [stdin]:3042:3
    at ContextifyScript.Script.runInThisContext (vm.js:25:33)
    at Object.runInThisContext (vm.js:97:38)
    at Object.<anonymous> ([stdin]-wrapper:6:22)
    at Module._compile (module.js:570:32)
When trying to run the node-repl in my setup I get this error. My build config is the following:
{:aws-lambda {:id               :aws-lambda
                       :target           :node-script
                       :output-to        "target/backend/backend.js"
                       :main             backend.core/main
                       :optimizations    :none
                       :language-in      :ecmascript5}}
What I noticed is that the backend/shadow-cljs/builds/node-repl/dev/out/cljs-runtime/goog.debug.error.js seems to be missing the target dir. Any hints for me?

thheller17:02:30

@schnipseljagd oops. there is a bug in the resolve code

thheller17:02:05

looking into it

thheller17:02:09

the node process for the repl is started by basically doing cat target/shadow-node-repl.js | node and that filename gets lost in the process

thheller17:02:28

so node will resolve relative to the process root which is incorrect

thheller17:02:25

that broke when I moved to relative paths in 2.1

thheller17:02:53

can't remember why I don't just call node target/shadow-node-repl.js

thheller18:02:14

just released 2.1.7. I also upgraded the Closure Compiler version which may break stuff. Please let me know if you run into any issues. I did some testing and all appears to be working correctly but its really hard writing automated tests for this stuff so I may have missed some stuff.

thheller18:02:32

@schnipseljagd 2.1.7 also fixes the node-repl

schnipseljagd18:02:39

Thx a lot. I am going to verify it.

schnipseljagd19:02:42

Looks good to me 🙂