Skip to content

Commit f189760

Browse files
authored
Merge pull request #7 from mvc-works/reset-workflow
resetting to new calcit-lang workflow
2 parents 02ac636 + 83bbf78 commit f189760

File tree

23 files changed

+1608
-1866
lines changed

23 files changed

+1608
-1866
lines changed

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11

2-
calcit.edn -diff linguist-generated
3-
calcit.cirru -diff
2+
calcit.cirru -diff linguist-generated
43
yarn.lock -diff linguist-generated

.github/workflows/upload.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Upload
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
pull_request: {}
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Get yarn cache
17+
id: yarn-cache
18+
run: echo "::set-output name=dir::$(yarn cache dir)"
19+
20+
- uses: actions/cache@v2
21+
name: Cache node modules of yarn
22+
with:
23+
path: ${{ steps.yarn-cache.outputs.dir }}
24+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
25+
restore-keys: |
26+
${{ runner.os }}-yarn-
27+
28+
- name: ACTIONS_ALLOW_UNSECURE_COMMANDS
29+
id: ACTIONS_ALLOW_UNSECURE_COMMANDS
30+
run: echo 'ACTIONS_ALLOW_UNSECURE_COMMANDS=true' >> $GITHUB_ENV
31+
32+
- name: add cr
33+
run: |
34+
mkdir -p $GITHUB_WORKSPACE/bin
35+
wget -O $GITHUB_WORKSPACE/bin/cr http://repo.calcit-lang.org/binaries/linux/cr
36+
chmod +x $GITHUB_WORKSPACE/bin/cr
37+
echo "::add-path::$GITHUB_WORKSPACE/bin"
38+
39+
- name: "prepare modules"
40+
run: >
41+
mkdir -p ~/.config/calcit/modules/ && cd ~/.config/calcit/modules/
42+
&& git clone https://github.com/calcit-lang/lilac.git
43+
&& git clone https://github.com/calcit-lang/memof.git
44+
&& git clone https://github.com/Respo/respo.calcit.git
45+
&& git clone https://github.com/Respo/reel.calcit.git
46+
&& git clone https://github.com/Respo/respo-markdown.calcit.git
47+
&& git clone https://github.com/Respo/respo-ui.calcit.git
48+
49+
- name: "compiles to js"
50+
run: >
51+
cr --emit-js --once
52+
&& yarn && yarn vite build --base=./
53+
54+
- name: Deploy to server
55+
id: deploy
56+
uses: Pendect/action-rsyncer@v1.1.0
57+
env:
58+
DEPLOY_KEY: ${{secrets.rsync_private_key}}
59+
with:
60+
flags: '-avzr --progress'
61+
options: ''
62+
ssh_options: ''
63+
src: 'dist/*'
64+
dest: 'rsync-user@tiye.me:/web-assets/repo/${{ github.repository }}'
65+
66+
- name: Display status from deploy
67+
run: echo "${{ steps.deploy.outputs.status }}"

.gitignore

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11

2-
/target/
3-
/dist
4-
/node_modules
5-
.cpcache/
6-
.shadow-cljs/
2+
.compact-inc.cirru
3+
.calcit-error.cirru
74

8-
.nrepl-port
5+
js-out/
6+
node_modules/
7+
dist/
File renamed without changes.

calcit.cirru

Lines changed: 1202 additions & 945 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/build/main.clj

Lines changed: 0 additions & 27 deletions
This file was deleted.

