Skip to content

Commit

Permalink
[solidity-sha3] Initial push 0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
madvas committed Feb 21, 2017
1 parent 9eae96e commit 7d5a34b
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 0 deletions.
20 changes: 20 additions & 0 deletions solidity-sha3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# cljsjs/solidity-sha3

[](dependency)
```clojure
[cljsjs/solidity-sha3 "0.4.1-0"] ;; latest release
```
[](/dependency)

This jar comes with `deps.cljs` as used by the [Foreign Libs][flibs] feature
of the ClojureScript compiler. After adding the above dependency to your project
you can require the packaged library like so:

```clojure
(ns application.core
(:require cljsjs.solidity-sha3))
```

[flibs]: https://github.com/clojure/clojurescript/wiki/Packaging-Foreign-Dependencies

For more information, see the project's [official docs](https://github.com/raineorshine/solidity-sha3).
71 changes: 71 additions & 0 deletions solidity-sha3/build.boot
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
(set-env!
:resource-paths #{"resources"}
:dependencies '[[cljsjs/boot-cljsjs "0.5.2" :scope "test"]])

(require '[cljsjs.boot-cljsjs.packaging :refer :all]
'[boot.core :as boot]
'[boot.tmpdir :as tmpd]
'[clojure.java.io :as io]
'[boot.util :refer [sh]])

(def +lib-version+ "0.4.1")
(def +version+ (str +lib-version+ "-0"))
(def +lib-folder+ (format "solidity-sha3-%s" +lib-version+))

(task-options!
pom {:project 'cljsjs/solidity-sha3
:version +version+
:description "Solidity sha3 in Javascript"
:url "https://github.com/raineorshine/solidity-sha3"
:scm {:url "https://github.com/cljsjs/packages"}
:license {"MIT" "http://opensource.org/licenses/MIT"}})

(require '[boot.core :as c]
'[boot.tmpdir :as tmpd]
'[clojure.java.io :as io]
'[clojure.string :as string])

(deftask download-solidity-sha3 []
(download :url (str "https://github.com/raineorshine/solidity-sha3/archive/v" +lib-version+ ".zip")
:checksum "c39b0a8b88534a74391f6125e593da07"
:unzip true))

(def webpack-file-name "webpack.config.js")
(def main-file-name "main.js")

(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 main-file-name)
(io/file tmp +lib-folder+ main-file-name))
(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" "--ignore-scripts"))
((sh "npm" "run" "build"))
((sh "npm" "install" "webpack"))
((sh "./node_modules/.bin/webpack" "--config" "webpack-cljsjs.config.js")))
(-> fileset (boot/add-resource tmp) boot/commit!))))

(deftask package []
(comp
(download-solidity-sha3)
(build)
(sift :move {#".*solidity-sha3.inc.js" "cljsjs/solidity-sha3/development/solidity-sha3.inc.js"})

(minify :in "cljsjs/solidity-sha3/development/solidity-sha3.inc.js"
:out "cljsjs/solidity-sha3/production/solidity-sha3.min.inc.js")

(sift :include #{#"^cljsjs"})

(deps-cljs :name "cljsjs.solidity-sha3"
:requires ["cljsjs.web3"])
(pom)
(jar)))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var SoliditySha3 = {
sha3: function() {},
sha3withsize: function() {},
sha3num: function() {}
};
5 changes: 5 additions & 0 deletions solidity-sha3/resources/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(function () {
var SoliditySha3 = require('./dist/index.js');
module.exports = SoliditySha3;
module.exports.sha3 = SoliditySha3.default;
})();
15 changes: 15 additions & 0 deletions solidity-sha3/resources/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var path = require('path');

module.exports = {
entry: './main.js',
output: {
path: path.join(__dirname, "dist"),
filename: "solidity-sha3.inc.js",
libraryTarget: "var",
library: "SoliditySha3"
},
externals: {
"web3": "Web3"
},
devtool: 'source-map'
};

0 comments on commit 7d5a34b

Please sign in to comment.