Skip to content

Commit

Permalink
upgrade to latest respo and deps-library; alpha release
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed May 26, 2020
1 parent 477ada5 commit 40cab0c
Show file tree
Hide file tree
Showing 14 changed files with 503 additions and 313 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

name: Deploy package

on:
release:
types: [created]

jobs:
deploy:
name: Deploy

runs-on: ubuntu-latest

steps:
- run: curl -O https://download.clojure.org/install/linux-install-1.10.1.507.sh && chmod +x linux-install-1.10.1.507.sh && sudo ./linux-install-1.10.1.507.sh

- uses: actions/checkout@v2

- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
name: Cache node modules of yarn
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache Clojars
uses: actions/cache@v1
env:
cache-name: cache-clojars
with:
path: ~/.m2/repository
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('shadow-cljs.edn') }}
restore-keys: |
${{ runner.os }}-clojars
- name: run tests
run: 'yarn && yarn shadow-cljs compile client'

- run: echo Working on ${{ github.ref }}

- name: deploy to clojars
run: env CLOJARS_USERNAME=jiyinyiyong CLOJARS_PASSWORD=${{ secrets.CLOJARS_PASSWORD }} clojure -A:release
55 changes: 55 additions & 0 deletions .github/workflows/upload.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

name: Upload Assets

on:
pull_request: {}
push:
branches:
- master

jobs:
upload-assets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker://timbru31/java-node:latest

- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
name: Cache node modules of yarn
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache Clojars
uses: actions/cache@v1
env:
cache-name: cache-clojars
with:
path: ~/.m2/repository
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('shadow-cljs.edn') }}
restore-keys: |
${{ runner.os }}-clojars
- run: yarn && yarn build
name: Build web assets

- name: Deploy to server
id: deploy
uses: Pendect/action-rsyncer@v1.1.0
env:
DEPLOY_KEY: ${{secrets.rsync_private_key}}
with:
flags: '-avzr --progress'
options: ''
ssh_options: ''
src: 'dist/*'
dest: 'rsync-user@tiye.me:/web-assets/repo/${{ github.repository }}'

- name: Display status from deploy
run: echo "${{ steps.deploy.outputs.status }}"
173 changes: 93 additions & 80 deletions calcit.cirru

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
:paths ["src"]
:aliases {
:release {
:extra-deps {
appliedscience/deps-library {:mvn/version "0.3.4"}
}
:main-opts ["-m" "deps-library.release"]
}
}
}
8 changes: 0 additions & 8 deletions meyvn.edn

This file was deleted.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"description": "popup module for Respo",
"main": "index.js",
"scripts": {
"deploy": "clj -A:release",
"m2": "clj -A:release install",
"watch": "shadow-cljs watch client",
"serve": "http-server dist -s",
"build-cdn": "shadow-cljs clj-run build.main/build-cdn",
Expand All @@ -19,10 +21,11 @@
"author": "jiyinyiyong",
"license": "MIT",
"devDependencies": {
"http-server": "^0.11.1",
"shadow-cljs": "^2.8.69"
"http-server": "^0.12.3",
"shadow-cljs": "^2.9.10"
},
"dependencies": {
"node-notifier": "7.0.1",
"shortid": "^2.2.15"
}
}
6 changes: 6 additions & 0 deletions release.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{:version "0.3.0-a1"
:group-id "respo"
:artifact-id "inflow-popup"
:skip-tag true
:description "Local popup component for Respo"
:scm-url "https://github.com/Respo/inflow-popup"}
70 changes: 39 additions & 31 deletions shadow-cljs.edn
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@

