Skip to content

Commit

Permalink
make use of entries; update README
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed May 1, 2022
1 parent ec44054 commit 08d66be
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 67 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ jobs:
&& git clone https://github.com/calcit-lang/calcit-test.git
- name: "test"
run: mode=ci cr -1
run: cr -1 --entry test

- run: mode=ci cr --emit-js -1 && yarn && yarn webpack && mode=ci node ./js-out/bundle.js
- run: cr --emit-js -1 --entry test && node ./main.mjs
33 changes: 5 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,25 @@ Calcit Workflow
### Usages

Install [calcit-runner](https://github.com/calcit-lang/calcit_runner.rs) to run demo:
Install [Calcit](https://github.com/calcit-lang/calcit) to run demo:

```bash
cr -1 # run once

cr # run and watch
```

run in JavaScript:

```bash
cr --emit-js -1 # emit-js once
yarn webpack
node js-out/bundle.js # run code
```

watch reload js program:

```bash
cr --emit-js

# and watch and build with Webpack
hot=true webpack --watch

# run with hot reload
node js-out/bundle.js
```

run tests:

```bash
mode=ci cr -1

mode=ci node js-out/bundle.js
cr -1 --entry test
```

### esbuild

This demo provided Webpack for hot code replacement. To build, esbuild is a simpler tool:
run test in JavaScript:

```bash
esbuild main.js --bundle --outfile=js-out/bundle.js --platform=node
cr --emit-js -1 --entry test # emit-js once
node main.mjs # run code
```

### Workflow
Expand Down
63 changes: 33 additions & 30 deletions calcit.cirru

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions compact.cirru
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@

{} (:package |app)
:configs $ {} (:init-fn |app.main/main!) (:reload-fn |app.main/reload!) (:version nil)
:configs $ {} (:init-fn |app.main/main!) (:reload-fn |app.main/reload!) (:version |0.0.1)
:modules $ [] |calcit-test/ |calcit.std/
:entries $ {}
:test $ {} (:init-fn |app.test/main!) (:reload-fn |app.test/reload!)
:modules $ [] |calcit-test/
:files $ {}
|app.main $ {}
:defs $ {}
|calling-func $ quote
defn calling-func () $ println "\"todo bcc"
|main! $ quote
defn main! () $ if
= "\"ci" $ get-env "\"mode"
run-tests
do (echo "|Run app")
set-interval 2000 $ fn () (calling-func)
defn main! () (run-tests)
set-interval 2000 $ fn () (calling-func)
|on-error $ quote
defn on-error (message) (; draw-error-message message)
|reload! $ quote
Expand All @@ -24,6 +23,10 @@
calcit.std.time :refer $ set-interval
|app.test $ {}
:defs $ {}
|main! $ quote
defn main! () $ run-tests
|reload! $ quote
defn reload! () $ println "\"TODO reload"
|run-tests $ quote
defn run-tests () (reset! *quit-on-failure? true) (test-add)
|test-add $ quote
Expand Down
2 changes: 1 addition & 1 deletion main.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { main_$x_, reload_$x_ } from "./js-out/app.main.mjs"
import { main_$x_, reload_$x_ } from "./js-out/app.test.mjs"

main_$x_()

0 comments on commit 08d66be

Please sign in to comment.