-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Tailwind + ability of options + nubank/workspaces #8
Open
narocath
wants to merge
8
commits into
master
Choose a base branch
from
option+tailwind+nubank
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1543093
"added tailwind-nubank workspaces-ability to use options"
narocath 02fb80a
cljstyle
narocath 11c50c9
updated README.md
narocath 6bf6b92
change +nubank to +workspaces
ianffcs 3a4d785
Add example test for main-panel
ianffcs c876f7d
comment's fixes
narocath 9af416d
cljstyle
narocath f5bf563
cljsstyle
narocath File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
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
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
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 |
---|---|---|
|
@@ -12,3 +12,4 @@ pom.xml.asc | |
.hgignore | ||
.hg/ | ||
.idea/ | ||
.lsp/ |
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,33 @@ | ||
{ | ||
"scripts": { | ||
"repl": "shadow-cljs node-repl", | ||
"clean": "rm -rf node_modules/ && rm -rf package-lock.json && rm -rf .shadow-cljs/ && rm -rf resources/public/js && rm -rf .lsp/", | ||
"tests": "shadow-cljs compile ci && npx karma start --single-run", | ||
"build": "shadow-cljs release app", | ||
"serve": "shadow-cljs watch app", | ||
"prebuild": "rm ./resources/public/main.css ; postcss ./src/frontend/base.css -o ./resources/public/main.css --env production", | ||
"preserve": "rm ./rsources/public/main.css ; postcss ./src/frontend/base.css -o ./resources/public/main.css" | ||
}, | ||
"dependencies": { | ||
"highlight.js": "9.18.5", | ||
"react": "17.0.2", | ||
"react-dom": "17.0.2", | ||
"react-grid-layout": "1.2.4", | ||
"react-icons": "4.2.0", | ||
"reakit": "1.3.6" | ||
}, | ||
"devDependencies": { | ||
"@fullhuman/postcss-purgecss": "^4.0.2", | ||
"autoprefixer": "^10.2.4", | ||
"cssnano": "^4.1.10", | ||
"postcss": "^8.2.8", | ||
"postcss-cli": "^8.3.1", | ||
"postcss-discard-comments": "^4.0.2", | ||
"shadow-cljs": "^2.11.26", | ||
"source-map-support": "^0.4.18", | ||
"tailwindcss": "^2.0.3", | ||
"@sinonjs/fake-timers": "^7.0.2", | ||
"@testing-library/react": "^11.2.5", | ||
"@testing-library/user-event": "^13.0.15" | ||
} | ||
} |
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,24 @@ | ||
const tailwindcss = require('tailwindcss'); | ||
const discard = require('postcss-discard-comments'); | ||
const cssnano = require('cssnano')({ | ||
preset: 'default', | ||
}) | ||
const purgecss = require('@fullhuman/postcss-purgecss')({ | ||
content: [ | ||
'./src/frontend/**/*.css', | ||
'./src/frontend/**/*.cljs', | ||
'./resources/public/**/*.css', | ||
], | ||
|
||
defaultExtractor: (content) => content.match(/[\w-/:]+(?<!:)/g) || [], | ||
}); | ||
|
||
module.exports = { | ||
plugins: [ | ||
tailwindcss('./tailwind.config.js'), | ||
require('autoprefixer'), | ||
...process.env.NODE_ENV === 'production' | ||
? [purgecss, discard, cssnano] | ||
: [], | ||
], | ||
}; |
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 |
---|---|---|
@@ -1,49 +1,39 @@ | ||
(defproject {{sanitized-name}} "0.1.0-SNAPSHOT" | ||
:description "FIXME: write description" | ||
:min-lein-version "2.0.0" | ||
:dependencies [[org.clojure/clojure "1.10.1"] | ||
[com.flexiana/framework "0.1.4"] | ||
[thheller/shadow-cljs "2.11.7"] | ||
[clj-http "3.12.0"] | ||
[reagent "0.10.0"] | ||
[re-frame "1.1.2"]] | ||
:plugins [[lein-shadow "0.3.1"] | ||
[lein-shell "0.5.0"]] | ||
:main ^:skip-aot {{name}} | ||
:uberjar-name "{{name}}.jar" | ||
:source-paths ["src/backend" "src/backend/app" "src/frontend" "src/shared"] | ||
:clean-targets ^{:protect false} ["resources/public/js/compiled" "target"] | ||
:profiles {:dev {:resource-paths ["config/dev"] | ||
:dependencies [[binaryage/devtools "1.0.2"]]} | ||
:local {:resource-paths ["config/local"]} | ||
:prod {:resource-paths ["config/prod"]} | ||
:test {:resource-paths ["config/test"] | ||
:dependencies [[kerodon "0.9.1"]]}} | ||
:shadow-cljs {:nrepl {:port 8777} | ||
|
||
:builds {:app {:target :browser | ||
:output-dir "resources/public/js/compiled" | ||
:asset-path "/js/compiled" | ||
:modules {:app {:init-fn {{sanitized-name}}.core/init | ||
:preloads [devtools.preload]}}}}} | ||
|
||
;:devtools {:http-root "resources/public" | ||
; :http-port 8280 | ||
; :http-handler {{name}}.handler/dev-handler | ||
; } | ||
|
||
|
||
:aliases {"ci" ["do" "clean," "cloverage," "lint," "uberjar"] | ||
"kondo" ["run" "-m" "clj-kondo.main" "--lint" "src" "test"] | ||
"lint" ["do" "kondo," "eastwood," "kibit"] | ||
"watch" ["with-profile" "dev" "do" | ||
["shadow" "watch" "app" "browser-test" "karma-test"]] | ||
"release" ["with-profile" "prod" "do" | ||
["shadow" "release" "app"]]} | ||
:migratus {:store :database | ||
:migration-dir "migrations" | ||
:db {:classname "com.mysql.jdbc.Driver" | ||
:subprotocol "postgres" | ||
:subname "//localhost/controllers" | ||
:user "postgres" | ||
:password "postgres"}}) | ||
:description "FIXME: write description" | ||
:min-lein-version "2.0.0" | ||
:dependencies [[org.clojure/clojure "1.10.1"] | ||
[com.flexiana/framework "0.1.4"] | ||
[thheller/shadow-cljs "2.11.26"] | ||
[clj-http "3.12.0"] | ||
[reagent "0.10.0"] | ||
[re-frame "1.1.2"]] | ||
:plugins [[migratus-lein "0.7.3"] | ||
[lein-shell "0.5.0"]] | ||
:main ^:skip-aot {{name}} | ||
:uberjar-name "{{name}}.jar" | ||
:source-paths ["src/backend" "src/backend/app" "src/frontend" "src/shared"] | ||
:clean-targets ^{:protect false} ["resources/public/js/compiled" "target"] | ||
:profiles {:dev {:resource-paths ["config/dev"] | ||
:dependencies [[binaryage/devtools "1.0.2"]]} | ||
:local {:resource-paths ["config/local"]} | ||
:prod {:resource-paths ["config/prod"]} | ||
:test {:resource-paths ["config/test"] | ||
:dependencies [{{#workspaces?}}[nubank/workspaces "1.0.16"]{{/workspaces?}} | ||
[binaryage/devtools "1.0.2"] | ||
[nubank/matcher-combinators "3.1.4"] | ||
[day8.re-frame/test "0.1.5"] | ||
[kerodon "0.9.1"]]}} | ||
:aliases {"ci" ["do" "clean," "cloverage," "lint," "uberjar"] | ||
"kondo" ["run" "-m" "clj-kondo.main" "--lint" "src" "test"] | ||
"repl" ["with-profile" "+test" "run" "-m" "shadow.cljs.devtools.cli" "server"] | ||
"workspaces" ["with-profile" "+test" "run" "-m" "shadow.cljs.devtools.cli" "watch" "workspaces"] | ||
"app" ["with-profile" "+test" "run" "-m" "shadow.cljs.devtools.cli" "watch" "app"] | ||
"lint" ["do" "kondo," "eastwood," "kibit"] | ||
"release" ["with-profile" "prod" "run" "-m" "shadow.cljs.devtools.cli" "release" "app"]} | ||
:migratus {:store :database | ||
:migration-dir "migrations" | ||
:db {:classname "com.mysql.jdbc.Driver" | ||
:subprotocol "postgres" | ||
:subname "//localhost:5433/frankie" | ||
:user "postgres" | ||
:password "postgres"}}) |
14 changes: 14 additions & 0 deletions
14
resources/leiningen/new/xiana/resources/public/workspaces.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 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<!-- you might need to change the js path depending on your configuration --> | ||
<script src="assets/js/workspaces/main.js" type="text/javascript"></script> | ||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css"> | ||
</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,17 @@ | ||
{:lein true | ||
:nrepl {:port 8777} | ||
:builds {:app | ||
{:target :browser | ||
:build-hooks [(hooks/purge-css) | ||
(hooks/npm-init)] | ||
:output-dir "resources/public/js/app" | ||
:asset-path "/js/app" | ||
:modules {:main {:init-fn {{sanitized-name}} .core/init | ||
:preloads [devtools.preload]}}} | ||
{{#workspaces?}} | ||
:workspaces | ||
{:target :browser | ||
:output-dir "resources/public/js/workspaces" | ||
:asset-path "/js/workspaces" | ||
:modules {:main {:entries [{{sanitized-name}}.workspaces] | ||
:preloads [devtools.preload]}}} {{/workspaces?}}}} |
10 changes: 6 additions & 4 deletions
10
resources/leiningen/new/xiana/src/backend/app/controllers/index.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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
(ns controllers.index | ||
(:require [xiana.core :as xiana] | ||
[ring.util.response :as ring])) | ||
(:require | ||
[ring.util.response :as ring] | ||
[xiana.core :as xiana])) | ||
|
||
|
||
(defn handle-index | ||
[state] | ||
(xiana/ok | ||
(assoc state | ||
:response | ||
(ring/response "Index page")))) | ||
:response | ||
(ring/response "Index page")))) |
17 changes: 13 additions & 4 deletions
17
resources/leiningen/new/xiana/src/backend/app/controllers/re_frame.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 |
---|---|---|
@@ -1,12 +1,21 @@ | ||
(ns controllers.re-frame | ||
(:require [xiana.core :as xiana] | ||
[ring.util.response :as ring])) | ||
|
||
(defn handle-index | ||
{{#workspaces?}} | ||
(defn handle-workspaces | ||
[state] | ||
(xiana/ok | ||
(assoc state | ||
:response | ||
(-> "index.html" | ||
(-> "workspaces.html" | ||
(ring/resource-response {:root "public"}) | ||
(ring/header "Content-Type" "text/html; charset=utf-8"))))) | ||
(ring/header "Content-Type" "text/html; charset=utf-8"))))){{/workspaces?}} | ||
|
||
(defn handle-index | ||
[state] | ||
(xiana/ok | ||
(assoc state | ||
:response | ||
(-> "index.html" | ||
(ring/resource-response {:root "public"}) | ||
(ring/header "Content-Type" "text/html; charset=utf-8"))))) |
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
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
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
18 changes: 18 additions & 0 deletions
18
resources/leiningen/new/xiana/src/frontend/app_name/workspaces.cljs
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,18 @@ | ||
(ns {{sanitized-name}}.workspaces | ||
(:require | ||
[{{sanitized-name}}.events :as events] | ||
[{{sanitized-name}}.views :as views] | ||
[nubank.workspaces.card-types.react :refer [react-card]] | ||
[nubank.workspaces.core :as ws] | ||
[nubank.workspaces.model :as wsm] | ||
[re-frame.core :as re-frame] | ||
[reagent.core :as r])) | ||
|
||
(defonce init (ws/mount)) | ||
|
||
(re-frame/clear-subscription-cache!) | ||
|
||
(ws/defcard init-card | ||
(re-frame/dispatch-sync [::events/initialize-db]) | ||
(react-card | ||
(r/as-element [views/main-panel]))) |
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,3 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
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,46 @@ | ||
(ns hooks | ||
(:require | ||
[clojure.java.io :as io] | ||
[clojure.java.shell :refer [sh]] | ||
[clojure.string :as s])) | ||
|
||
|
||
(defn exec | ||
[& cmd] | ||
(let [cmd (s/split (s/join " " (flatten cmd)) #"\s+") | ||
_ (println (s/join " " cmd)) | ||
{:keys [exit out err]} (apply sh cmd)] | ||
(if (zero? exit) | ||
(when-not (s/blank? out) | ||
(println out)) | ||
(println err)))) | ||
|
||
|
||
(defn npm-init | ||
{:shadow.build/stage :configure} | ||
[build-state] | ||
(if-not (and (.isDirectory (io/file "node_modules")) | ||
(not (= 0 (count (.list (io/file "node_modules")))))) | ||
(do (println ";;=>> 'Installing node_modules...") | ||
(exec "npm install") | ||
build-state) | ||
(do (println ";;=>> 'npm is already initialized in the current project'") | ||
build-state))) | ||
|
||
|
||
(defn purge-css | ||
{:shadow.build/stage :flush} | ||
[build-state] | ||
(case (:shadow.build/mode build-state) | ||
:release | ||
(do | ||
(println ";;=> 'Running prebuild script with -env production'") | ||
(exec "npm run-script prebuild") | ||
build-state) | ||
:dev | ||
(if (not (.exists (io/file "resources/public/main.css"))) | ||
(do | ||
(println ";;=> 'Runnnig preserve script'") | ||
(exec "npm run-script preserve") | ||
build-state) | ||
build-state))) |
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 @@ | ||
const colors = require('tailwindcss/colors') | ||
|
||
module.exports ={ | ||
darkMode: 'class', | ||
theme: {}, | ||
variants: {}, | ||
plugins: [], | ||
purge: {enabled: false}, | ||
future: { | ||
removeDeprecatedGapUtilities: true, | ||
prugeLayersByDefault: true, | ||
}, | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My preference is defonce in this place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed it to defonce