-
Notifications
You must be signed in to change notification settings - Fork 0
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
Maria Neise
committed
Jan 5, 2016
0 parents
commit 6846109
Showing
22 changed files
with
196 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,11 @@ | ||
pom.xml | ||
*jar | ||
/lib/ | ||
/classes/ | ||
/out/ | ||
/release/ | ||
/target/ | ||
.lein-deps-sum | ||
.lein-repl-history | ||
.lein-plugins/ | ||
node_modules |
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,56 @@ | ||
# hello-npm | ||
|
||
FIXME: Write a one-line description of your library/project. | ||
|
||
## Overview | ||
|
||
FIXME: Write a paragraph about the library/project and highlight its goals. | ||
|
||
## Setup | ||
|
||
Most of the following scripts require [rlwrap](http://utopia.knoware.nl/~hlub/uck/rlwrap/) (on OS X installable via brew). | ||
|
||
Build your project once in dev mode with the following script and then open `index.html` in your browser. | ||
|
||
./scripts/build | ||
|
||
To auto build your project in dev mode: | ||
|
||
./script/watch | ||
|
||
To start an auto-building Node REPL: | ||
|
||
./scripts/repl | ||
|
||
To get source map support in the Node REPL: | ||
|
||
lein npm install | ||
|
||
To start a browser REPL: | ||
|
||
1. Uncomment the following lines in src/hello_npm/core.cljs: | ||
```clojure | ||
;; (defonce conn | ||
;; (repl/connect "http://localhost:9000/repl")) | ||
``` | ||
2. Run `./scripts/brepl` | ||
3. Browse to `http://localhost:9000` (you should see `Hello world!` in the web console) | ||
4. (back to step 3) you should now see the REPL prompt: `cljs.user=>` | ||
5. You may now evaluate ClojureScript statements in the browser context. | ||
|
||
For more info using the browser as a REPL environment, see | ||
[this](https://github.com/clojure/clojurescript/wiki/The-REPL-and-Evaluation-Environments#browser-as-evaluation-environment). | ||
|
||
Clean project specific out: | ||
|
||
lein clean | ||
Build a single release artifact with the following script and then open `index_release.html` in your browser. | ||
|
||
./scripts/release | ||
|
||
## License | ||
|
||
Copyright © 2015 FIXME | ||
|
||
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version. |
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,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>hello-npm</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
</head> | ||
<body> | ||
<script src="out/hello_npm.js" type="text/javascript"></script> | ||
</body> | ||
</html> |
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,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>hello-npm</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
</head> | ||
<body> | ||
<script src="release/hello_npm.js" type="text/javascript"></script> | ||
</body> | ||
</html> |
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,14 @@ | ||
{ | ||
"name": "hello-npm", | ||
"version": "0.0.1", | ||
"description": "An example module to illustrate the usage of ClojureScript and npm", | ||
"author": "Maria Geller ", | ||
"main": "lib/hello_npm.js", | ||
"dependencies": { | ||
}, | ||
"devDependencies": { | ||
}, | ||
"private": true, | ||
"license": "MIT", | ||
"keywords": [] | ||
} |
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,13 @@ | ||
(defproject hello-npm "0.1.0-SNAPSHOT" | ||
:description "FIXME: write this!" | ||
:url "http://example.com/FIXME" | ||
:dependencies [[org.clojure/clojure "1.7.0"] | ||
[org.clojure/clojurescript "1.7.170" :classifier "aot" | ||
:exclusion [org.clojure/data.json]] | ||
[org.clojure/data.json "0.2.6" :classifier "aot"]] | ||
:jvm-opts ^:replace ["-Xmx1g" "-server"] | ||
:plugins [[lein-npm "0.6.1"]] | ||
:npm {:dependencies [[source-map-support "0.3.2"]]} | ||
:source-paths ["src" "target/classes"] | ||
:clean-targets ["out" "release"] | ||
:target-path "target") |
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,2 @@ | ||
#!/bin/sh | ||
rlwrap lein trampoline run -m clojure.main scripts/brepl.clj |
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,2 @@ | ||
@echo off | ||
lein trampoline run -m clojure.main scripts\brepl.clj |
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,13 @@ | ||
(require | ||
'[cljs.build.api :as b] | ||
'[cljs.repl :as repl] | ||
'[cljs.repl.browser :as browser]) | ||
|
||
(b/build "src" | ||
{:main 'hello-npm.core | ||
:output-to "out/hello_npm.js" | ||
:output-dir "out" | ||
:verbose true}) | ||
|
||
(repl/repl (browser/repl-env) | ||
:output-dir "out") |
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,2 @@ | ||
#!/bin/sh | ||
rlwrap lein trampoline run -m clojure.main scripts/build.clj |
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,2 @@ | ||
@echo off | ||
lein trampoline run -m clojure.main scripts\build.clj |
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,14 @@ | ||
(require '[cljs.build.api :as b]) | ||
|
||
(println "Building ...") | ||
|
||
(let [start (System/nanoTime)] | ||
(b/build "src" | ||
{:main 'hello-npm.core | ||
:output-to "out/hello_npm.js" | ||
:output-dir "out" | ||
:verbose true | ||
:target :nodejs}) | ||
(println "... done. Elapsed" (/ (- (System/nanoTime) start) 1e9) "seconds")) | ||
|
||
|
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,2 @@ | ||
#!/bin/sh | ||
rlwrap lein trampoline run -m clojure.main scripts/release.clj |
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,2 @@ | ||
@echo off | ||
lein trampoline run -m clojure.main scripts\release.clj |
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,11 @@ | ||
(require '[cljs.build.api :as b]) | ||
|
||
(println "Building ...") | ||
|
||
(let [start (System/nanoTime)] | ||
(b/build "src" | ||
{:output-to "release/hello_npm.js" | ||
:output-dir "release" | ||
:optimizations :advanced | ||
:verbose true}) | ||
(println "... done. Elapsed" (/ (- (System/nanoTime) start) 1e9) "seconds")) |
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,2 @@ | ||
#!/bin/sh | ||
rlwrap lein trampoline run -m clojure.main scripts/repl.clj |
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,2 @@ | ||
@echo off | ||
lein trampoline run -m clojure.main scripts\repl.clj |
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 @@ | ||
(require | ||
'[cljs.repl :as repl] | ||
'[cljs.repl.node :as node]) | ||
|
||
(repl/repl (node/repl-env)) |
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,2 @@ | ||
#!/bin/sh | ||
rlwrap lein trampoline run -m clojure.main scripts/watch.clj |
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,2 @@ | ||
@echo off | ||
lein trampoline run -m clojure.main scripts\watch.clj |
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,6 @@ | ||
(require '[cljs.build.api :as b]) | ||
|
||
(b/watch "src" | ||
{:main 'hello-npm.core | ||
:output-to "out/hello_npm.js" | ||
:output-dir "out"}) |
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,13 @@ | ||
(ns hello-npm.core | ||
(:require [clojure.browser.repl :as repl] | ||
[cljs.nodejs :as nodejs])) | ||
|
||
;; (defonce conn | ||
;; (repl/connect "http://localhost:9000/repl")) | ||
|
||
(nodejs/enable-util-print!) | ||
|
||
(defn -main [& args] | ||
(println "Hello world!")) | ||
|
||
(set! *main-cli-fn* -main) |