Code Monkey home page Code Monkey logo

boot-cljsjs's People

Contributors

abelvarga avatar adolby avatar arichiardi avatar danielsz avatar deraen avatar ducky427 avatar jeluard avatar martinklepsch avatar metasoarous avatar micha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

boot-cljsjs's Issues

validate-checksums doesn't see files from minify task

checksum check doesn't see files from minify task, at least in certain situations.

boot package didn't see minified file
boot package target worked correctly

Currently validate-checksums checks the fileset before running next-handler (i.e. pre-wrap) maybe it should first run other handlers and then do the check?

Invalid cookie header when fetching zip from git

I'm trying to test my changes locally with boot package install target and I get

react-tooltip git:(master) ✗ boot package install target                                                        ~/forks/packages/react-tooltip
Downloading 3.6.0.zip
May 30, 2018 2:35:50 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: logged_in=no; domain=.github.com; path=/; expires=Sun, 30 May 2038 12:35:50 -0000; secure; HttpOnly". Invalid 'expires' attribute: Sun, 30 May 2038 12:35:50 -0000
                                       java.lang.Thread.run                  Thread.java:  748
         java.util.concurrent.ThreadPoolExecutor$Worker.run      ThreadPoolExecutor.java:  624
          java.util.concurrent.ThreadPoolExecutor.runWorker      ThreadPoolExecutor.java: 1149
                        java.util.concurrent.FutureTask.run              FutureTask.java:  266
                                                        ...                                   
                        clojure.core/binding-conveyor-fn/fn                     core.clj: 2022
                                          boot.core/boot/fn                     core.clj: 1031
                                        boot.core/run-tasks                     core.clj: 1021
               cljsjs.boot-cljsjs.packaging/eval372/fn/G/fn                packaging.clj:   99
                                          boot.pod/call-in*                      pod.clj:  413
                                                        ...                                   
org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke  ClojureRuntimeShimImpl.java:  102
org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke  ClojureRuntimeShimImpl.java:  109
                                                        ...                                   
                                          boot.pod/call-in*                      pod.clj:  410
                                      boot.pod/eval-fn-call                      pod.clj:  359
                                         clojure.core/apply                     core.clj:  657
                                                        ...                                   
                              cljsjs.impl.download/download                 download.clj:    8
                                                        ...                                   
                                        clj-http.client/get                   client.clj: 1183
                                        clj-http.client/get                   client.clj: 1187
                                   clj-http.client/request*                   client.clj: 1181
                       clj-http.client/wrap-unknown-host/fn                   client.clj: 1009
                               clj-http.links/wrap-links/fn                    links.clj:   63
                           clj-http.cookies/wrap-cookies/fn                  cookies.clj:  131
                             clj-http.client/wrap-method/fn                   client.clj:  882
                      clj-http.client/wrap-nested-params/fn                   client.clj:  983
                        clj-http.client/wrap-form-params/fn                   client.clj:  948
                       clj-http.client/wrap-content-type/fn                   client.clj:  707
                    clj-http.client/wrap-accept-encoding/fn                   client.clj:  746
                             clj-http.client/wrap-accept/fn                   client.clj:  724
                         clj-http.client/wrap-exceptions/fn                   client.clj:  248
                        clj-http.client/exceptions-response                   client.clj:  239
                              slingshot.support/stack-trace                  support.clj:  201
