This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-22
Channels
- # beginners (104)
- # bitcoin (1)
- # boot (5)
- # clara (3)
- # cljs-dev (14)
- # cljsjs (5)
- # cljsrn (1)
- # clojure (242)
- # clojure-italy (17)
- # clojure-news (13)
- # clojure-norway (3)
- # clojure-russia (101)
- # clojure-spec (41)
- # clojure-uk (87)
- # clojurescript (38)
- # core-async (38)
- # cursive (6)
- # datomic (11)
- # defnpodcast (3)
- # docs (14)
- # editors (8)
- # events (1)
- # fulcro (7)
- # hoplon (25)
- # leiningen (4)
- # luminus (7)
- # off-topic (25)
- # onyx (1)
- # portkey (14)
- # random (1)
- # re-frame (7)
- # reagent (4)
- # rum (4)
- # schema (8)
- # shadow-cljs (257)
- # spacemacs (10)
- # specter (4)
- # unrepl (3)
- # yada (1)
in any case we should agree on a standard first, just dumping stuff whereever just isn’t going to work
but I don’t have the brain capacity to think about this now, too busy trying to work out the JS dependency stuff
in fact all of js is making be so angry, why can’t they all agree on one way to do things …
but bootstrap doesn’t declare any dependency on jquery .. it just expects it as a global
which means we need shit like https://github.com/thlorenz/browserify-shim
I think shadow-cljs does not have to support all things in js world. things like Bootstrap may be troublesome too even in Webpack.
in the website I previously worked for view-source:https://h5.ele.me/msite/ lots of
can be found
yeah... js things always annoying. actually it has been a lot better since people using CommonJS and Webpack
I guess that's one of the reasons js developers not picking ClojureScript... js world is so crazy, cljs is not prepared for it
it has 115K stars on github, surely there is someone that could fix their packaging?
I remembered that doing bundling for multi-pages websites is still difficult even with Webpack, plus new tech like Service Workers or somethings.
@jiyinyiyong the issue is not which build tool I use
somehow most of my projects are using cljs code only due to the bad support for npm packages before 😂
https://code.thheller.com/blog/shadow-cljs/2017/09/15/js-dependencies-going-forward.html
@bolasblack the shadow-cljs@next
release I just pushed should fully support :cache-root
. It will probably break everything else though 😉
=>> yarn watch
yarn watch v0.24.6
$ shadow-cljs watch app
shadow-cljs - config: /Users/chen/repo/minimal-xyz/minimal-shadow-cljs-browser/shadow-cljs.edn version: SNAPSHOT
shadow-cljs - updating dependencies
shadow-cljs - dependency update failed - Could not find artifact thheller:shadow-cljs:jar:SNAPSHOT in central ( )
error Command failed with exit code 1.
@jiyinyiyong should be fixed
yarn watch v0.24.6
$ shadow-cljs watch app
shadow-cljs - config: /Users/chen/repo/minimal-xyz/minimal-shadow-cljs-browser/shadow-cljs.edn version: 2.0.0-alpha3
shadow-cljs - updating dependencies
Retrieving thheller/shadow-cljs/2.0.0-alpha3/shadow-cljs-2.0.0-alpha3.pom from
Retrieving org/clojure/clojurescript/1.9.908/clojurescript-1.9.908.pom from
Retrieving org/clojure/google-closure-library/0.0-20170809-b9c14c6b/google-closure-library-0.0-20170809-b9c14c6b.pom from
Retrieving org/clojure/google-closure-library-third-party/0.0-20170809-b9c14c6b/google-closure-library-third-party-0.0-20170809-b9c14c6b.pom from
Retrieving org/clojure/tools.reader/1.0.5/tools.reader-1.0.5.pom from
Retrieving com/google/javascript/closure-compiler-unshaded/v20170910/closure-compiler-unshaded-v20170910.pom from
Retrieving com/google/javascript/closure-compiler-main/v20170910/closure-compiler-main-v20170910.pom from
Retrieving com/google/javascript/closure-compiler-parent/v20170910/closure-compiler-parent-v20170910.pom from
Retrieving com/google/javascript/closure-compiler-externs/v20170910/closure-compiler-externs-v20170910.pom from
Retrieving org/clojure/google-closure-library/0.0-20170809-b9c14c6b/google-closure-library-0.0-20170809-b9c14c6b.jar from
Retrieving org/clojure/tools.reader/1.0.5/tools.reader-1.0.5.jar from
Retrieving org/clojure/clojurescript/1.9.908/clojurescript-1.9.908.jar from
Retrieving org/clojure/google-closure-library-third-party/0.0-20170809-b9c14c6b/google-closure-library-third-party-0.0-20170809-b9c14c6b.jar from
Retrieving com/google/javascript/closure-compiler-unshaded/v20170910/closure-compiler-unshaded-v20170910.jar from
Retrieving com/google/javascript/closure-compiler-externs/v20170910/closure-compiler-externs-v20170910.jar from
should be fine to just kill the process and try again. maybe the connection died or something
you might get a Caused by: java.lang.IllegalArgumentException: No matching field found: close for class sun.net.www.protocol.jar.JarURLConnectio
Retrieving thheller/shadow-cljs/2.0.0-alpha3/shadow-cljs-2.0.0-alpha3.jar from
shadow-cljs - dependencies updated
shadow-cljs - re-building aot cache on startup, that will take some time.
shadow-cljs - starting ...
Exception in thread "main" java.lang.IllegalArgumentException: No matching field found: close for class sun.net.www.protocol.jar.JarURLConnection, compiling:(compiler.clj:32:3)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3676)
at clojure.lang.Compiler$DefExpr.eval(Compiler.java:457)
at clojure.lang.Compiler.compile1(Compiler.java:7552)
at clojure.lang.Compiler.compile(Compiler.java:7619)
at clojure.lang.RT.compile(RT.java:408)
at clojure.lang.RT.load(RT.java:453)
at clojure.lang.RT.load(RT.java:421)
at clojure.core$load$fn__6368.invoke(core.clj:6008)
at clojure.core$load.invokeStatic(core.clj:6007)
at clojure.core$load.doInvoke(core.clj:5991)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invokeStatic(core.clj:5812)
at clojure.core$load_one.invoke(core.clj:5807)
at clojure.core$load_lib$fn__6313.invoke(core.clj:5852)
at clojure.core$load_lib.invokeStatic(core.clj:5851)
shadow-cljs - starting ...
failed to start service
{:id :dev-http}
ExceptionInfo: failed to start service
clojure.core/ex-info (core.clj:4725)
clojure.core/ex-info (core.clj:4725)
shadow.runtime.services/start-many/fn--14458 (services.clj:135)
shadow.runtime.services/start-many (services.clj:126)
shadow.runtime.services/start-many (services.clj:105)
shadow.runtime.services/start-all (services.clj:144)
shadow.runtime.services/start-all (services.clj:139)
shadow.cljs.devtools.server/start-system (server.clj:150)
shadow.cljs.devtools.server/start-system (server.clj:94)
shadow.cljs.devtools.server/start! (server.clj:180)
shadow.cljs.devtools.server/start! (server.clj:172)
shadow.cljs.devtools.server/start! (server.clj:175)
shadow.cljs.devtools.server/start! (server.clj:172)
shadow.cljs.devtools.server/from-cli (server.clj:260)
shadow.cljs.devtools.server/from-cli (server.clj:251)
shadow.cljs.devtools.cli/main (cli.clj:92)
shadow.cljs.devtools.cli/main (cli.clj:74)
clojure.core/apply (core.clj:657)
clojure.core/apply (core.clj:652)
shadow.cljs.devtools.cli/-main (cli.clj:132)
shadow.cljs.devtools.cli/-main (cli.clj:130)
clojure.lang.Var.applyTo (Var.java:702)
clojure.core/apply (core.clj:657)
clojure.main/main-opt (main.clj:316)
clojure.main/main-opt (main.clj:312)
clojure.main/main (main.clj:423)
clojure.main/main (main.clj:386)
clojure.lang.Var.applyTo (Var.java:702)
clojure.main.main (main.java:37)
Caused by:
invalid config
In: [:builds :npm 1] val: {:id :npm, :target :npm-module, :output-dir "node_modules/shadow-cljs"} fails spec: :shadow.build.config/build at: [:builds 1] predicate: (contains? % :build-id)
error Command failed with exit code 1.
=>>
{:source-paths ["src"]
:dependencies []
:builds {:app {:output-dir "target/"
:asset-path "."
:target :browser
:modules {:main {:entries [app.main]}}
:devtools {:after-load app.main/reload!}}}}
[:app] Configuring build.
[:app] Compiling ...
[:app] Build failure:
Failed to run: ./node_modules/.bin/browserify -d -g envify -r hsl
{:tag :shadow.build.targets.browser/browserify, :command ["./node_modules/.bin/browserify" "-d" "-g" "envify" "-r" "hsl"]}
ExceptionInfo: Failed to run: ./node_modules/.bin/browserify -d -g envify -r hsl
clojure.core/ex-info (core.clj:4725)
clojure.core/ex-info (core.clj:4725)
shadow.build.targets.browser/bundle-js/fn--25574/fn--25583 (browser.clj:461)
shadow.build.targets.browser/bundle-js/fn--25574 (browser.clj:449)
Caused by:
IOException: Cannot run program "./node_modules/.bin/browserify": error=2, No such file or directory
java.lang.ProcessBuilder.start (ProcessBuilder.java:1048)
sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)
dependencies:
{ mkdirp: '^0.5.1',
'readline-sync': '^1.4.7',
'shadow-cljs-jar': '^0.10.0',
'source-map-support': '^0.4.15',
ws: '^3.0.0' },
"dependencies": {
"browserify": "^14.4.0",
"envify": "^4.1.0",
"mkdirp": "^0.5.1",
"readline-sync": "^1.4.7",
"shadow-cljs-jar": "^0.10.0",
"source-map-support": "^0.4.15",
"uglifyify": "^4.0.4",
"ws": "^3.0.0"
}
but you need to have shadow-cljs
added to your project so browserify gets installed into node_modules
and not the global one
[:app] Build completed. (112 files, 1 compiled, 0 warnings, 9.15s)
Sep 22, 2017 8:57:29 PM clojure.tools.logging$eval486$fn__489 invoke
WARNING: build-update: [[:shadow.build.classpath/resource "app/main.cljs"]]
[:app] Compiling ...
[:app] Build completed. (112 files, 1 compiled, 0 warnings, 0.61s)
Sep 22, 2017 8:57:45 PM clojure.tools.logging$eval486$fn__489 invoke
WARNING: build-update: [[:shadow.build.classpath/resource "app/lib.cljs"]]
[:app] Compiling ...
[:app] Build completed. (112 files, 2 compiled, 0 warnings, 0.35s)
Sep 22, 2017 8:57:47 PM clojure.tools.logging$eval486$fn__489 invoke
WARNING: build-update: [[:shadow.build.classpath/resource "app/lib.cljs"]]
[email protected]
should fix the reload issue
@jiyinyiyong did it work though? you are the first tester 😉
[:app] Compiling ...
[:app] Build failure:
Could not find js dependency "shortid", either install the npm package or define in :js-options
{}
ExceptionInfo: Could not find js dependency "shortid", either install the npm package or define in :js-options
clojure.core/ex-info (core.clj:4725)
clojure.core/ex-info (core.clj:4725)
shadow.build.resolve/resolve-string-require (resolve.clj:127)
shadow.build.resolve/resolve-string-require (resolve.clj:110)
shadow.build.resolve/resolve-require (resolve.clj:227)
shadow.build.resolve/resolve-require (resolve.clj:220)
shadow.build.resolve/resolve-deps/fn--19695 (resolve.clj:56)
clojure.lang.PersistentVector.reduce (PersistentVector.java:341)
success Saved 2 new dependencies.
├─ [email protected]
└─ [email protected]
✨ Done in 5.28s.
=>> l node_modules/sh
sha.js/ shadow-cljs-jar/ shell-quote/
shadow-cljs/ shasum/ shortid/
=>> l node_modules/shortid/
CHANGELOG.md README.md lib/
LICENSE index.js package.json
=>> coffee
coffee> require 'shortid'
Expression assignment to _ now disabled.
{ [Function: generate]
generate: [Circular],
seed: [Function: seed],
worker: [Function: worker],
characters: [Function: characters],
decode: [Function: decode],
isValid: [Function: isShortId] }
looks like I have to use [email protected]
if you its a string its a replacement for "main"
, if its a map the functionality is completely different
the code has a require for var clusterWorkerId = require('./util/cluster-worker-id')
but maps "./lib/util/cluster-worker-id.js": "./lib/util/cluster-worker-id-browser.js"
and in the meantime there will probably be a billion other things people invent to do package management
=>> yarn
yarn install v1.0.2
[1/4] 🔍 Resolving packages...
warning Lockfile has incorrect entry for "[email protected]". Ignoring it.
Couldn't find any versions for "shadow-cljs" that matches "2.x"
? Please choose a version of "shadow-cljs" from this list: 2.0.0-alpha6
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 📃 Building fresh packages...
success Saved lockfile.
✨ Done in 6.20s.
=>> l node_modules/.bin/
JSONStream browserify envify he insert-module-globals mkdirp sha.js umd
@jiyinyiyong did you try other npm packages or just shortid?