Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jruz committed Aug 18, 2023
0 parents commit ca34a1e
Show file tree
Hide file tree
Showing 30 changed files with 1,369 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: npm-publish
run-name: NPM Publish
on:
push:
branches:
- "main"
jobs:
check-bats-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18.17.1"
- name: NPM Publish
uses: JS-DevTools/[email protected]
with:
token: ${{ secrets.NPM_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.clj-kondo
.nrepl-port
.cpcache
.lsp
5 changes: 5 additions & 0 deletions .prettierrc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
trailingComma = "all"
semi = true
singleQuote = false
printWidth = 80
arrowParens = "always"
4 changes: 4 additions & 0 deletions .rtx.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[tools]
node = '18.17.1'
clojure = "1.11.1.1403"
java = "temurin-jre-17.0.8+7"
9 changes: 9 additions & 0 deletions .tmuxinator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: svelte-preprocess-cljs
root: .
windows:
- VIM:
layout: even-horizontal
panes:
- nvim
-
- GIT: ssh-agent zsh
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
ClojureScript preprocessor for Svelte using [Squint](https://github.com/squint-cljs/squint)

[Counter.svelte](example/src/lib/Counter.svelte)

```svelte
<script lang="cljs">
(def counter 0)
(defn increment []
(set! counter (inc counter)))
</script>
<button on:click={increment}>
count is {counter}
</button>
```

## Install

```bash
npm install -D svelte-preprocess-cljs
```

add to `svelte.config.js`

```js
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
import { cljsPreprocess } from "svelte-preprocess-squint";

export default {
preprocess: [cljsPreprocess(), vitePreprocess()],
};
```
9 changes: 9 additions & 0 deletions bb.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{:paths ["src"]
:tasks
{tmux (shell "tmuxinator local")
shell (shell "nix-shell")
lint (shell "clj-kondo --lang cljs --lint src")
prettier (shell "npx prettier . --write")
squint (shell "npx squint compile --extension js src/main.cljs")
build {:depends [squint prettier]}}}

2 changes: 2 additions & 0 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{:paths ["src"]
:deps {metosin/malli {:mvn/version "0.11.0"}}}
24 changes: 24 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
6 changes: 6 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Svelte + Vite + ClojureScript

Relevant files:

- [svelte.config.js](svelte.config.js)
- [Counter.svelte](src/lib/Counter.svelte)
13 changes: 13 additions & 0 deletions example/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Svelte</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
32 changes: 32 additions & 0 deletions example/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"compilerOptions": {
"moduleResolution": "bundler",
"target": "ESNext",
"module": "ESNext",
/**
* svelte-preprocess cannot figure out whether you have
* a value or a type, so tell TypeScript to enforce using
* `import type` instead of `import` for Types.
*/
"verbatimModuleSyntax": true,
"isolatedModules": true,
"resolveJsonModule": true,
/**
* To have warnings / errors of the Svelte compiler at the
* correct position, enable source maps by default.
*/
"sourceMap": true,
"esModuleInterop": true,
"skipLibCheck": true,
/**
* Typecheck JS in `.svelte` and `.js` files by default.
* Disable this if you'd like to use dynamic types.
*/
"checkJs": true
},
/**
* Use global.d.ts instead of compilerOptions.types
* to avoid limiting type declarations.
*/
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
}
Loading

0 comments on commit ca34a1e

Please sign in to comment.