This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-05
Channels
- # bangalore-clj (1)
- # beginners (50)
- # boot (72)
- # cider (53)
- # cljs-dev (303)
- # cljsrn (2)
- # clojure (403)
- # clojure-conj (3)
- # clojure-dev (7)
- # clojure-italy (18)
- # clojure-russia (129)
- # clojure-sg (1)
- # clojure-spec (44)
- # clojure-uk (25)
- # clojurescript (112)
- # core-async (4)
- # core-typed (3)
- # cursive (23)
- # datomic (114)
- # defnpodcast (1)
- # emacs (1)
- # figwheel (2)
- # graphql (18)
- # hoplon (110)
- # instaparse (6)
- # jobs (3)
- # jobs-discuss (10)
- # leiningen (5)
- # luminus (1)
- # lumo (151)
- # off-topic (22)
- # om (3)
- # om-next (3)
- # onyx (4)
- # parinfer (1)
- # pedestal (8)
- # precept (51)
- # re-frame (19)
- # reagent (3)
- # ring (1)
- # ring-swagger (5)
- # spacemacs (21)
- # sql (25)
- # test-check (2)
- # uncomplicate (8)
- # unrepl (33)
- # untangled (20)
- # yada (14)
Hi, I want our UI team to look at ClojureScript. In the interest of time, I am looking for someone who can walk the team through the clojurescript eco system and answer their questions. Currently they are using Ext-js. I want someone who can demonstrate how clojureScript can help where other javaScript approaches may fall-short. I am looking at 4-6 hours of engagement. The team is in India, so, the meetings will be over zoom. I will pay. If anyone is a practicing UI expert with active usage of ClojureScript and (if can give ideas why ClojureScript is better compared to Angular .. or for that matter if Angular or something else is better explain why ). If anyone interested and fits the requirement, please let me know. thanks
@wistb I do not fulfill your requirements as I have never used clojurescript (been trying to find a project that isn't pressing to try it on) but clojurescript compiles to JS so you can use any of the frameworks that are available (unless I am oblivious to an underlying issue with clojurescript and this statement) for example here is a post on using clojurescript with AngularJS 2 - http://deliberate-software.com/cljs-angular2/
@grav thanks. Yeah that sounds sort of like what I was thinking. Seems like server side may be safest still. Hah
@rnagpal if you are still around. reagent lein plugin is amazing! To create a new project, just use lein new reagent myproject +spec +sass
. Then you will need two separe terminals, one with lein run
to run the server the other will run lein figwheel
and run figwheel. Both command will need to be run from the myproject
directory. The server will run at http://localhost:3000 by default
@anmonteiro I had just that problem a few months ago.. nice one
note, it's often better to use #js
(repeated inside nested collections) instead of clj->js
thank you @vbedegi , uhm, can you elaborate more @pesterhazy? I’m new to this
clj->js
is a function that transforms a datastructure at runtime
#js {"a" "b"}
is short for (js-obj "a" "b")
and #js [1 2 3]
is short for (array 1 2 3)
or maybe that's not quite accurate
#js {"a" "b"}
transpiles directly to {"a": "b"}
, so there's no runtime cost
this also means you have to use repeat #js
when nesting data structures, e.g. #js {:foo #js [1 2 3]}
You can even mix a little compile time and runtime, as in
(defn f [x]
#js {:a (inc x)})
Hello all, anyone with the same problem using :npm-deps?
java.io.IOException: Cannot run program "npm": CreateProcess error=2
I did a lein cljsbuild once
the result is
Compiling ClojureScript...
Compiling "resources/public/js/compiled/sta.js" from ["src"]...
[31mCompiling "resources/public/js/compiled/sta.js" failed.[0m
java.io.IOException: Cannot run program "npm": CreateProcess error=2, O sistema nÒo pode encontrar o arquivo especificado
and the smae prompt
npm version
{ sta: '1.0.0',
npm: '3.10.9',
ares: '1.10.1-DEV',
http_parser: '2.7.0',
icu: '57.1',
modules: '48',
node: '6.9.2',
openssl: '1.0.2j',
uv: '1.9.1',
v8: '5.1.281.88',
zlib: '1.2.8' }
I might know what's wrong. I'll work on a patch in the next hour
What´s is the difference from this method :npm-deps from using lein-npm and after using <script src='dependency'>
I´m doing web stuffs, that´s because it´s important, but I´m having problems with using lein-npm and after including it with script, It seems always breaks dependency
like here https://anmonteiro.com/2017/03/requiring-node-js-modules-from-clojurescript-namespaces/ , I did
:npm {:dependencies [[left-pad "1.1.3"]]
:root "resources/public/js"}
in project.clj
ran lein npm install, and use <script type="text/javascript" src="js/node_modules/left-pad/index.js"></script>
I run figwheel and it´s getting
index.js:7 Uncaught ReferenceError: module is not defined
at index.js:7
in browser console@fabrao that’s what I was saying lein npm
just grabs your deps - it doesn’t help you with your build
either you need to build a foreign dep separately with Webpack or you can try :npm-deps
Is it a bug when I changed the clojuscript 1.9.660 to 1.9.671 is getting this WARNING: Use of undeclared Var cljs.js/lib at line 450 resources\public\js\compiled\out\cljs\js.cljs
?
@fabrao this should fix your issue: https://dev.clojure.org/jira/browse/CLJS-2173 /cc @dnolen
another thing to make sure is that you have a package.json
in your project’s directory
Thanks @anmonteiro , so, I have to wait other clojurescript version to use it? Sorry my question, I´m newbe in some things
@fabrao I’d prefer you try the patch once David applies it, following these instructions: https://clojurescript.org/community/building
to make sure everything works before the release
@anmonteiro @fabrao patch applied to master
@anmonteiro other newbe question 🙂 , is that possible to build it on Windows? Or only linux and mac? I only see sh script
good point, I don’t know
I don’t have access to a Windows machine
awesome
@fabrao let me know if :npm-deps
works now
Compiling "resources/public/js/compiled/sta.js" from ["src"]...
Installing Node.js dependencies
events.js:160
throw er; // Unhandled 'error' event
^
hey at least it’s calling NPM now
@fabrao do you have a package.json
in your project’s directory?
you shouldn’t need to
I guess so
what Node.js version are you running?
look at this `Error: Cannot find module 'c:\Trabalho\Cliente\FDABRAO ME\Projetos\Clojure\sta\TrabalhoClienteFDABRAO MEProjetosClojuresta esourcespublicjscompiledoutcljs$node_modules.js' from 'c:\Trabalho\Cliente\FDABRAO ME\Projetos\Clojure\sta'`
fixing
@anmonteiro Your environment has been set up for using Node.js 6.9.2 (x64) and npm.
looking for a UI/clojureScript practicing professional to help our team with 'demo, QA' over 4-6 hours (one hour at a time) of 'online zoom sessions'. Will Pay. If anyone interested , please let me know.
@dnolen one more Windows + NPM deps patch https://dev.clojure.org/jira/browse/CLJS-2174
The new clojure spec in clojure 1.9 throws compile errors now on some old forms of silent invalid syntax. Is there a way to get the same sorts of spec exceptions on ClojureScript code as well?
@eistre we could copy that stuff, the main reason we haven’t done it directly is to not have a hard dep on 1.9
Installing Node.js dependencies
Failed to compile "resources/public/js/compiled/sta.js" in 3.97 seconds.
---- Exception ----
JSON error (end-of-file)
---- Exception Stack Trace ----
java.io.EOFException: JSON error (end-of-file)
I added a question to Stack Exchange Code Review. I want to see how I can clean up my “essay” that retrieves two files asynchronously: https://codereview.stackexchange.com/questions/167414/retrieve-compilation-files-of-smart-contracts-asynchroniously-via-ajax-and-add-t
I would appreciate if someone can take a look and tell me how to improve.
@fabrao is that with just left-pad
?
I’d encourage you try the simplest project first
with a build from master
and report back
then we can go from there
@anmonteiro I did lein new reagent-frontend npm-test
changed the project to include :npm-deps {:left-pad "1.1.3"}
, go to cmd and run lein figwheel
The error is the same
Figwheel: Cleaning build - app
[0mCompiling "public/js/app.js" from ["src" "env/dev/cljs"]...[0m
[31mFailed to compile "public/js/app.js" in 4.431 seconds.[0m
[36m---- Exception ----[0m
[1mJSON error (end-of-file)[0m
[36m---- Exception Stack Trace ----[0m
java.io.EOFException: JSON error (end-of-file)
at clojure.data.json$_read.invokeStatic (json.clj:182)
@anmonteiro it seems that your change affect the result, look that :
node --eval "var path = require('path');\r\nvar mdeps = require('module-deps');\r\nvar nodeResolve = require('resolve');\r\nvar browserResolve = require('browser-resolve');\r\n\r\nvar target = '';\r\nvar filename = path.resolve(__dirname, 'C:\\Trabalho\\Cliente\\FDABRAO ME\\Projetos\\Clojure\\bombom\\public\\js\\out\\cljs$node_modules.js');\r\nvar resolver = target === 'nodejs' ? nodeResolve : browserResolve;\r\n\r\nvar md = mdeps({\r\n resolve: function(id, parent, cb) {\r\n // set the basedir properly so we don't try to resolve requires in the Closure\r\n // Compiler processed `node_modules` folder.\r\n parent.basedir = parent.filename === filename ? __dirname: path.dirname(parent.filename);\r\n\r\n resolver(id, parent, cb);\r\n },\r\n filter: function(id) {\r\n return !nodeResolve.isCore(id);\r\n}});\r\n\r\nvar pkgJsons = [];\r\nvar deps_files = {};\r\n\r\nmd.on('package', function (pkg) {\r\n // we don't want to include the package.json for users' projects\r\n if (/node_modules/.test(pkg.__dirname)) {\r\n var pkgJson = {\r\n file: path.join(pkg.__dirname, 'package.json'),\r\n };\r\n\r\n if (pkg.name != null) {\r\n pkgJson.provides = [ pkg.name ];\r\n }\r\n\r\n if (pkg.main != null) {\r\n pkgJson.main = path.join(pkg.__dirname, pkg.main);\r\n }\r\n\r\n pkgJsons.push(pkgJson);\r\n }\r\n});\r\n\r\nmd.on('file', function(file) {\r\n deps_files[file] = { file: file };\r\n});\r\n\r\nmd.on('end', function() {\r\n for (var i = 0; i < pkgJsons.length; i++) {\r\n var pkgJson = pkgJsons[i];\r\n\r\n if (deps_files[pkgJson.main] != null && pkgJson.provides != null) {\r\n deps_files[pkgJson.main].provides = pkgJson.provides;\r\n }\r\n\r\n deps_files[pkgJson.file] = { file: pkgJson.file };\r\n }\r\n\r\n var values = [];\r\n for (var key in deps_files) {\r\n var dep = deps_files[key];\r\n\r\n if (dep.provides == null && !/node_modules\\/[^/]*?\\/package.json$/.test(dep.file)) {\r\n var match = dep.file.match(/node_modules\\/(.*)\\.js(on)*$/)\r\n\r\n if (match != null){\r\n dep.provides = [ match[1] ];\r\n }\r\n }\r\n\r\n values.push(dep);\r\n }\r\n\r\n process.stdout.write(JSON.stringify(values));\r\n});\r\n\r\nmd.end({\r\n file: filename,\r\n});\r\n\r\nmd.resume();\r\n"
from (cond->> ["node" "--eval" code]
util/windows? (into ["cmd" "/c"]))
I did the change to see the result
(println (str "JSON => " iw))
(next (json/read-str (str iw)))
JSON => (empty)@fabrao what if you execute that snippet in the command line?
does it output anything?
the node --eval
thing
@anmonteiro it seems that there is limit for command length
that’s unfortunate
`SyntaxError: Unexpected end of input at createScript (vm.js:74:10) at Object.runInThisContext (vm.js:116:10) at Object.<anonymous> ([eval]-wrapper:6:22) at Module._compile (module.js:569:30) at evalScript (bootstrap_node.js:432:27) at startup (bootstrap_node.js:139:9) at bootstrap_node.js:575:3`
@anmonteiro writting it to file and run it node code.js ->
if (dep.provides == null && !/node_modules\\/[^/]*?\\/package.json$/.test(dep.file)) {
^
SyntaxError: Unexpected token ^
I think I just fixed that in master
https://github.com/clojure/clojurescript/commit/9b967ee3157747dd401b1ea2f27efb8476dc3c52
@anmonteiro sorry bodering you, but it failed again
@fabrao no problem, I wanna make sure this works on windows