compact.cirru

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
2+
{} (:package |text-diff)
3+
:configs $ {} (:init-fn |text-diff.main/main!) (:reload-fn |text-diff.main/reload!)
4+
:modules $ [] |respo.calcit/ |lilac/ |memof/ |respo-ui.calcit/ |respo-markdown.calcit/ |reel.calcit/
5+
:version nil
6+
:files $ {}
7+
|text-diff.config $ {}
8+
:ns $ quote (ns text-diff.config)
9+
:defs $ {}
10+
|cdn? $ quote
11+
def cdn? $ cond
12+
exists? js/window
13+
, false
14+
(exists? js/process) (= "\"true" js/process.env.cdn)
15+
:else false
16+
|dev? $ quote
17+
def dev? $ = "\"dev" (get-env "\"mode")
18+
|site $ quote
19+
def site $ {} (:dev-ui "\"http://localhost:8100/main-fonts.css") (:release-ui "\"http://cdn.tiye.me/favored-fonts/main-fonts.css") (:cdn-url "\"http://cdn.tiye.me/calcit-workflow/") (:title "\"Calcit") (:icon "\"http://cdn.tiye.me/logo/mvc-works.png") (:storage-key "\"workflow")
20+
|text-diff.schema $ {}
21+
:ns $ quote (ns text-diff.schema)
22+
:defs $ {}
23+
|store $ quote
24+
def store $ {}
25+
:states $ {}
26+
:content |
27+
|text-diff.updater $ {}
28+
:ns $ quote
29+
ns text-diff.updater $ :require
30+
[] respo.cursor :refer $ [] update-states
31+
:defs $ {}
32+
|updater $ quote
33+
defn updater (store op op-data op-id op-time)
34+
case-default op
35+
do (println "\"Unknown op:" op) store
36+
:states $ update-states store op-data
37+
:content $ assoc store :content op-data
38+
:hydrate-storage op-data
39+
|text-diff.comp.container $ {}
40+
:ns $ quote
41+
ns text-diff.comp.container $ :require
42+
[] hsl.core :refer $ [] hsl
43+
[] respo-ui.core :as ui
44+
[] respo.core :refer $ [] defcomp >> <> div button textarea span input
45+
[] respo.comp.space :refer $ [] =<
46+
[] reel.comp.reel :refer $ [] comp-reel
47+
[] respo-md.comp.md :refer $ [] comp-md
48+
[] text-diff.config :refer $ [] dev?
49+
:defs $ {}
50+
|comp-container $ quote
51+
defcomp comp-container (reel)
52+
let
53+
store $ :store reel
54+
states $ :states store
55+
div
56+
{} $ :style (merge ui/global ui/row)
57+
textarea $ {}
58+
:value $ :content store
59+
:placeholder "\"Content"
60+
:style $ merge ui/expand ui/textarea
61+
{} $ :height 320
62+
:on-input $ fn (e d!)
63+
d! :content $ :value e
64+
=< |8px nil
65+
div
66+
{} $ :style ui/expand
67+
comp-md "|This is some content with `code`"
68+
=< |8px nil
69+
button $ {} (:style ui/button)
70+
:inner-text $ str |run
71+
:on-click $ fn (e d! m!)
72+
println $ :content store
73+
when dev? $ comp-reel (>> states :reel) reel ({})
74+
|text-diff.main $ {}
75+
:ns $ quote
76+
ns text-diff.main $ :require
77+
[] respo.core :refer $ [] render! clear-cache! realize-ssr!
78+
[] text-diff.comp.container :refer $ [] comp-container
79+
[] text-diff.updater :refer $ [] updater
80+
[] text-diff.schema :as schema
81+
[] reel.util :refer $ [] listen-devtools!
82+
[] reel.core :refer $ [] reel-updater refresh-reel
83+
reel.schema :as reel-schema
84+
[] text-diff.config :as config
85+
"\"./calcit.build-errors" :default build-errors
86+
"\"bottom-tip" :default hud!
87+
:defs $ {}
88+
|render-app! $ quote
89+
defn render-app! () $ render! mount-target (comp-container @*reel) dispatch!
90+
|persist-storage! $ quote
91+
defn persist-storage! (? e)
92+
.setItem js/localStorage (:storage-key config/site)
93+
format-cirru-edn $ :store @*reel
94+
|mount-target $ quote
95+
def mount-target $ .querySelector js/document |.app
96+
|*reel $ quote
97+
defatom *reel $ -> reel-schema/reel (assoc :base schema/store) (assoc :store schema/store)
98+
|main! $ quote
99+
defn main! ()
100+
println "\"Running mode:" $ if config/dev? "\"dev" "\"release"
101+
render-app!
102+
add-watch *reel :changes $ fn (r p) (render-app!)
103+
listen-devtools! |a dispatch!
104+
.addEventListener js/window |beforeunload persist-storage!
105+
; repeat! 60 persist-storage!
106+
let
107+
raw $ .getItem js/localStorage (:storage-key config/site)
108+
when (some? raw)
109+
dispatch! :hydrate-storage $ parse-cirru-edn raw
110+
println "|App started."
111+
|snippets $ quote
112+
defn snippets () $ println config/cdn?
113+
|dispatch! $ quote
114+
defn dispatch! (op op-data)
115+
when config/dev? $ println "\"Dispatch:" op
116+
reset! *reel $ reel-updater updater @*reel op op-data
117+
|reload! $ quote
118+
defn reload! () $ if (nil? build-errors)
119+
do (remove-watch *reel :changes) (clear-cache!)
120+
add-watch *reel :changes $ fn (reel prev) (render-app!)
121+
reset! *reel $ refresh-reel @*reel schema/store updater
122+
hud! "\"ok~" "\"Ok"
123+
hud! "\"error" build-errors

index.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
<!DOCTYPE html>
3+
<html>
4+
5+
<head>
6+
<title>TextDiff</title>
7+
<link href="https://cdn.tiye.me/logo/calcit.png" rel="icon" type="image/png" />
8+
<meta charset="utf-8">
9+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
10+
<link rel="stylesheet" type="text/css" href="https://cdn.tiye.me/favored-fonts/main-fonts.css">
11+
<link rel="stylesheet" type="text/css" href="./assets/main.css">
12+
</head>
13+
14+
<body>
15+
<div class="app" ></div>
16+
17+
<script type="module" src="./main.js" ></script>
18+
19+
</body>
20+
21+
</html>

main.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
import { main_$x_ } from "./js-out/text-diff.main.js"
3+
4+
main_$x_()
5+
6+
if (import.meta.hot) {
7+
import.meta.hot.accept('./js-out/text-diff.main.js', (main) => {
8+
main.reload_$x_()
9+
})
10+
}

0 commit comments

Comments
 (0)