This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-19
Channels
- # admin-announcements (2)
- # beginners (25)
- # boot (93)
- # cider (2)
- # clara (2)
- # cljs-dev (63)
- # cljsjs (3)
- # cljsrn (38)
- # clojure (142)
- # clojure-austin (1)
- # clojure-brasil (2)
- # clojure-czech (1)
- # clojure-dev (7)
- # clojure-greece (1)
- # clojure-russia (170)
- # clojure-spec (11)
- # clojure-uk (65)
- # clojurescript (46)
- # clojurex (1)
- # code-reviews (3)
- # cursive (11)
- # datomic (35)
- # euroclojure (6)
- # events (2)
- # flambo (2)
- # hoplon (115)
- # instaparse (11)
- # jobs (21)
- # jobs-rus (3)
- # lambdaisland (2)
- # off-topic (17)
- # om (35)
- # onyx (161)
- # planck (1)
- # protorepl (7)
- # random (1)
- # re-frame (31)
- # reagent (19)
- # ring-swagger (21)
- # rum (5)
- # spacemacs (3)
- # specter (25)
- # test-check (20)
- # testing (7)
- # untangled (2)
- # yada (50)
wouldn't nashorn work for this sort of thing as well?
autoprefixer is fairly dependent on Node.js, I could browserify it and run it through nashorn. But I'm going for a general solution to all the great npm ecosystem.
I think it has an in-browser version, which doesn't touch the FS. But things which aren't so usable elsewhere is harder.
it'd be exciting to tap all the node-based tooling inside boot
although I guess you can shell out to node
even now
I don't like that much as a solution. My ultimate goal is to have npm modules via webjars, and be completely independent of tools installed on the host.
only good things can come out of experiments like that
I theorize that you could have a task which downloads the latest npm, and runs that inside J2V8 to download all your dependencies for you (outside of webjars). That wouldn't leave the platform then.
i wish https://github.com/nodyn/nodyn was still a thing
unfortunately it's built on dynjs, not nashorn
and appears abandoned. i looked at it recently as a way to get our node ad server on the jvm
nodyn, j2v8 looks alive
j2v8 looks cool but our goal is to leave node
it's missing lots of things that the jvm has that will help us run our ad servers much more efficiently
also the profiling and debugging tools don't hold a candle to jvm stuff
well, it was an option i was exploring
J2V8 makes sense then in my opinion. You can dump the codebase into J2V8. Then start replacing a few of the callbacks, and over time rewrite large parts in JVM.
This is interesting (for my problem) https://github.com/dynjs/dynjs/blob/d89b684c317f5668cb5e982aade35ec39b235599/src/main/java/org/dynjs/runtime/builtins/Require.java They implement their own require, so it can be classpath aware. J2V8 is only aware of file paths, because it uses the built-in require. For better or worse.
that's great, that's a major problem with node, the file orientation
Yeah, J2V8 suggests doing java.io.File/createTempFile
for a lot of things to get round this.
I've opened an issue on J2V8, but I'm not hopeful it will be resolved. A shame really. I like my idea of running npm inside J2V8 to create the necessary files.
where did you see that it can't run npm?
because maybe you can do it in 2 steps
Well, it can't require npm modules from webjars, because it can't handle non-files (as they're on the classpath)
not anything concrete, just thinking about how you might be able to run npm first and have it output to temp dir. then run 2nd program, aiming it at temp dir
Ah, yep. But I can't guarantee the environments running this will have npm installed.
@dominicm: You may just be better off writing an npm task that duplicates the behaviour instead of running npm itself
I mean cljs has better dependency resolution anyway imho
@flyboarder: you mean using the npm http Api?
@dominicm: yeah, I havnt looked at it before but my experience with getting node apps to work mostly includes rewriting
I rewrote the polymer vulcanize tool as a boot task and it doesnt have any of the issues the original app has
you could also use the boot-npm task, which installs npm if itโs missing
@dominicm: yeah new feature I put in last week, my idea is that as a developer you shouldnt need care about the env that boot runs in, the tasks should construct everything you need, so if you use the bower
task it will make sure bower is there without you needing to install it.
@flyboarder: I don't see the code to do that?
@dominicm: as you are correct the npm task itself needs npm installed, I can fix that, the exec wrapper is here: https://github.com/degree9/boot-npm/blob/master/src/degree9/boot_npm.clj#L34-L53
@dominicm: Maybe a homebrew task or download the binary
Hmm. Not super localized. You might be able to install npm into node modules dir... but you still need node
@dominicm: yeah you can update npm with npm, but it needs it installed first, looks like the binary option will work tho
@micha does boot have a way to get the host platform?
@dominicm: thats a good question, looking at the node.js binary package it has npm in it but npm is just a node module, so maybe?
There is also a unix exec in the folder maybe we can just pull that out, trying it now ๐
doubtful
since itโs only affecting the local node_modules and only if they dont already have it installed
right, ill pull the npm binary into the node_modules folder as if it was installed locally with npm itself, then check this location just like the other node modules, node.js would get discarded as we only care about npm itself, but thats only if this unix exec will work without node installed
yeah testing the binary right now, gonna remove nodejs first so I know itโs not causing issues
@flyboarder yes, you can look at boot.App.isWindows()
method: https://github.com/boot-clj/boot/blob/master/boot/base/src/main/java/boot/App.java#L85-L87
@micha anyway we can get an env var with the current platform? I think this will make a difference as boot becomes more cross platform, right now I dont know if Im on OS X or Linux
ah yeah ok so just do the same thing as that function, awesome!
i think that function might have a potential bug, i'm not exactly sure about using toLowerCase()
and locales
@dominicm: yeah npm does indeed require node, which I think will be fine in this case since it will be a local version and only fetched if npm is not already installed
@micha From our previous discussion: clojure-alpha11 allows you to control if a map prints out with the namespace map syntax (http://dev.clojure.org/jira/browse/CLJ-1993). Also, still haven't had time to look into adding the update-file ability to sift
๐ . I think I'll have some time this weekend though ๐
also, it defaults to false (but true in the repl), so if you had issues from boot with this, they might actually be gone (but Iโm assuming things)
Latest Clojure alpha release already found a bug in boot lein-generate
(https://github.com/boot-clj/boot/wiki/For-Cursive-Users) ๐ Fixed in wiki