clojure.lang.ExceptionInfo: clj-http: status 404
    data: {#object[clojure.lang.Keyword 0x311797fe ":request-time"] 1128, #object[clojure.lang.Keyword 0x47cc6137 ":repeatable?"] false, #object[clojure.lang.Keyword 0x36c8e3be ":protocol-version"] {#object[clojure.lang.Keyword 0x1cf85885 ":name"] "HTTP", #object[clojure.lang.Keyword 0x388e4b06 ":major"] 1, #object[clojure.lang.Keyword 0x10108298 ":minor"] 1}, #object[clojure.lang.Keyword 0x7c0567d4 ":streaming?"] true, #object[clojure.lang.Keyword 0x4d572ffa ":chunked?"] false, #object[clojure.lang.Keyword 0x6b83e71 ":type"] #object[clojure.lang.Keyword 0x1b97d2f4 ":clj-http.client/unexceptional-status"], #object[clojure.lang.Keyword 0x3cf3f0fd ":reason-phrase"] "Not Found", #object[clojure.lang.Keyword 0x27e3a646 ":headers"] {"Access-Control-Allow-Origin" "https://render.githubusercontent.com", "X-Content-Type-Options" "nosniff", "Content-Length" "15", "X-Frame-Options" "deny", "Strict-Transport-Security" "max-age=31536000", "Connection" "close", "X-GitHub-Request-Id" "E184:4428:2039D1:35FD84:5B0E9AA6", "Date" "Wed, 30 May 2018 12:35:51 GMT", "Vary" "Authorization,Accept-Encoding", "X-XSS-Protection" "1; mode=block", ...}, #object[clojure.lang.Keyword 0x469c03a2 ":orig-content-encoding"] nil, #object[clojure.lang.Keyword 0x612c760a ":status"] 404, ...}
clojure.lang.ExceptionInfo: clj-http: status 404
    line: 49

I found similar ticket for this at dakrone/clj-http#325 maybe it's possible to change the cookie policy to :cookie-policy :standard, wonder if it works or bumping clj-http from 3.7.0 to 3.9.0?

Compile error on latest boot-cljs 0.0-2629-9

Works:

[adzerk/boot-cljs      "0.0-2629-8" :scope "test"]
[cljsjs/boot-cljsjs    "0.4.1"      :scope "test"]

Broken:

[adzerk/boot-cljs      "0.0-2629-9" :scope "test"]
[cljsjs/boot-cljsjs    "0.4.1"      :scope "test"]

Is this an issue with boot-cljs or boot-cljsjs?

java.lang.IllegalArgumentException: No matching field found: getPath for class java.lang.String
                                         ...
adzerk.boot-cljs.middleware/shim/rooted-path                    middleware.clj:  154
                        clojure.core/mapv/fn                          core.clj: 6353
                   clojure.core.protocols/fn                     protocols.clj:  127
                 clojure.core.protocols/fn/G                     protocols.clj:   19
           clojure.core.protocols/seq-reduce                     protocols.clj:   31
                   clojure.core.protocols/fn                     protocols.clj:   48
                 clojure.core.protocols/fn/G                     protocols.clj:   13
                         clojure.core/reduce                          core.clj: 6289
                           clojure.core/mapv                          core.clj: 6353
            adzerk.boot-cljs.middleware/shim                    middleware.clj:  155
               adzerk.boot-cljs/prep-compile                     boot_cljs.clj:   52
        adzerk.boot-cljs/eval254/fn/fn/fn/fn                     boot_cljs.clj:  133
           adzerk.boot-cljs/eval254/fn/fn/fn                     boot_cljs.clj:  129
           adzerk.boot-cljs/eval230/fn/fn/fn                     boot_cljs.clj:   81
         cljsjs.boot-cljsjs/eval338/fn/fn/fn                   boot_cljsjs.clj:   30
         pandeiro.boot-http/eval555/fn/fn/fn                     boot_http.clj:   66
        boot.task.built-in/fn/fn/fn/fn/fn/fn                      built_in.clj:  165
           boot.task.built-in/fn/fn/fn/fn/fn                      built_in.clj:  165
              boot.task.built-in/fn/fn/fn/fn                      built_in.clj:  162
                         boot.core/run-tasks                          core.clj:  623

Add support to externs free libraries

Some libraries do not need externs to properly work. A canonical example is a polyfill library whose associated externs are already in closure compiler.

Let me know if this is desirable. I have a patch for this.

Clojure 1.8.0 compatibility

"download" task throws an exception when BOOT_CLOJURE_VERSION is set to 1.8.0.
Exception:
clojure.lang.ExceptionInfo: java.lang.NoClassDefFoundError: IllegalName: compile__stub.clj_http.headers.clj-http.headers/HeaderMap, compiling:(clj_http/headers.clj:105:1) ...

More explanation

As a user and having read the README here and in packages, I'm still not sure about a few things:

a). What, if anything, I need to include manually in my HTML file to load my ClojureScript app and dependencies
b). What, if anything, I need to include manually in my HTML file to load non-JS dependencies (eg, CSS files, images, other assets that are packaged via cljsjs)

