Fork me on GitHub
#clojurescript
<
2017-08-29
>
fdserr02:08:20

Hi guys. Looking for a predicate to check for native fn vs cljs fn.

(fn? console.log)
=> true
(ifn? console.log)
=> true ;;would love a false here
TIA

rgdelato04:08:25

Are there any existing efforts to generate static sites using CLJS? I guess I'm thinking something like Gatsby which uses React, but generates static snapshots

thheller07:08:53

@fdserr CLJS fns are native fns so there is no way to check

fdserr09:08:12

@thheller thanks Thomas 🙈

mattbishop13:08:42

Is js/require being replaced with :npm-deps?

dnolen14:08:22

@mattbishop :npm-deps is primarily about browser stuff, that is, consuming node_modules for browser usage

dnolen14:08:45

we did extend it to work for :nodejs target since it was trivial

juhoteperi14:08:50

Hmh, we need proper documentation about differences of Node modules indexing, and requires, :npm-deps and Module processing 🙂

mattbishop14:08:35

Ah that's why all the commentary on running deps through closure with :npm-deps

juhoteperi14:08:13

:npm-deps is only about automatically installing defined Node packages when running ClojureScript compiler

juhoteperi14:08:55

Separate to that ClojureScript will index node_modules dir and use the information with module processing and requires

juhoteperi14:08:37

When :target is :nodejs, :require [react] will emit JS code to call require("react") if React is available in node_modules

juhoteperi14:08:49

If target is something else, the JS code is passed to Closure for module processing

mattbishop14:08:23

I'm using yarn to manage my node deps, and I like how it does that. Is :npm-deps meant to take that responsibility for cljs?

mattbishop14:08:42

If not do I need to double-declare in both package.json and project.clj?

juhoteperi14:08:01

Using :npm-deps is optional, you can as well use npm or yarn to install the packages.

mattbishop14:08:27

Is there any advantage to using both yarn and npm-deps for a node project?

mattbishop14:08:00

:thumbsup: thanks for your time.

juhoteperi14:08:28

The compiler only looks at node_modules dir and doesn't care how the packages have been installed there

genekim15:08:25

Thx for all the guidance @dnolen, @dimovich @anmonteiro … I spent a couple of hours on it yesterday, mostly chasing my tail… Some notes… - after hours of trying, I couldn’t get :global-exports to work — always got a “namespace” not found… (in hindsight, I wonder if I had put it in the wrong build section in project.clj. I’ll try it again later) - ended up going down the :exports route, which worked — I’ll post it in a gist… I have some aspirations to turning it into a cljsjs module for twiter.text - I admit that I spent hours (unsuccessfully) trying to get a cljsbuild once min build going on Heroku… I think I’ve dreadfully screwed up my lein project.clj file But still, I’m elated that I got a CLJS client production build working yesterday! (at least, on my laptop. 🙂

genekim15:08:17

PS: does anyone have a favorite project.clj that they use for Heroku that does the cljsbuild once min build step correctly?

genekim15:08:46

…and thanks @mfikes , too!

iku00088816:08:46

I gave a talk about ClojureScript w/r to node at a JavaScript user group out of pure impulse seeing all the great things happening recently. Slides: https://www.slideshare.net/IkuruKanuma/clojurescriptnode

dnolen16:08:51

@iku000888 very cool! thanks for sharing

dnolen16:08:37

wasn’t familiar with calvin - will look into that later

iku00088816:08:08

@dnolen Your kind words made my day 🙂 Going to brag about this to my wife 🙂

petterik17:08:57

Figwheel reloads get significantly slowed down when using node_modules deps (with :npm-deps). Setting :install-deps false helped a little (I think), is there anything else that might help? Is there a compiler flag I can enable to figure out why it's slow? Using clojurescript "1.9.908" and lein-figwheel "0.5.13"

anmonteiro17:08:03

@petterik might just be because we’re processing all your node dependencies through Closure on every reload

anmonteiro17:08:46

feel free to open a JIRA ticket, we could probably employ a caching strategy somewhere

petterik17:08:33

@anmonteiro sounds good! I'll create a ticket

stbgz19:08:50

hey @dnolen yeah you can find calvin-cljs here https://github.com/eginez/calvin, happy to hear suggestions on how to make it better

stbgz19:08:26

which I have been thinking to port to the new tools-dep and make it a true provider

urbank19:08:32

Does anyone here have much experience with dealing with huge js objectjs in clojurescript (specifically as react props). We need a spreadsheet component, and while I'm in favor of creating our own with clojurescript and adding advanced features incrementally, there are other (valid) opinions. However, using an existing spreadsheet component means passing the spreadsheet data as a js object. I suppose I could use js->clj, edit the data and back js with clj->js, but that seems very inefficient.

dnolen19:08:54

I would just leave that data as js data - just avoid marshaling

dnolen19:08:12

manipulating JS values really isn’t much trouble

noisesmith19:08:55

goog.object helps there for sure

urbank19:08:11

Ok, I'll see where it goes

petterik21:08:08

Has anyone gotten React 16 to work with :npm-deps? The React 15.x verions doesn't work with :advanced optimizations because of https://github.com/facebook/react/issues/8887 .. unless someone has a workaround?

anmonteiro21:08:38

@petterik that’s fixed in master

anmonteiro21:08:19

not sure about advanced, but the error you’re seeing is definitely fixed

petterik21:08:03

@anmonteiro clojurescript master?

petterik21:08:07

Thanks btw 🙂

dnolen21:08:03

@petterik re: your perf thing - you should add :verbose true :compiler-stats true to see where time is getting spent