Skip to content
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

feat(cli/templates) add clojurescript #185

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/clojurescript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"create-tauri-app": minor
"create-tauri-app-js": minor
---

Add `clojurescript` template.
1 change: 1 addition & 0 deletions .scripts/generate-templates-matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const nodeJsTemplates = [
"next-ts",
"preact",
"preact-ts",
"clojurescript",
];

const matrixConfig = [
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Currently supported template presets include:
- `preact`
- `preact-ts`
- `angular`
- `clojurescript`
just-sultanov marked this conversation as resolved.
Show resolved Hide resolved

You can use `.` for the project name to scaffold in the current directory.

Expand Down
3 changes: 2 additions & 1 deletion packages/cli/fragments/fragment-angular/_cta_manifest_
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ devPath = http://localhost:1420
distDir = ../dist

[files]
tauri.svg = src/assets/tauri.svg
tauri.svg = src/assets/tauri.svg
style.css = src/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"tauri-apps.tauri-vscode",
"rust-lang.rust-analyzer",
"betterthantomorrow.calva"
]
}
7 changes: 7 additions & 0 deletions packages/cli/fragments/fragment-clojurescript/README.md
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) + [calva](https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.calva)
7 changes: 7 additions & 0 deletions packages/cli/fragments/fragment-clojurescript/_[pnpm]_.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# You can remove these settings if you use `yarn` or `npm`.
# These settings allow us to use `pnpm` as a package manager.
# Without these settings, we will receive several errors from the compiler:
# `object-assign`, `scheduler`, `scheduler/tracing` is not available.

public-hoist-pattern[]='object-assign'
public-hoist-pattern[]='scheduler'
12 changes: 12 additions & 0 deletions packages/cli/fragments/fragment-clojurescript/_cta_manifest_
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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:1420
distDir = ../public