An illustration of this in the README would complement the build.boot example well.

Sanity check task

Some rules we could check during the build:

  • All files are under cljsjs/ path except for deps.cljs and pom files
  • All JS files are mentioned in the deps.cljs file
  • Extern validation using Closure (whole packages repo validation still required to find duplicate definitions)

CSS assets in package but unable to retrieve

The from-cljsjs task won't don't do anything to the CSS assets even if present in packages. I would like to sift them to my target directory. I have tried unsuccessfully to do that with the sift task. Can anyone help? Maybe an example sift invocation, or better, a from-cljsjs-css task that will put the CSS in the target directory, maybe under CSS?

Downloaded file cannot be deleted in Windows

It looks like after expanding the downloading zip, it is deleted but that doesn't work on Windows:

C:\Users\pupeno\Documents\Dashman\packages\react-toolbox>boot package target install
Downloading 1.3.3.zip
Extracting 377 files
                              java.lang.Thread.run              Thread.java:  745
java.util.concurrent.ThreadPoolExecutor$Worker.run  ThreadPoolExecutor.java:  617
 java.util.concurrent.ThreadPoolExecutor.runWorker  ThreadPoolExecutor.java: 1142
               java.util.concurrent.FutureTask.run          FutureTask.java:  266
                                               ...
               clojure.core/binding-conveyor-fn/fn                 core.clj: 1916
                                 boot.core/boot/fn                 core.clj: 1029
                               boot.core/run-tasks                 core.clj: 1019
      cljsjs.boot-cljsjs.packaging/eval216/fn/G/fn            packaging.clj:   86
      cljsjs.boot-cljsjs.packaging/eval53/fn/fn/fn            packaging.clj:   25
     cljsjs.boot-cljsjs.packaging/eval104/fn/fn/fn            packaging.clj:   53
                                 boot.core/commit!                 core.clj:  463
                    boot.tmpdir.TmpFileSet/commit!               tmpdir.clj:  254
                             boot.file/delete-file                 file.clj:   71
                                               ...
                       clojure.java.io/delete-file                   io.clj:  426
java.io.IOException: Couldn't delete C:\Users\pupeno\.boot\cache\tmp\Users\pupeno\Documents\Dashman\packages\react-toolbox\5g0\u2qisy\1.3.3.zip

Support :foreign-libs

  • add deps.cljs file to all jars.
    • jquery
    • hammer
    • moment
    • react
    • react with add ons
    • jquery datepicker
    • pikaday
  • create simple testbed that calls a function of each lib after advanced compilation
    • jquery
    • hammer
    • moment
    • react
    • react with add ons
    • jquery datepicker
    • pikaday
  • publish all jars
    • jquery
    • hammer
    • moment
    • react
    • react with add ons
    • jquery datepicker
    • pikaday
  • update boot-cljs to newest Clojurescript
  • deprecate from-cljsjs task. (not mentioned anymore)
  • update documentation (packages & boot-cljsjs)

Mark is not supported

I am trying to decompress a .gz file using the provided tasks (no tar).

Unfotunately, it blows:

...
                                             cljsjs.impl.decompress/decompress-file               decompress.clj:   26
                                             cljsjs.impl.decompress/decompress-file               decompress.clj:   29
                                                                                ...                                   
                                            cljsjs.impl.decompress/unpackage-stream               decompress.clj:   20
                                            cljsjs.impl.decompress/unpackage-stream               decompress.clj:   24
                                                                                ...                                   
org.apache.commons.compress.archivers.ArchiveStreamFactory.createArchiveInputStream    ArchiveStreamFactory.java:  290
java.lang.IllegalArgumentException: Mark is not supported.
        clojure.lang.ExceptionInfo: Mark is not supported.

Debugging it, basically the problem is that this guy creates a org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream which does not support marking, which is weird.

The ArchiveStreamFactory has the requirement, see here.

Thoughts?

Supporting `:module-type` compiler option