{:source-paths ["src" "cli"]
:cache-blockers #{cumulo-util.build}
:dependencies [[mvc-works/hsl "0.1.2"]
[mvc-works/shell-page "0.1.10"]
[respo "0.11.4-a1"]
[respo/ui "0.3.13"]
[respo/value "0.2.5"]
[respo/reel "0.3.5"]
[cumulo/util "0.1.10"]
[medley "1.2.0"]
[cumulo/util "0.1.10"]
[org.clojure/core.incubator "0.1.4"]]
:repositories {"central" {:url "https://maven.aliyun.com/nexus/content/groups/public/"}
"clojars" {:url "https://mirrors.ustc.edu.cn/clojars/"}}
:open-file-command ["subl" ["%s:%s:%s" :file :line :column]]
:dev-http {7000 "target/"}
:builds {:client {:target :browser
:output-dir "target/"
:asset-path "./"
:modules {:client {:init-fn inflow-popup.main/main!}}
:devtools {:after-load inflow-popup.main/reload!
:loader-mode :script}
:compiler-options {:infer-externs :auto}
:release {:output-dir "dist/"
:module-hash-names 8
:build-options {:manifest-name "assets.edn"}}}
:page {:target :node-script
:output-to "target/page.js"
:main inflow-popup.page/main!
:devtools {:after-load inflow-popup.page/main!}}}}
{
:source-paths ["src" "cli"]
:cache-blockers #{cumulo-util.build}
:dependencies [
[mvc-works/hsl "0.1.2"]
[mvc-works/shell-page "0.1.10"]
[respo "0.12.1"]
[respo/ui "0.3.14"]
[respo/value "0.3.0"]
[respo/reel "0.4.1-a1"]
[cumulo/util "0.1.11"]
[medley "1.3.0"]
[cumulo/util "0.1.11"]
[org.clojure/core.incubator "0.1.4"]
]
:open-file-command [
"subl"
["%s:%s:%s" :file :line :column]
]
:dev-http {7000 "target/"}
:builds {
:client {
:target :browser, :output-dir "target/", :asset-path "./"
:modules {
:client {:init-fn inflow-popup.main/main!}
}
:devtools {:after-load inflow-popup.main/reload!, :loader-mode :script}
:compiler-options {:infer-externs :auto}
:release {
:output-dir "dist/", :module-hash-names 8
:build-options {:manifest-name "assets.edn"}
}
}
:page {
:target :node-script, :output-to "target/page.js", :main inflow-popup.page/main!
:devtools {:after-load inflow-popup.page/main!}
}
}
}
42 changes: 20 additions & 22 deletions src/inflow_popup/comp/container.cljs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

(ns inflow-popup.comp.container
(:require [hsl.core :refer [hsl]]
[respo.core :refer [defcomp cursor-> <> div input span button]]
[respo.core :refer [defcomp >> <> div input span button]]
[respo.comp.inspect :refer [comp-inspect]]
[inflow-popup.comp.dialog :refer [comp-dialog comp-menu-dialog]]
[inflow-popup.comp.dropdown :refer [comp-dropdown]]
Expand All @@ -18,43 +18,43 @@

(def initial-state {:show? false, :selected (first example-data), :show-menu? false})

(defn on-click [state] (fn [e d! m!] (m! (update state :show? not))))

(defcomp
comp-container
(reel)
(let [store (:store reel), states (:states store), state (or (:data states) initial-state)]
(let [store (:store reel)
states (:states store)
state (or (:data states) initial-state)
cursor []]
(div
{:style (merge widget/card typeset/page-default)}
(div
{:style (merge layout/row widget/card)}
(div {:style layout/field-area} (<> "a dialog"))
(div {:style widget/button, :on-click (on-click state)} (<> "Toggle"))
(div
{:style widget/button, :on-click (fn [e d!] (d! cursor (update state :show? not)))}
(<> "Toggle"))
(if (:show? state)
(comp-dialog
(fn [mutate!] (mutate! %cursor (update state :show? not)))
(div {} (<> "Inside")))))
(comp-dialog (fn [d!] (d! cursor (update state :show? not))) (div {} (<> "Inside")))))
(div
{:style (merge layout/row widget/card)}
(div {:style layout/field-area} (<> "a droplist"))
(cursor->
:dropdown
comp-dropdown
states
(comp-dropdown
(>> states :dropdown)
example-data
(:selected state)
(fn [next-item m!] (m! %cursor (assoc state :selected next-item)))))
(fn [next-item d!] (d! cursor (assoc state :selected next-item)))))
(div
{:style (merge layout/row widget/card)}
(div {:style layout/field-area} (<> "a menu dialog"))
(div
{:style widget/button, :on-click (fn [e d! m!] (m! (update state :show-menu? not)))}
{:style widget/button,
:on-click (fn [e d!] (d! cursor (update state :show-menu? not)))}
(<> "Toggle"))
(if (:show-menu? state)
(comp-menu-dialog
(fn [result d! m!]
(fn [result d!]
(println "result" result)
(m! %cursor (update state :show-menu? not)))
(d! cursor (update state :show-menu? not)))
{:haskell "Haskell",
:clojure "Clojure",
:elixir (div
Expand All @@ -64,19 +64,17 @@
(div
{:style (merge layout/row widget/card)}
(div {:style layout/field-area} (<> "Popup"))
(cursor->
:popup
comp-popup
states
(comp-popup
(>> states :popup)
{:trigger (<> "Launch"), :style {:background-color (hsl 0 0 96), :padding "0 8px"}}
(fn [toggle!]
(div
{}
(<> "Inside")
(=< 8 nil)
(button
{:style ui/button, :inner-text "Close", :on-click (fn [e d! m!] (toggle! m!))})))))
{:style ui/button, :inner-text "Close", :on-click (fn [e d!] (toggle! d!))})))))
(comp-inspect "state" state nil)
(cursor-> :reel comp-reel states reel {}))))
(comp-reel (>> states :reel) reel {}))))

