This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-14
Channels
- # aleph (16)
- # bangalore-clj (4)
- # beginners (19)
- # boot (27)
- # cider (81)
- # clara (2)
- # cljs-dev (343)
- # cljsrn (97)
- # clojure (224)
- # clojure-hk (1)
- # clojure-italy (25)
- # clojure-russia (5)
- # clojure-serbia (2)
- # clojure-spec (7)
- # clojure-uk (27)
- # clojurescript (97)
- # cursive (8)
- # datomic (48)
- # docker (1)
- # emacs (15)
- # hoplon (39)
- # jobs (4)
- # lumo (13)
- # off-topic (2)
- # om (66)
- # onyx (7)
- # parinfer (5)
- # pedestal (2)
- # play-clj (10)
- # protorepl (2)
- # quil (1)
- # re-frame (38)
- # reagent (33)
- # spacemacs (1)
- # specter (4)
- # sql (19)
- # test-check (31)
- # unrepl (4)
- # untangled (3)
hey guys, I did some work with @drapanjanas to improve the dev experience of re-natal
. We introduced a new command infer-components
to avoid having to manually lookup the components that you just introduced in your source code. It is a simple improvement but hopefully a useful one ๐
The command is available on the latest re-natal v0.5.0
@carocad nice! how does that work? Is it a replacement for use-component
?
as a side note, use-component
is not a great name for the task, given that it can (must!) be used for npm dependencies that aren't react components at all, like moment.js
@pesterhazy yes. It is intended to replace it. It scans all cljs files and extracts js/require statements from it
interesting!
will it still be possible to hook things up manually?
currently it is not possible but it should be straight forward to introduce a flag for custom requires. It is a simple regex that we run ๐
I think that would be good
also I imagine a regex is not foolproof (imaging you have a js/require in a comment) so it would be great if it was possible to override it
or switch to updating .re-natal
manually as we do currently
@pesterhazy yes that's correct. That is the reason why currently both use-component and infer-component coexists. We couldnt find a one solution fits all so we decided to go with both ways and test it out.
sounds good to me
infer-components
also informs you of the diff of components so that you are aware if something was added that shouldnt
@drapanjanas did you fix the problems with reagent 0.7.0?
No not yet, will try that this weekend
ok cool, happy to help debug issues
You mentioned additional lib required, but i thouht it should be a transitive dependecy of reagent, but i need to have closer look
well in cljsrn-land we get our react from npm, no? so I think we should take https://www.npmjs.com/package/create-react-class from npm too
we'd also need a substitute namespace for cljsjs/create-react-class
or do you think it's possible to take create-react-class from cljsjs and it'll just pick up the existing js/window.React?
@pesterhazy is this related to an error saying react module should be required before createClass
? I just updated my dependencies and now my app is broken ๐
quite possible
in my experience all re-natal stack traces point to the figwheel-bridge so that's probably not it
what did you change?
did you upgrade reagent to 0.7.0?
if yes that's probably the culprit. I'd start by downgrading that to verify the hypothesis
@pesterhazy as always you were right ๐ genious !
just in case it might be useful to somebody. The following dependencies work together on my project:
[org.clojure/clojure "1.9.0-alpha17"]
[org.clojure/clojurescript "1.9.671"]
[reagent "0.6.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server]]
[re-frame "0.9.4"]]
:plugins [[lein-cljsbuild "1.1.6"]
0.6.2 should work as well
nonetheless we should look into the reagent 0.7.0 problems
well from the way you say it, it seems as it is a known problem. Do you know what is it? or is there already a proposal of how to fix it? I am happy to help with testing if you need ๐
if you create an issue (on re-natal or reagent) with a minimal repro, I'll take a look
btw there createClasss thing is mentioned on the reagent changelog. Have you seen that?
it explicitedly mentions having to deal with createClass but since I am not so familiar with the figwheel-bridge I dont know exactly where to poke
i think what you'll need to do is 1. add create-class to package.json and 2. add a shim namspace to prevent this from being loaded via cljsjs and 3. make sure reagent finds the right create-class
but not 100% that's the best way to go
@drapanjanas I just ran re-natal init foo
and the project.clj now contains #_($PLATFORM_CLEAN$)
DEV_PROFILES and similars. Is this intended? or is this a bug?
i have that in mine too and was wondering what that was about
It is intended, these tags are used in feature to add windows platforms
You can clean those if you will not add windows platform for your app
re-natal add-platform
uses that
To add new build configs using regex
btw, not sure if you intended this to happen but in my project.clj the #_($DEV_PROFILES$
closes over the compled :prod
profile and :repl-options
. Probably due to parinfer
changing the closing parenthesis
I noticed that too, parinfer seem to have trouble with those- i removed those in my build
wouldnt it be better if you put those both DEV_PROFILE and PROD_PROFILE as comments? that way parinfer wouldnt mess those up
Yes, that might work too
@pesterhazy you can find a reproducible step by step issue with some extra information here: https://github.com/drapanjanas/re-natal/issues/122
@carocad I've attached a patch, can you see if it works for you?
@pesterhazy do I need to run npm install on create-react-class
?
good question - AFAICT it's a dependency of react-native 46 so it should be installed by default
as to whether it'l stay that way, not sure
@pesterhazy it works ๐
@pesterhazy @carocad thanks just bumped reagent in re-natal, it works ๐
Is it worth documenting the min react version?
Not sure how often people update their re-natal
what about advanced build? Iโd like to add lein advanced-build
in addition to lein prod-build
which will stay as is
Yes, need to think about it before releasing
Sounds like a good idea to me!
We'll need externs in that case
Or is that taken care of by the recent cljs compiler changes?
I agree that adv compilation is more interesting now that mfikes reported faster startup times
and I heard it works-around some packager problems
for what is worth I am using cljs 1.9.671 with infer-externs and warn-on-infer. I havent done an advance compilation yet though. I will let you know once I have some data
Secondarily, it would be nice to be able to use :npm-deps
so we can move stuff into the ns
forms
It would be nice to have a CI job that runs an app on iOS
Circle CI offered that, I thought https://circleci.com/docs/1.0/ios-builds-on-os-x/
Yeah we do that, circle works well for that
I meant it would be cool to have a job that verifies re-natal
I agree, now I test it manually..
but never did that, so need to understand how
I can help set it up if that's helpful
sure!
is it in github do you need some rights?
@mfikes did not quite understand about the adding React in :advanced
.
So @drapanjanas my speculation is that we are not passing the React JavaScript through Google Closure when we set the ClojureScrpt compiler to be in :advanced
mode.
yes, React and ReactNative is outside of our compilation totally
if it would be possible to add those, need to remove the same from bundle produced by packager
If we can get things to instead flow through :npm-deps
then we could get Closure DCE, etc.. But the React Native package manager makes for a challenge
We just need Antรณnio Monteiro to get sucked into building a React Native app, and I bet he will figure out good stuff ๐
true ๐
@carocad No, because I did not get very far at all. Just try adding React to :npm-deps
following the stuff here https://anmonteiro.com/2017/03/requiring-node-js-modules-from-clojurescript-namespaces/
@mfikes interesting. I was trying a different approach. I tried using haul
to avoid the rn packager and get it to recognize goog.require statements. I failed though since haul doesnt transpile source files. I am trying to wrap my head around this post to see I can use it to make it work: https://clojurescript.org/guides/javascript-modules