[files]
tauri.svg = public/tauri.svg
style.css = public/style.css
23 changes: 23 additions & 0 deletions packages/cli/fragments/fragment-clojurescript/_gitignore
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
20 changes: 20 additions & 0 deletions packages/cli/fragments/fragment-clojurescript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "{{package_name}}",
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "shadow-cljs watch app",
"build": "shadow-cljs release app",
"shadow-cljs": "shadow-cljs",
"tauri": "tauri"
},
"devDependencies": {
"@tauri-apps/cli": "^1.1.1",
"shadow-cljs": "^2.20.2"
},
"dependencies": {
"@tauri-apps/api": "^1.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2"
}
}
28 changes: 28 additions & 0 deletions packages/cli/fragments/fragment-clojurescript/public/cljs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions packages/cli/fragments/fragment-clojurescript/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/cljs.svg" />
<link rel="stylesheet" href="/style.css" />
<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>
10 changes: 10 additions & 0 deletions packages/cli/fragments/fragment-clojurescript/shadow-cljs.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{:source-paths ["src/main/clojure"]

:dependencies [[reagent/reagent "1.1.1"]]

:dev-http {1420 "public"}

:builds {:app {:target :browser
:output-dir "public/js"
:asset-path "/js"
:modules {:main {:init-fn app.core/main}}}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
(ns app.core
(:require
["@tauri-apps/api/tauri" :as tauri]
[goog.dom :as gdom]
[reagent.core :as r]
[reagent.dom :as dom]))

(def root
(let [*name (r/atom "")
*message (r/atom "")
handle-input (fn [new-value]
(reset! *name new-value))
greet! (fn [name]
;; Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
(-> (.invoke tauri "greet" #js {:name name})
(.then (fn [res]
(reset! *message res)))))]
(fn []
[:div.container
[:h1 "Welcome to Tauri!"]

[:div.row
[:a {:href "https://tauri.app" :target "_blank"}
[:img {:src "/tauri.svg" :class "logo tauri" :alt "Tauri logo"}]]
[:a {:href "https://clojurescript.org" :target "_blank"}
[:img {:src "/cljs.svg" :class "logo tauri" :alt "ClojureScript logo"}]]]

[:p "Click on the Tauri, ClojureScript logos to learn more."]

[:div.row
[:input {:type "text"
:id "greet-input"
:on-change #(handle-input (.. % -target -value))
:placeholder "Enter a name..."}]
[:button {:type "button" :on-click #(greet! @*name)} "Greet"]]

[:p @*message]])))


(defn mount-root
"Mount root component."
{:dev/after-load true}
[]
(some->>
(gdom/getElement "root")
(dom/render [root])))


(defn main
"Application entry point."
{:export true}
[& _args]
(mount-root))
3 changes: 2 additions & 1 deletion packages/cli/fragments/fragment-next-ts/_cta_manifest_
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ distDir = ../dist
[files]
next.svg = src/assets/next.svg
react.svg = src/assets/react.svg
tauri.svg = src/assets/tauri.svg
tauri.svg = src/assets/tauri.svg
style.css = src/style.css
3 changes: 2 additions & 1 deletion packages/cli/fragments/fragment-next/_cta_manifest_
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ distDir = ../dist
[files]
next.svg = src/assets/next.svg
react.svg = src/assets/react.svg
tauri.svg = src/assets/tauri.svg
tauri.svg = src/assets/tauri.svg
style.css = src/style.css
3 changes: 2 additions & 1 deletion packages/cli/fragments/fragment-preact-ts/_cta_manifest_
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ distDir = ../dist
[files]
preact.svg = src/assets/preact.svg
vite.svg = public/vite.svg
tauri.svg = public/tauri.svg
tauri.svg = public/tauri.svg
style.css = src/style.css
3 changes: 2 additions & 1 deletion packages/cli/fragments/fragment-preact/_cta_manifest_
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ distDir = ../dist
[files]
preact.svg = src/assets/preact.svg
vite.svg = public/vite.svg
tauri.svg = public/tauri.svg
tauri.svg = public/tauri.svg
style.css = src/style.css
3 changes: 2 additions & 1 deletion packages/cli/fragments/fragment-react-ts/_cta_manifest_
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ distDir = ../dist
[files]
react.svg = src/assets/react.svg
vite.svg = public/vite.svg
tauri.svg = public/tauri.svg
tauri.svg = public/tauri.svg
style.css = src/style.css
3 changes: 2 additions & 1 deletion packages/cli/fragments/fragment-react/_cta_manifest_
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ distDir = ../dist
[files]
react.svg = src/assets/react.svg
vite.svg = public/vite.svg
tauri.svg = public/tauri.svg
tauri.svg = public/tauri.svg
style.css = src/style.css
3 changes: 2 additions & 1 deletion packages/cli/fragments/fragment-solid-ts/_cta_manifest_
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ distDir = ../dist
[files]
vite.svg = public/vite.svg
tauri.svg = public/tauri.svg
solid.svg = src/assets/logo.svg
solid.svg = src/assets/logo.svg
style.css = src/style.css
3 changes: 2 additions & 1 deletion packages/cli/fragments/fragment-solid/_cta_manifest_
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ distDir = ../dist
[files]
vite.svg = public/vite.svg
tauri.svg = public/tauri.svg
solid.svg = src/assets/logo.svg
solid.svg = src/assets/logo.svg
style.css = src/style.css
3 changes: 2 additions & 1 deletion packages/cli/fragments/fragment-svelte-ts/_cta_manifest_
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ distDir = ../dist
[files]
vite.svg = public/vite.svg
tauri.svg = public/tauri.svg
svelte.svg = public/svelte.svg
svelte.svg = public/svelte.svg
style.css = src/style.css
3 changes: 2 additions & 1 deletion packages/cli/fragments/fragment-svelte/_cta_manifest_
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ distDir = ../dist
[files]
vite.svg = public/vite.svg
tauri.svg = public/tauri.svg
svelte.svg = public/svelte.svg
svelte.svg = public/svelte.svg
style.css = src/style.css
1 change: 1 addition & 0 deletions packages/cli/fragments/fragment-vanilla-ts/_cta_manifest_
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ withGlobalTauri = true
[files]
tauri.svg = src/assets/tauri.svg
vite.svg = src/assets/vite.svg
style.css = src/style.css
3 changes: 2 additions & 1 deletion packages/cli/fragments/fragment-vanilla/_cta_manifest_
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ distDir = ../src
withGlobalTauri = true

[files]
tauri.svg = src/assets/tauri.svg
tauri.svg = src/assets/tauri.svg
style.css = src/style.css
3 changes: 2 additions & 1 deletion packages/cli/fragments/fragment-vue-ts/_cta_manifest_
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ distDir = ../dist
[files]
vite.svg = public/vite.svg
tauri.svg = public/tauri.svg
vue.svg = src/assets/vue.svg
vue.svg = src/assets/vue.svg
style.css = src/style.css
3 changes: 2 additions & 1 deletion packages/cli/fragments/fragment-vue/_cta_manifest_
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ distDir = ../dist
[files]
vite.svg = public/vite.svg
tauri.svg = public/tauri.svg
vue.svg = src/assets/vue.svg
vue.svg = src/assets/vue.svg
style.css = src/style.css
3 changes: 2 additions & 1 deletion packages/cli/fragments/fragment-yew/_cta_manifest_
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ distDir = ../dist
withGlobalTauri = true

[files]
tauri.svg = public/tauri.svg
tauri.svg = public/tauri.svg
style.css = src/style.css
1 change: 1 addition & 0 deletions packages/cli/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Currently supported template presets include:
- `preact`
- `preact-ts`
- `angular`
- `clojurescript`

You can use `.` for the project name to scaffold in the current directory.

Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/package_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ impl PackageManager {
Template::NextTs,
Template::Preact,
Template::PreactTs,
Template::ClojureScript,
],
}
}
Expand Down
Loading