From 6c829c50507f4cfbf1b8a1fb67ed1632d3b5d2d9 Mon Sep 17 00:00:00 2001 From: Tom Michaelis Date: Thu, 7 Jan 2016 23:45:15 +0000 Subject: [PATCH 1/3] [incremental-dom] - Add incremental dom --- incremental-dom/Makefile | 21 +++++++++++++++++++++ incremental-dom/README.md | 19 +++++++++++++++++++ incremental-dom/build.boot | 28 ++++++++++++++++++++++++++++ incremental-dom/gulpfile.js.patch | 24 ++++++++++++++++++++++++ incremental-dom/resources/deps.cljs | 1 + 5 files changed, 93 insertions(+) create mode 100644 incremental-dom/Makefile create mode 100644 incremental-dom/README.md create mode 100644 incremental-dom/build.boot create mode 100644 incremental-dom/gulpfile.js.patch create mode 100644 incremental-dom/resources/deps.cljs diff --git a/incremental-dom/Makefile b/incremental-dom/Makefile new file mode 100644 index 000000000..8bac3b3b3 --- /dev/null +++ b/incremental-dom/Makefile @@ -0,0 +1,21 @@ +GIT_REPO=git@github.com:google/incremental-dom.git +TAG=0.3 + +clean: + rm -rf work + +work: + mkdir work + +work/incremental-dom: work + cd work; git clone $(GIT_REPO); + cd work/incremental-dom; git checkout tags/$(TAG) + +work/incremental-dom/node_modules: work/incremental-dom + cd work/incremental-dom; npm install + +work/incremental-dom/patched-gulpfile.js: work/incremental-dom + patch work/incremental-dom/gulpfile.js gulpfile.js.patch -o work/incremental-dom/patched-gulpfile.js + +work/incremental-dom/dist/incremental-dom-closure-provides.js: work/incremental-dom/node_modules work/incremental-dom/patched-gulpfile.js + cd work/incremental-dom; ./node_modules/.bin/gulp --gulpfile=patched-gulpfile.js js-closure-provides diff --git a/incremental-dom/README.md b/incremental-dom/README.md new file mode 100644 index 000000000..a642263d3 --- /dev/null +++ b/incremental-dom/README.md @@ -0,0 +1,19 @@ +# cljsjs/openlayers + +[](dependency) +```clojure +[cljsjs/incremental-dom "0.3"] ;; latest release +``` +[](/dependency) + +This jar comes with `deps.cljs` providing incremental-dom **as a Closure library**, which means it can undergo all the closure-compiler optimisations. + +This means requiring it is done in a similar fashion to requiring parts of the Closure library itself: + +```clojure +(ns application.core + (:require [goog.dom :as dom] ; Closure + [incremental-dom :as inc])) ; Incremental Dom +``` + +Currently, incremental-dom produces a few warnings on compilation. Some of these are resolved by setting the `:language-in` option to `:ecmascript5` in your cljsbuild configuration, but some seem to be to do with Babel stripping some parentheses from the ES2015 code. diff --git a/incremental-dom/build.boot b/incremental-dom/build.boot new file mode 100644 index 000000000..7c2535d9d --- /dev/null +++ b/incremental-dom/build.boot @@ -0,0 +1,28 @@ +(set-env! + :resource-paths #{"resources"} + :dependencies '[[cljsjs/boot-cljsjs "0.5.0" :scope "test"]]) + +(require '[boot.core :as c] + '[cljsjs.boot-cljsjs.packaging :refer :all] + '[clojure.java.io :as io]) + +(def +version+ "0.3") + +(task-options! + pom {:project 'cljsjs/incremental-dom + :version +version+ + :description "Dom-building library from google" + :url "http://github.com/google/incremental-dom" + :scm {:url "https://github.com/cljsjs/packages"} + :license {"Apache 2.0" "http://opensource.org/licenses/Apache-2.0"}}) + +(deftask package [] + (comp + (c/with-pass-thru fileset (dosh "make" "work/incremental-dom/dist/incremental-dom-closure-provides.js" + (str "TAG=" +version+))) + (c/with-pre-wrap fileset + (c/add-resource fileset (io/file "work"))) + (sift :move {#"incremental-dom/dist/incremental-dom-closure-provides.js" + "cljsjs/incremental-dom/development/incremental-dom.js"}) + (sift :include #{#"^cljsjs/" #"deps.cljs"}) + (c/with-pass-thru fileset (dosh "make" "clean")))) diff --git a/incremental-dom/gulpfile.js.patch b/incremental-dom/gulpfile.js.patch new file mode 100644 index 000000000..1626892d5 --- /dev/null +++ b/incremental-dom/gulpfile.js.patch @@ -0,0 +1,24 @@ +34a35 +> var googNamespace = 'incremental_dom'; +146a148,166 +> function jsClosureProvides(done) { +> return bundle('cjs').then(function(gen) { +> var moduleDeclaration = 'goog.provide(\'' + googNamespace + '\');'; +> var code = moduleDeclaration + '\n' +> + 'goog.scope(function(){\n' +> + 'var exports = ' + googNamespace + ';' +> + gen.code.replace(/'use strict';/, '') +> + '\n});'; +> +> return file(artifactName + '-closure-provides.js', code, {src: true}) +> .pipe(sourcemaps.init({loadMaps: true})) +> .pipe(replace('process.env.NODE_ENV !== \'production\'', 'goog.DEBUG')) +> .pipe(babel()) +> .pipe(sourcemaps.write('./')) +> .pipe(gulp.dest('dist')); +> }); +> } +> +> +177a198 +> gulp.task('js-closure-provides', jsClosureProvides); diff --git a/incremental-dom/resources/deps.cljs b/incremental-dom/resources/deps.cljs new file mode 100644 index 000000000..f2eb09660 --- /dev/null +++ b/incremental-dom/resources/deps.cljs @@ -0,0 +1 @@ +{:libs ["cljsjs/incremental-dom/development"]} From 4a5043ae44a0c9f1abc9ba19ce6a752609fe1516 Mon Sep 17 00:00:00 2001 From: Tom Michaelis Date: Wed, 13 Jan 2016 20:40:21 +0000 Subject: [PATCH 2/3] Removed Makefile and moved everythign to boot --- incremental-dom/Makefile | 21 ----------- incremental-dom/build.boot | 37 ++++++++++++++----- .../{ => resources}/gulpfile.js.patch | 0 3 files changed, 28 insertions(+), 30 deletions(-) delete mode 100644 incremental-dom/Makefile rename incremental-dom/{ => resources}/gulpfile.js.patch (100%) diff --git a/incremental-dom/Makefile b/incremental-dom/Makefile deleted file mode 100644 index 8bac3b3b3..000000000 --- a/incremental-dom/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -GIT_REPO=git@github.com:google/incremental-dom.git -TAG=0.3 - -clean: - rm -rf work - -work: - mkdir work - -work/incremental-dom: work - cd work; git clone $(GIT_REPO); - cd work/incremental-dom; git checkout tags/$(TAG) - -work/incremental-dom/node_modules: work/incremental-dom - cd work/incremental-dom; npm install - -work/incremental-dom/patched-gulpfile.js: work/incremental-dom - patch work/incremental-dom/gulpfile.js gulpfile.js.patch -o work/incremental-dom/patched-gulpfile.js - -work/incremental-dom/dist/incremental-dom-closure-provides.js: work/incremental-dom/node_modules work/incremental-dom/patched-gulpfile.js - cd work/incremental-dom; ./node_modules/.bin/gulp --gulpfile=patched-gulpfile.js js-closure-provides diff --git a/incremental-dom/build.boot b/incremental-dom/build.boot index 7c2535d9d..5558c0768 100644 --- a/incremental-dom/build.boot +++ b/incremental-dom/build.boot @@ -2,9 +2,12 @@ :resource-paths #{"resources"} :dependencies '[[cljsjs/boot-cljsjs "0.5.0" :scope "test"]]) -(require '[boot.core :as c] +(require '[cljsjs.boot-cljsjs.packaging :refer :all] - '[clojure.java.io :as io]) + '[boot.core :as boot] + '[boot.tmpdir :as tmpd] + '[clojure.java.io :as io] + '[boot.util :refer [sh]]) (def +version+ "0.3") @@ -16,13 +19,29 @@ :scm {:url "https://github.com/cljsjs/packages"} :license {"Apache 2.0" "http://opensource.org/licenses/Apache-2.0"}}) +(deftask build-incremental-dom [] + (let [tmp (boot/tmp-dir!)] + (with-pre-wrap + fileset + ;; Copy all files in fileset to temp directory + (doseq [f (->> fileset boot/input-files) + :let [target (io/file tmp (tmpd/path f))]] + (io/make-parents target) + (io/copy (tmpd/file f) target)) + + (binding [boot.util/*sh-dir* (str (io/file tmp (format "incremental-dom-%s" +version+)))] + ((sh "npm" "install")) + ((sh "patch" "gulpfile.js" "../gulpfile.js.patch" "-o" "patched-gulpfile.js")) + ((sh "./node_modules/.bin/gulp" "--gulpfile=patched-gulpfile.js" "js-closure-provides"))) + (-> fileset (boot/add-resource tmp) boot/commit!)))) + + (deftask package [] (comp - (c/with-pass-thru fileset (dosh "make" "work/incremental-dom/dist/incremental-dom-closure-provides.js" - (str "TAG=" +version+))) - (c/with-pre-wrap fileset - (c/add-resource fileset (io/file "work"))) - (sift :move {#"incremental-dom/dist/incremental-dom-closure-provides.js" + (download :url (format "https://github.com/google/incremental-dom/archive/%s.zip" +version+) + :checksum "170A1C354379FF2AF3A08455BFB0AD9D" + :unzip true) + (build-incremental-dom) + (sift :move {#"^incremental-dom-(.*)/dist/incremental-dom-closure-provides.js" "cljsjs/incremental-dom/development/incremental-dom.js"}) - (sift :include #{#"^cljsjs/" #"deps.cljs"}) - (c/with-pass-thru fileset (dosh "make" "clean")))) + (sift :include #{#"^cljsjs/" #"deps.cljs"}))) diff --git a/incremental-dom/gulpfile.js.patch b/incremental-dom/resources/gulpfile.js.patch similarity index 100% rename from incremental-dom/gulpfile.js.patch rename to incremental-dom/resources/gulpfile.js.patch From b2a7ab6417d044928474baaaaa418be30ee8e083 Mon Sep 17 00:00:00 2001 From: Tom Michaelis Date: Wed, 13 Jan 2016 20:56:14 +0000 Subject: [PATCH 3/3] [incremental-dom] Fix README.md --- incremental-dom/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/incremental-dom/README.md b/incremental-dom/README.md index a642263d3..8d249fc20 100644 --- a/incremental-dom/README.md +++ b/incremental-dom/README.md @@ -1,4 +1,4 @@ -# cljsjs/openlayers +# cljsjs/incremental-dom [](dependency) ```clojure