This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-24
Channels
- # aleph (3)
- # beginners (17)
- # boot (8)
- # cider (61)
- # cljdoc (13)
- # cljs-dev (2)
- # clojure (66)
- # clojure-boston (1)
- # clojure-italy (4)
- # clojure-nl (7)
- # clojure-russia (7)
- # clojure-spec (19)
- # clojure-uk (80)
- # clojurescript (73)
- # core-async (4)
- # cursive (6)
- # data-science (1)
- # datomic (33)
- # docs (13)
- # emacs (17)
- # figwheel-main (28)
- # fulcro (12)
- # graphql (1)
- # jobs (3)
- # leiningen (4)
- # luminus (1)
- # off-topic (1)
- # parinfer (1)
- # pedestal (46)
- # protorepl (3)
- # re-frame (30)
- # reagent (47)
- # reitit (10)
- # ring (1)
- # shadow-cljs (94)
- # spacemacs (12)
- # specter (16)
- # tools-deps (6)
- # uncomplicate (1)
- # vim (9)
does shadow support .zip files on the classpath? i’m trying to generative-test some really crappy node code from another cljs app. that node code is ultimately bundled into a zip file, and i’m just curious if i have to unzip the file before attempting to run shadow (or if my error is elsewhere)
I was wondering if there is an easy way to have :optimizations
:none
compilation mode but all in one unique file, concatenated. I have a requirement to leave things readable from a JS dev standpoint but I feel checking in :cache-root
is not a clean approach.
@richiardiandrea define "readable". its not like the compiled CLJS code is easily understandable so what do you gain by "readable"?
I know, I think I need to make clear that is never going to be like reason or typescript compiled code...probably the goal is to debug things in the debugger and that's why the requirement is "readable" and one-file
but you have source maps for that? wouldn't you want to know the actual code being used?
I know well...I am trying to understand if it is possible to have an alternative, if not I will just say here that we are going to live with source maps only ;)
you can just do a :simple
build with :compiler-options {:variable-renaming :off :property-renaming :off :pretty-print true}
that should be as close to readable as possible
I don't know either, I will try to explain that too but thanks for having an answer ready for me ;)
@lwhorton .jar
files are basically zip files and yes those are supported but you said "node code" so I'm assuming .js
files? what kind of code are you talking about? https://shadow-cljs.github.io/docs/UsersGuide.html#_the_classpath
it’s a typescript codebase, but i’m transforming the ts -> js and then adding build/the-js-files/
as a src path. after some playing around I found a way to get everything up and running. the only wonky piece was the npm integration. if i have a parent dir /proj
which contains /proj/the-node-code
, compiling the node code and adding it to the proj/shadow-cljs.edn
’s source files config works. however, it looks like the node_modules resolving can’t find the node code’s libraries unless I add them explicitly to /proj/node_modules
. i’ve tried adding the proj/the-node-code/node_modules
also to the source files, but the compiler still cant manage to resolve some import foo from 'some-lib'
dependency in the node code.
I can't really make out what you are saying. you either have classpath js or node_modules. they are handled entirely differently. if you have say src/js/some-folder/converted-from-ts.js
and put src/js
on the :source-paths
you can require it via (:require ["/some-folder/converted-from-ts" :as x])
the converted file itself can import foo from 'some-lib'
as usual assuming that some-lib
is in node_modules
?
basically all "paths" (ie. "/foo/bar"
or "./foo"
or "../foo"
) are assumed to be on the classpath
ill see if i can be more clear:
compile the node code into some /build folder. add that build folder to a parent project’s source files. from a test_runner.cljs file (in the parent), require a file from the /build project (something like ["/build/my-file/file" :as x]
. the file can be found, because it doesn’t complain about resolving /build/my-file/file, but it does throw an error such as cannot import module 'momentjs' from /build/my-file/file
.
please be very clear about the exact paths you are using. otherwise it just gets confusing as hell.
i will get back to you on this, i’m unfortunately knee-deep in another (unrelated) problem. thanks for the quick turnaround time, though
inside your CLJS you then (:require ["/some-unique-enough-name/my-file/file.js" :as x])
cannot import module 'momentjs' from /build/my-file/file
who produces this error? its not a shadow-cljs error? is this a node build?
Can you set custom shadow-cljs configuration options based on the deps.edn alias that is passed in on startup via shadow-cljs -A
(for instance, only load a preload or set a compiler option if a specific alias is passed)? If not, can you extend an existing build configuration?
Basically, I want to opt-in to re-frame-10x in development since it’s slowing things down at times, so at the minimum, enable the re_frame.trace.trace_enabled_QMARK_
closure-define flag if an alias is passed to the dev build
you could use clj-run
and build a function that uses shadow.cljs.devtools.api
to do (shadow/get-build-config :foo)
update that config map and then call (shadow/compile* modified-config {})
@thheller new perf enhancements are quite nice. about a third faster on the initial load
so :node-test
returns 0 even when tests are failing
only if you use :autorun
. instead use compile
and run node the-output.js
. that will preserve the proper exit code
ok cool that should work
is there an env var / switch to enable :autorun
from the command line (it would be super handy)
actually, no
watch should be good enough if it runs the tests
then there could be a --autorun
or --compile-only
depending on which makes more sense
the goal would be to keep :autorun false
in shadow-cljs.edn
but be able to run tests in watch mode
you could set :release {:autorun false}
and then use shadow-cljs release the-tests
. that way they wouldn't autorun
oh, nice
uhm I am doing yarn shadow-cljs release :test && node .cljs-tests/cd-tests.js
but I still have a zero exit code
well, the &&
is after that
Ran 3 tests containing 7 assertions.
2 failures, 1 errors.
arichiardi@EP-LL-10020 ~/git/laputa/continuous-delivery (master *$% u=)$ echo $?
0
{:target :node-test
:main cd.test-runner/-main
:autorun true
:release {:optimizations :simple
:variable-renaming :off
:property-renaming :off
:pretty-print true
:source-map true
:autorun false}
:output-to ".cljs-tests/cd-tests.js"}
maybe the merge has a problem, let me get rid of :autorun true
oh man, sorry
trying:
{:target :node-test
:main cd.test-runner/-main
;; :autorun true
:release {:compiler-options {:optimizations :simple
:variable-renaming :off
:property-renaming :off
:pretty-print true
:source-map true}
:autorun false}
:output-to ".cljs-tests/cd-tests.js"}
https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/test/node.cljs#L9-L11
uhm, still zero
yeah let me get rid of that
I wanted to test only one namespace
but it is unnecessary
yeah so removing the :main
makes it work
still odd the reason why it does not do it though, I can open a low-prio issue if you like
Ok cool thanks for the support 😉
@thheller We are building out a comprehensive collection of boot tasks for shadow-cljs
feedback from any boot users is appreciated
@flyboarder :cache-root
is a global config option and cannot be set per build
@thheller thanks! cache disabled!