I think it would be ideal to replace this (which doesn't even work on Node):

(ns example.core
  (:require cljsjs.foo))

;; how to use in the Browser
(def foo js/foo)

;; how to use in Node (can't?)
(def foo (js/require "????"))  ;; content is unnamed somewhere in our compiled code

with this, by allowing an option {:module-type :common-js}:

(ns example.core
  (:require [cljs.foo :as foo])) ;; works in Browser and Node

This option enables us to have the Closure compiler transform the library into a Closure module, rather than just pasting the library into the compiled output. Pending a future patch for a bug found in this process, I think supporting this new module-type option would be nice.

Background references:

Provide Extern generation task

npm package externs-generator provides a way to build extern file programmatically. Probably won't work for all libs, but should be useful.

It is possible to create a task which builds a temp dir with source files (library file and dependencies) and then shell out to npm. npm is already available at the CI and we can install the externs-generator globally.

(extern :files ["cljsjs/pouchdb/development/poucbdb.inc.js"
                ;; dependencies
                "cljsjs/jquery/development/jquery.inc.js"]
        :object "PouchDB"
        :output "cljsjs/pouchcb/common/pouchdb.ext.js")

Assigning to myself to keep track of this for my TODO list, but if someone want's to implement this, feel free.

Renaming cljsjs.app ns

Examples of what other boot plugins use:

  • main namespace (groupId/artifactId)
  • adzerk.boot-cljs (adzerk/boot-cljs)
  • adzerk.boot-reload
  • deraen.boot-cljx (deraen/boot-cljx)
  • etc.

Our groupId/artifactId is: cljsjs/boot-cljsjs
Perhaps cljsjs.boot-cljsjs would be good ns? (too much repetition?)

Smoke-test externs syntax at build time

This could be done by compiling a minimal project with the supplied externs (probably cljs isn't even needed). The result would be that syntax errors in externs and duplicate declarations are catched at build time compared to run time.

via cljsjs/packages#508

Deprecate from-jars (and maybe from-webjars) task

On boot rc5 the sift task now has :add-jar option.

(from-jars "react/react.js" :target "public/js/react.inc.js")
# would now be
(sift :add-jar {'com.facebook/react #"react/(externs/)?react.js"})
(sift :move {#"react/react.js" "react/react.inc.js"
             #"react/externs/react.js" "react/react.ext.js")

from cli:

❯ boot -d com.facebook/react sift --add-jar com.facebook/react:"react/(externs/)?react.js" sift --move "react/react.js":"react/react.inc.js" --move "react/externs/react.js":"react/react.ext.js"                                                                                   
Sifting output files...
Adding jar entries from react-0.12.2.1.jar...
Sifting output files...

~/tmp master*  
❯ tree target
target       
└── react
    ├── react.ext.js
    └── react.inc.js

Browserified npm modules

There are lot of JS libraries that are written to only work with browserify (such as snabbdom). There is a CDN called wzrd.in for browserify modules, but it's poorly implemented. I've barely used it and I've had multiple issues with it. It doesn't support peer dependencies (which motor/cycle needs) or choosing the entry point (which snabbdom needs). It also doesn't bundle the way browserify does, it just concatenates multiple standalone bundles, which can result in unusual behavior, and the author made it clear that he doesn't want to fix it.

I propose having a browserify boot task that can make the process of including those libraries simpler.

Node, npm and browserify would be installed on the CLJSJS end. Then the task would just install the package and run the globally installed browserify task with the given params, so it shouldn't be too hard to implement.

The task can take in the browserify optional and required parameters: entry points, the UMD module name, and output file (see usage).

For example:

(browserify :package "snabbdom" :entry "modules/class.js" :standalone "snabbdom_class" :out "snabbdom-class.js")

Which would do this under the hood:

$ npm install snabbdom
$ browserify node_modules/snabbdom/modules/class.js --standalone snabbdom_class -o snabbdom-class.js

Then it would be easy to include browserify modules like snabbdom, by just running the browserify task for all of the entry points/submodules it provides (class, props, style, events, and h), concatenating and miniftying it, and the you're done.

Provide a way to have multiple externs

Many externs are generated via one of the excellent generators, sometimes these externs are not complete and people add whats missing. Then a new version is released and someone generates a new externs file replacing the previously edited one. Because diffs are hard often previous modifications get lost.

Since this kind of situation seems likely to repeat maybe it'd make sense to allow for multiple ext.js files in a single package. this way we could have one file for "manual" and one file for "generated" (or whatever else seems fitting to the respective author).

At build time the externs could be concatenated. This would probably require some additional preflight checking to catch duplicate declarations but in theory it sounds possible? (see #32)

A bit further away but in theory we could declare externs in some easy to handle data format (e.g. edn) as well, no? This way merging would be trivial. Converting an edn file into the required .js file seems doable as well. This adds quite a bit of indirection so I'm not entirely sure if it's worth it.

via cljsjs/packages#292

"/js" added twice to included files path

The script tags added to index.html have one /js too much:
hi__world_

The path should be /js/react.inc.js, that's where the file actually resides on the filesystem and should be reached by the webserver. So the file resides in the right place, but a wrong path ends up in adzerk.boot-cljs.middleware/write-src I'd think.

It's reproducible in a fresh app created with tenzing (https://github.com/martinklepsch/tenzing) via lein new tenzing broken-app +reagent and running boot dev.

I also tried downgrading boot-cljsjs, as there has been a recent change on the paths handling (f277193), but the problem also existed on v0.3.1.

npm task

From cljsjs/packages#396

A common use case starts to be quite evident:

(deftask build []
  (let [tmp (boot/tmp-dir!)]
    (with-pre-wrap
      fileset
      (doseq [f (boot/input-files fileset)]
        (let [target (io/file tmp (tmpd/path f))]
          (io/make-parents target)
          (io/copy (tmpd/file f) target)))
      (io/copy
       (io/file tmp "webpack.config.js")
       (io/file tmp +lib-folder+ "webpack-cljsjs.config.js"))
      (binding [*sh-dir* (str (io/file tmp +lib-folder+))]
        ((sh "npm" "install"))
        ((sh "npm" "install" "webpack"))
        ((sh "npm" "run" "build"))
        ((sh "./node_modules/.bin/webpack" "--config" "webpack-cljsjs.config.js")))
      (-> fileset (boot/add-resource tmp) boot/commit!))))

We can parametrizize this like this:

(npm :import-files {"webpack-cljsjs.config.js" (str +lib-folder+ "webpack-cljsjs.config.js"}
     :commands [["npm" "install"]
                ["npm" "install" "webpack"]]
                ["npm" "run" "build"]]
                ["./node_modules/.bin/webpack" "--config" "webpack-cljsjs.config.js"]])

Where import-files is map of path in fileset to path in working dir for npm.

Adding CSS (or other non-JS assets)

I am trying to integrate [org.webjars/swiper "2.6.1"] into my boot project. This is a library that requires both a JS file and CSS file to operate.

I have the following lines in build.boot

(from-webjars :name "swiper/idangerous.swiper.js" :target "js/swiper.inc.js")
(from-webjars :name "swiper/idangerous.swiper.css" :target "css/swiper.css")

and boot produces the following output:

Adding META-INF/resources/webjars/swiper/2.6.1/idangerous.swiper.min.js to fileset
Adding META-INF/resources/webjars/swiper/2.6.1/idangerous.swiper.css to fileset

Yet the .css file does not show up in the resulting output files.

Is this expected? Is boot-cljsjs intended to just work with .js files?

Weird directory structure

I have for example tried this in a new fork

(deftask package []
  (comp
    (download :url     (format "https://unpkg.com/@microsoft/office-js@%s/dist/office.debug.js" +lib-version+)
              :target  "cljsjs/office-js/development/office-js.inc.js")
    (download :url     (format "https://unpkg.com/@microsoft/office-js@%s/dist/office.js" +lib-version+)
              :target  "cljsjs/office-js/production/office-js.min.inc.js")
    (sift :include #{#"^cljsjs"})
    (pom)
    (show :fileset true)
    (jar)
    (validate-checksums)))

but output is very wrong

└─❱❱❱ boot package install target                                                                                                                                                              +7763 17:09 ❰─┘
Downloading office.debug.js
Sifting output files...
Downloading office.js
Sifting output files...
Sifting output files...
Writing pom.xml and pom.properties...

├── META-INF
│   └── maven
│       └── cljsjs
│           └── office-js
│               ├── pom.properties
│               └── pom.xml
└── cljsjs
    ├── cljsjs
    │   └── office-js
    │       └── production
    │           └── office-js.min.inc.js
    │               ├── common
    │               │   └── cljsjs
    │               │       └── office-js
    │               │           └── production
    │               │               └── office-js.min.inc.js.ext.js
    │               └── development
    │                   └── cljsjs
    │                       └── office-js
    │                           └── production
    │                               └── office-js.min.inc.js.inc.js
    └── office-js
        └── production
            └── office-js.min.inc.js
Writing office-js-1.1.8-0.jar...
Checksums match
Installing office-js-1.1.8-0.jar...
Writing target dir(s)...

Trying to understand what causes this wrong directory structure? Why is there so much nesting?

Thanks for any clues

ClassNotFoundException on Java 12

Specifically getting: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter when I try to run boot package install target on Java 12. The following SO post suggests that this may affect other recent Java versions as well.

https://stackoverflow.com/questions/43574426/how-to-resolve-java-lang-noclassdeffounderror-javax-xml-bind-jaxbexception-in-j

The work around is pretty simple: add [javax.xml.bind/jaxb-api "2.3.0"] to the dependencies. I tried this directly in one of the cljsjs-packages I'm trying to update, and it did the trick. Adding to boot-cljsjs would prevent folks from having to do this. Versions of cljsjs/boot-cljsjs would still have to be updated in all the build.boot files, but that's preferable to adding additional deps (IMHO), and could maybe be done in bulk with search & replace.

The minify task doesn't seem to work on Windows

When I specify a minify task, such as:

           (minify :in "cljsjs/react-toolbox/development/react-toolbox.inc.js"
                   :out "cljsjs/react-toolbox/production/react-toolbox.min.inc.js"
                   :lang :ecmascript5)

it crashes with this error:

                              java.lang.Thread.run                       Thread.java:  745
java.util.concurrent.ThreadPoolExecutor$Worker.run           ThreadPoolExecutor.java:  617
 java.util.concurrent.ThreadPoolExecutor.runWorker           ThreadPoolExecutor.java: 1142
               java.util.concurrent.FutureTask.run                   FutureTask.java:  266
                                               ...
               clojure.core/binding-conveyor-fn/fn                          core.clj: 1916
                                 boot.core/boot/fn                          core.clj: 1029
                               boot.core/run-tasks                          core.clj: 1019
      cljsjs.boot-cljsjs.packaging/eval216/fn/G/fn                     packaging.clj:   86
      cljsjs.boot-cljsjs.packaging/eval53/fn/fn/fn                     packaging.clj:   25
     cljsjs.boot-cljsjs.packaging/eval104/fn/fn/fn                     packaging.clj:   40
                        boot.user/eval429/fn/fn/fn  boot.user5499082694657809200.clj:   23
                    boot.task.built-in/fn/fn/fn/fn                      built_in.clj:  577 (repeats 2 times)
     cljsjs.boot-cljsjs.packaging/eval305/fn/fn/fn                     packaging.clj:  148
                                boot.core/tmp-file                          core.clj:  393
                                  boot.tmpdir/fn/G                        tmpdir.clj:   25
                   clojure.core/-cache-protocol-fn                  core_deftype.clj:  554
java.lang.IllegalArgumentException: No implementation of method: :file of protocol: #'boot.tmpdir/ITmpFile found for class: nil
        clojure.lang.ExceptionInfo: No implementation of method: :file of protocol: #'boot.tmpdir/ITmpFile found for class: nil
    file: "C:\\Users\\pupeno\\AppData\\Local\\Temp\\boot.user5499082694657809200.clj"
    line: 29

Minifying es6

I'd like to add the package diffDOM to cljsjs/packages. It does not provide minified version, so would like to minify it with the built-in task. It fails due to the fact that the minify only provides an option that specifies language-in. Setting this to ES6 results in the following error message:

ES6 is only supported for transpilation to a lower ECMAScript version. Set --language_out to ES3, ES5, or ES5_STRICT.

Since yesterday, it is possible to specify both language-in and language-out for asset-minifier through this PR. With the default in being :ecmascript6 and :ecmascript5 as output.

Be clear when things are added to fileset

Currently there are no messages when things are added to the fileset.
When adding files to the fileset the user should be notified about this at least on the initial compilation cycle.

D3 externs error

Follows from :optimizations :advanced:

Feb 03, 2017 10:39:39 AM com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: file:/home/arichiardi/.m2/repository/cljsjs/d3/4.3.0-2/d3-4.3.0-2.jar!/cljsjs/d3/common/d3.ext.js:681: ERROR - Object literal contains illegal duplicate key "scaleSequential", disallowed in ES5 strict mode
  "scaleSequential": function () {},
  ^^^^^^^^^^^^^^^^^

Feb 03, 2017 10:39:39 AM com.google.javascript.jscomp.LoggerErrorManager printSummary
WARNING: 1 error(s), 0 warning(s)
Optimizing with Google Closure Compiler, elapsed time: 2480.651328 msecs
ERROR: JSC_DUPLICATE_OBJECT_KEY. Object literal contains illegal duplicate key "scaleSequential", disallowed in ES5 strict mode at file:/home/arichiardi/.m2/repository/cljsjs/d3/4.3.0-2/d3-4.3.0-2.jar!/cljsjs/d3/common/d3.ext.js line 681 : 2

Grand Plan

Thought I would write down what I proposed on IRC,

Because not every JS lib will ever be packaged for Cljsjs there should be an easy way to use stuff from Webjars and any other jars which might contains js files.

So in order of preference user could use:

  1. Cljsjs packaged library
  2. Webjars
  3. Random jar

The only thing that needs to happen for boot-cljs to use any library is that fileset contains .inc.js, .ext.js or .lib.js when Cljs task is run. This should be easy to achieve with one boot plugin.

  1. (from-cljsjs :target "public")
    • [cljsjs/react "0.12.2"]
    • This task would go through classpath (all jars) and search for any *.[inc|ext|lib].js files and copy then to the target path.
    • If/when boot tasks have way to find out whats the docroot, that could be used
  2. (from-webjars :name "momentjs/moment.js" :target "public/moment.inc.js")
    • [org.webjars/momentjs "2.8.3"]
    • Like 3. but files in webjars have long paths and user wouldn't want to write e.g. "META-INF/resources/webjars/momentjs/2.8.3/moment.js"
    • Webjars locator can be used to list files from webjars in classpath
      • Might be even easier to use the same code as 1. and just match found files to webjars path regex.
    • And then some clojure code can be used to find proper resource for short name
    • https://github.com/Deraen/boot-from-jars/blob/master/src/deraen/boot_from_jars/impl.clj
  3. (from-jars :path "react/react.js" :target "public/react.inc.js")
    • [com.facebook/react "0.12.2"]
    • User might want to use file from e.g. vendor provided jar
    • User provides full path to file in classpath and the file is copied into target
  • Feel free to propose better names for these tasks
  • In addition to being directly usable, 2. and 3. might be useful for packaging stuff to Cljsjs
  • Target path is meaningful only in :optiomization :none mode because there the webserver needs to serve these files.

Implementation for 2. and 3. can be found on my repo: https://github.com/Deraen/boot-from-jars
I can do PR to merge them here.

Implementation for 1. is mostly the same as existing import-js here but without concatenation (which should be separate task).

Some notes about implementation:

  • import-js I think currently runs every time watch is triggered
  • my tasks run only once
  • Especially going through all jars is going to be slow (1. and 2.) and should only be ran rarely
  • It is possible to add dependencies at run time using set-env etc.
    • We could check if java.class.path has changed after previous run?
  • In production build the target path has no meaning and the files need not be present on .jar. Thus add-source should be used instead of add-resource to add the files to fileset.
    • :production true option for each task? is there any better way?
  • Instead of having task which run multiple times to add several files, would it make sense the have task that takes multiple paths as argument?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.