Fork me on GitHub
#clojurescript
<
2016-05-28
>
mathpunk00:05:33

Can I require a node module from Planck?

mfikes00:05:37

@mathpunk: No, but Ramsey Nasser has a Node-based self-hosted CLojureScript REPL that might support that.

pat00:05:48

@mathpunk Planck runs on javascript core, so no. But if you wait a day or so im putting out a equivalent for node

mathpunk00:05:28

ha… everything is changing so rapidly. I’ve just started working in a JavaScript shop, but Clojure is the language I know best

mathpunk00:05:52

I keep being tempted to try and do some work in ClojureScript, but there are many many options for trying to repl up

fasiha00:05:05

@mfikes: I've been following Ramsey's and your back-and-forth on twitter—does his work mean we can run ClojureScript in browser via browserify, etc.?

pat00:05:08

@mfikes this is why I asked you about jars in #planck, was pulling my hair out trying to get andare to work

pat00:05:12

I've ported http://clojure.java.io & reified files, hopefully can unlock cljs for scripting

mfikes00:05:21

@fasiha: Ramsey's created a bootstrapped environment atop Node.js. (I doubt it relates to the browser—but I'm speculating.)

fasiha00:05:05

So Node sits on top of the usual Clojure/Java-based cljs build environment—I see

mfikes00:05:29

@pat: indeed. I had a bit of work to do in order to get Andare running in Replete.

mfikes01:05:10

@fasiha: No. Node.js is V8. No Java.

fasiha01:05:51

@mfikes: Ok, I misunderstood your statement—"bootstrapped" was the critical word there 🙂

pat01:05:39

@fasiha you have to do the initial build on the jvm but from the there the js can compile cljs

pesterhazy11:05:19

@nasser, I have high hopes for cljs on top of node.

pesterhazy11:05:47

not necessarily because I want to write cljs on the server, but to interface with the (gigantic) javascript-based tooling ecosystem

nasser12:05:44

@pesterhazy: exactly. a lot of super interesting environments are node-based, too. like electron and tessel

risto15:05:16

I think there are benefits to using ClojureScript + NodeJS for the backend that often get dismissed

risto15:05:50

Clojure and ClojureScript are very similar, but they aren't entirely the same and some things only work on one end

risto15:05:09

Plus ... Java. So avoiding that is pretty nice

pesterhazy15:05:57

I love java, as long as I can write it through Clojure interop.

risto16:05:59

Yeah I don't have any Java love

wildermuthn16:05:52

@pesterhazy: We’re using ClojureScript with Electron at work, and it’s been terrific using Node with CLJS. The only thing I haven’t figured out is how to use something like reader-conditionals to target either the browser or node. Right now we’re just compiling from a common directory, but would be great to have a reader-conditional like solution. Maybe it already exists!

mathpunk16:05:32

@nasser I tried (cljs.nodejs/require “some-js-module”) and it did not work for me. Is that my mistake or is that feature not ready?

nasser16:05:49

try js/require

nasser16:05:14

but i am actively working on the require stuff, so it may be janky

nasser16:05:30

does some-js-module live in node_modules?

mathpunk16:05:37

yeah, it’s definitely there

mathpunk16:05:41

i’m trying the js/require

mathpunk16:05:05

“Cannot find module” and so forth

nasser16:05:22

which module?

nasser16:05:35

ill try and recreate the condition as well as i can

mathpunk16:05:36

botkit, which is super very a lot new

mathpunk16:05:44

I’ll try with something more mature just to see

nasser16:05:50

i will try botkit

mathpunk16:05:07

express, no go

nasser16:05:20

and this is from the repl, right?

mathpunk16:05:37

that’s right — having installed clojurescript from npm globally, using the cljs command to open up the repl

mathpunk16:05:49

i’ll chedk my version too, i know this is bleeding edge

nasser16:05:01

the repl might be confused about where it lives

nasser16:05:07

and how node modules get looked up

mathpunk16:05:20

I did note that the repl itself will crash if there is no node_modules directory

mathpunk16:05:47

yeah, it is happy for a second and then dumps out

nasser16:05:00

oh thats new

nasser16:05:04

just saw it

nasser16:05:15

oh i see what that is

nasser16:05:21

ok i will push out a fix in a sec

nasser17:05:26

the repl crash, that is

nasser17:05:35

not finding modules is trickier

mathpunk17:05:03

@nasser i’m not a very experience coder but lmk if I can help somehow with diagnosis

pesterhazy17:05:31

Me too, I'm happy to help or contribute

nasser17:05:25

notes here or issues/PRs on the github page are more than welcome

richiardiandrea17:05:20

@wildermuthn: I wish I had a custom reader conditional while developing replumb as well. Unfortunately at the moment there is not clean way to do that...there is a hack using lein (I saw a blog post on that)

nasser18:05:41

@mathpunk: i have a fix in place, specifically tested with botkit, will push out soon!

nasser21:05:44

just pushed out an update that remedies the require bug @mathpunk reported

dnolen22:05:00

cljs.spec implemented in ClojureScript master

ghadi23:05:35

Happy birthday David

richiardiandrea23:05:39

Ah ah really? Happy birthday then! 🍾