(defn on-close [mutate!] (fn [] (mutate! :show?)))
8 changes: 4 additions & 4 deletions src/inflow_popup/comp/dialog.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

(ns inflow-popup.comp.dialog
(:require [respo.core :refer [defcomp cursor-> list-> <> div span]]
(:require [respo.core :refer [defcomp >> list-> <> div span]]
[inflow-popup.style.layout :as layout]
[inflow-popup.style.widget :as widget]
[inflow-popup.style.decoration :as decoration]
Expand All @@ -14,7 +14,7 @@
(on-close! element-inside)
(div
{:style (merge layout/float-fullscreen decoration/dim layout/hold-center {:z-index 100}),
:on-click (fn [e d! m!] (on-close! m!))}
:on-click (fn [e d!] (on-close! d!))}
(div {:on-click on-focus, :style widget/card} element-inside)))

(def style-menu-item
Expand All @@ -33,7 +33,7 @@
(assert (map? candidates) "candidates was supposed to be a map!")
(div
{:style (merge layout/float-fullscreen decoration/dim layout/hold-center {:z-index 100}),
:on-click (fn [e d! m!] (on-choose! nil d! m!))}
:on-click (fn [e d!] (on-choose! nil d!))}
(div
{:style {:background-color :white}}
(div
Expand All @@ -53,5 +53,5 @@
(fn [idx [k v]]
[idx
(div
{:on-click (fn [e d! m!] (on-choose! k d! m!)), :style style-menu-item}
{:on-click (fn [e d!] (on-choose! k d!)), :style style-menu-item}
(if (string? v) (<> v) v))])))))))
8 changes: 4 additions & 4 deletions src/inflow_popup/comp/dropdown.cljs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

(ns inflow-popup.comp.dropdown
(:require [hsl.core :refer [hsl]]
[respo.core :refer [defcomp cursor-> list-> <> div span style]]
[respo.core :refer [defcomp >> list-> <> div span style]]
[inflow-popup.style.layout :as layout]
[inflow-popup.style.widget :as widget]))

Expand Down Expand Up @@ -50,9 +50,9 @@
(defcomp
comp-dropdown
(states candidates current on-select)
(let [state (if (some? (:data states)) (:data states) false)]
(let [state (if (some? (:data states)) (:data states) false), cursor (:cursor states)]
(div
{:style (merge layout/row style-button), :on-click (fn [e d! m!] (m! (not state)))}
{:style (merge layout/row style-button), :on-click (fn [e d!] (d! cursor (not state)))}
(<> current (merge layout/flex style-text))
(div {:style style-divider})
(div
Expand All @@ -68,6 +68,6 @@
(div
{:class-name "dropdown-item",
:style style-item,
:on-click (fn [e d! m!] (on-select item m!) (m! (not state)))}
:on-click (fn [e d!] (on-select item d!) (d! cursor (not state)))}
(<> item))])))))
(if state item-hover-style))))
Loading

0 comments on commit 40cab0c

Please sign in to comment.