-
Notifications
You must be signed in to change notification settings - Fork 816
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))) |
5 changes: 5 additions & 0 deletions
5
solidity-sha3/resources/cljsjs/solidity-sha3/common/solidity-sha3.ext.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
var SoliditySha3 = { | ||
sha3: function() {}, | ||
sha3withsize: function() {}, | ||
sha3num: function() {} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
}; |