-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli/templates) add clojurescript
- Loading branch information
1 parent
2972a91
commit d9f392a
Showing
17 changed files
with
219 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,6 @@ | ||
--- | ||
"create-tauri-app": patch | ||
"create-tauri-app-js": patch | ||
--- | ||
|
||
Add `clojurescript` template. |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
packages/cli/fragments/fragment-clojurescript/.vscode/extensions.json
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 @@ | ||
{ | ||
"recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"] | ||
} |
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,7 @@ | ||
# Tauri + ClojureScript | ||
|
||
This template should help get you started developing with Tauri and ClojureScript + shadow-cljs. | ||
|
||
## Recommended IDE Setup | ||
|
||
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) |
13 changes: 13 additions & 0 deletions
13
packages/cli/fragments/fragment-clojurescript/_cta_manifest_
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 @@ | ||
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# SPDX-License-Identifier: MIT | ||
|
||
beforeDevCommand = {{pkg_manager_run_command}} dev | ||
beforeBuildCommand = {{pkg_manager_run_command}} build | ||
devPath = http://localhost:3000 | ||
distDir = ../dist | ||
withGlobalTauri = true | ||
|
||
[files] | ||
cljs.svg = public/cljs.svg | ||
tauri.svg = public/tauri.svg |
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,23 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
.cpcache | ||
.clj-kondo/.cache | ||
.shadow-cljs | ||
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,11 @@ | ||
{:paths ["src/main/clojure"] | ||
|
||
:deps {reagent/reagent {:mvn/version "1.1.1" | ||
:exclusions [cljsjs/react | ||
cljsjs/react-dom | ||
cljsjs/react-dom-server]}} | ||
|
||
:aliases {:develop {:extra-deps {thheller/shadow-cljs {:mvn/version "2.20.1"} | ||
binaryage/devtools {:mvn/version "1.0.6"}}} | ||
|
||
:test {:extra-paths ["src/test/clojure"]}}} |
22 changes: 22 additions & 0 deletions
22
packages/cli/fragments/fragment-clojurescript/karma.config.js
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,22 @@ | ||
module.exports = function (config) { | ||
config.set({ | ||
singleRun: true, | ||
browsers: ["ChromeHeadlessNoSandbox"], | ||
customLaunchers: { | ||
ChromeHeadlessNoSandbox: { | ||
base: "ChromeHeadless", | ||
flags: ["--no-sandbox"], | ||
}, | ||
}, | ||
basePath: "target", | ||
files: ["test/js/ci.js"], | ||
frameworks: ["cljs-test"], | ||
plugins: ["karma-cljs-test", "karma-chrome-launcher"], | ||
colors: true, | ||
logLevel: config.LOG_INFO, | ||
client: { | ||
args: ["shadow.test.karma.init"], | ||
singleRun: true, | ||
}, | ||
}); | ||
}; |
28 changes: 28 additions & 0 deletions
28
packages/cli/fragments/fragment-clojurescript/package.json
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,28 @@ | ||
{ | ||
"name": "{{package_name}}", | ||
"private": true, | ||
"version": "0.0.0", | ||
"scripts": { | ||
"shadow:watch": "npx shadow-cljs watch app test", | ||
"shadow:build": "npx shadow-cljs release app", | ||
"test:build": "npx shadow-cljs compile ci", | ||
"test:run": "npx karma start karma.config.js --single-run", | ||
"clean": "rm -rf ./public/js ./target", | ||
"dev": "npm run clean && npm run shadow:watch", | ||
"test": "npm run clean && npm run test:build && npm run test:run", | ||
"build": "npm run clean && npm run shadow:build", | ||
"tauri": "tauri" | ||
}, | ||
"devDependencies": { | ||
"@tauri-apps/cli": "^1.0.5", | ||
"karma": "^6.4.0", | ||
"karma-chrome-launcher": "^3.1.1", | ||
"karma-cljs-test": "^0.1.0", | ||
"shadow-cljs": "^2.20.1" | ||
}, | ||
"dependencies": { | ||
"@tauri-apps/api": "^1.0.5", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2" | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/cli/fragments/fragment-clojurescript/public/index.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 lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/cljs.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Tauri + ClojureScript</title> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
<script src="/js/main.js"></script> | ||
</body> | ||
</html> |
23 changes: 23 additions & 0 deletions
23
packages/cli/fragments/fragment-clojurescript/shadow-cljs.edn
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,23 @@ | ||
{:deps {:aliases [:develop :test]} | ||
|
||
:nrepl {:init-ns user} | ||
|
||
:dev-http {3000 "public" | ||
3001 "target/test"} | ||
|
||
:build-defaults {:closure-defines {goog.DEBUG true} | ||
:compiler-options {:output-feature-set :es-next}} | ||
|
||
:builds {:app {:target :browser | ||
:output-dir "public/js" | ||
:asset-path "/js" | ||
:modules {:main {:init-fn app.core/-main}} | ||
:devtools {:preloads [devtools.preload]} | ||
:dev {:external-config {:devtools/config {:features-to-install [:formatters :hints]}}}} | ||
|
||
:test {:target :browser-test | ||
:test-dir "target/test" | ||
:devtools {}} | ||
|
||
:ci {:target :karma | ||
:output-to "target/test/js/ci.js"}}} |
25 changes: 25 additions & 0 deletions
25
packages/cli/fragments/fragment-clojurescript/src/main/clojure/app/core.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,25 @@ | ||
(ns app.core | ||
(:require | ||
[goog.dom :as gdom] | ||
[reagent.dom :as dom])) | ||
|
||
|
||
(defn square | ||
[x] | ||
(* x x)) | ||
|
||
|
||
(defn mount-root | ||
"Mount root component." | ||
{:dev/after-load true} | ||
[] | ||
(some->> | ||
(gdom/getElement "root") | ||
(dom/render [:h1 "Welcome to Tauri!"]))) | ||
|
||
|
||
(defn -main | ||
"Application entry point." | ||
{:export true} | ||
[& _args] | ||
(mount-root)) |
9 changes: 9 additions & 0 deletions
9
packages/cli/fragments/fragment-clojurescript/src/test/clojure/app/core_test.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,9 @@ | ||
(ns app.core-test | ||
(:require | ||
[app.core :as sut] | ||
[cljs.test :as t :include-macros true])) | ||
|
||
|
||
(t/deftest square-test | ||
(t/testing "dummy test" | ||
(t/is (= 4 (sut/square 2))))) |
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