Fork me on GitHub
#portal
<
2021-11-19
>
mschmele18:11:36

I'm working on getting an easy automatic portal startup configuration for the rest of my team and I have something that pops up a portal instance with one problem: the def and namespace alias aren't working. I'm able to tap> values to it, but I'd like to try to resolve my issue before I consider it ready for public consumption. For context: this is going in ~/.lein/profiles.clj

{:user {:dependencies [[djblue/portal "0.18.0"]]
        :injections [(require '[portal.api :as p])]
        :repl-options {:welcome (do 
                                  (def p (portal.api/open))
                                  (add-tap #'portal.api/submit))}}}

mschmele18:11:25

I've found that this combination of injections and repl-options seems to work. Is it a no-no to put a do inside of the :welcome block?

mschmele18:11:47

Would simply moving the require into that :welcome block do the trick?

seancorfield18:11:32

That seems reasonable to me @mschmele but I tend to use requiring-resolve these days so I don't need a separate require.

🙏 1
mschmele18:11:06

ooh I'll look into that, thanks!

seancorfield18:11:12

:repl-options {:welcome (do (def p ((requiring-resolve 'portal.api/open))) (add-tap (requiring-resolve 'portal.api/submit)))}

mschmele18:11:46

oh wow even better - thank you!

mschmele18:11:49

I'll give this a shot

seancorfield18:11:06

My Clover/VS Code customizations, with the code to start Portal inside VS Code, via a hotkey: https://github.com/seancorfield/vscode-clover-setup/blob/develop/config.cljs#L256-L281 (just for reference -- might give you more ideas).

mschmele18:11:41

oooooh thank you again