Skip to content

Squint #39

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

Merged
merged 80 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
d7590ef
wip
borkdude Aug 30, 2023
0f71e16
wip
borkdude Sep 4, 2023
5ff263e
wip
borkdude Sep 5, 2023
3d85bf5
wip
borkdude Sep 5, 2023
21a5848
util
borkdude Sep 5, 2023
6d44367
close brackets
borkdude Sep 5, 2023
08d9886
match brackets
borkdude Sep 5, 2023
66385e0
formatting
borkdude Sep 5, 2023
b509991
selection history
borkdude Sep 5, 2023
ca8cd0e
commands
borkdude Sep 5, 2023
c6966d7
wip
borkdude Sep 5, 2023
2f8f8ff
wip
borkdude Sep 5, 2023
5e9ce6c
wip
borkdude Sep 11, 2023
adb9bf2
wip
borkdude Sep 11, 2023
03a4e10
wip
borkdude Sep 11, 2023
681e7c7
wip
borkdude Sep 11, 2023
3157c2d
wip
borkdude Sep 11, 2023
8cc9c4e
remove println
borkdude Sep 11, 2023
32cc525
wip
borkdude Sep 11, 2023
4a0ce8a
depend on squint
borkdude Sep 11, 2023
d860c7f
runtime dep on squint
borkdude Sep 11, 2023
35dcb84
wip
borkdude Sep 11, 2023
f75d74e
bump squint
borkdude Sep 11, 2023
fffcd3c
css not working
borkdude Sep 11, 2023
de473a5
css not working
borkdude Sep 11, 2023
29b7c2b
css
borkdude Sep 11, 2023
99a638f
Bump squint
borkdude Sep 11, 2023
39826fb
wip
borkdude Sep 11, 2023
348156c
Bumps squint
borkdude Sep 12, 2023
1f7e845
tests wip
borkdude Sep 12, 2023
66071b6
test wip
borkdude Sep 12, 2023
9f5f979
more tests
borkdude Sep 12, 2023
a69ed63
tests
borkdude Sep 12, 2023
597a253
test wip
borkdude Sep 12, 2023
c903175
test
borkdude Sep 12, 2023
7b7bc69
found one failing test
borkdude Sep 12, 2023
08d4d84
failing test
borkdude Sep 12, 2023
7546f33
fix set op
borkdude Oct 3, 2023
0b3ca3c
port tsts
borkdude Oct 3, 2023
449dec0
[wip] [skip ci]
borkdude Oct 3, 2023
ee353dd
yo
borkdude Oct 3, 2023
cb067bf
oops
borkdude Oct 3, 2023
c9156af
add instruction to use local squint
borkdude Oct 9, 2023
5d0d26d
wip [skip ci]
borkdude Oct 9, 2023
da74a56
wip [skip ci]
borkdude Oct 10, 2023
b7310c2
wip [skip ci]
borkdude Oct 10, 2023
4d8d462
wip
borkdude Oct 10, 2023
20d9603
port close-brackets
borkdude Oct 10, 2023
e5d7817
js-interop compatible
borkdude Oct 24, 2023
c1b6648
Bump squint to pinned version
borkdude Oct 24, 2023
c65d2d8
debug
borkdude Oct 24, 2023
e217d3c
https
borkdude Oct 24, 2023
3e5d3a7
Add squint test
borkdude Oct 24, 2023
22d75a2
wip [skip ci]
borkdude Oct 24, 2023
9189492
stable squint
borkdude Oct 24, 2023
864a6b2
delete
borkdude Oct 24, 2023
dcaf817
port close-brackets
borkdude Oct 24, 2023
3acca1f
wip [skip ci]
borkdude Oct 24, 2023
9412ba6
wip [skip ci] [broken]
borkdude Oct 24, 2023
284fb40
wip [skip ci]
borkdude Oct 24, 2023
55fb3c2
del util.cljs
borkdude Oct 24, 2023
ac28867
formatting [skip ci]
borkdude Oct 25, 2023
1cfdd71
match-brackets [skip ci]
borkdude Oct 25, 2023
d001b80
stable squint
borkdude Oct 25, 2023
c502d2a
commands
borkdude Oct 25, 2023
ce0dc43
ported all
borkdude Oct 25, 2023
7645a41
delete mjs
borkdude Oct 25, 2023
80ec87c
dist
borkdude Oct 25, 2023
991794d
remove demo
borkdude Oct 25, 2023
1912ab9
fix test
borkdude Oct 25, 2023
377954b
remove demo.mjs
borkdude Oct 25, 2023
19ceb91
build
borkdude Oct 25, 2023
8cfb2a2
fix base dir
borkdude Oct 25, 2023
74523e6
Add name
borkdude Oct 25, 2023
60ff5cf
simplify gitignore
borkdude Oct 25, 2023
60cb060
remove garbage
borkdude Oct 25, 2023
9ef3da3
upgrade squint
borkdude Oct 31, 2023
dcc92cc
Port tests
borkdude Oct 31, 2023
9cbda27
Add clj-kondo config
borkdude Oct 31, 2023
5230855
Prepare for NPM release
zampino Oct 31, 2023
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
20 changes: 20 additions & 0 deletions .bb/tasks.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(ns tasks
(:require
[babashka.tasks :refer [shell]]
[clojure.string :as str]))

(defn watch-cljs []
(let [watch (requiring-resolve 'pod.babashka.fswatcher/watch)
ret (watch "src-squint"
(fn [{:keys [type path]}]
(when (and (#{:write :write|chmod :create} type)
(or (str/ends-with? path ".cljs")
(str/ends-with? path ".cljc"))
;; emacs shit:
(not (str/includes? path ".#")))
(shell {:continue true
:err :inherit
:std :inherit} "yarn squint compile --output-dir public/squint/js" path)))
{:recursive true})]
(println (str "Started watching: " ret))
@(promise)))
4 changes: 4 additions & 0 deletions .clj-kondo/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{:cljc {:features [:cljs]}
:lint-as {applied-science.js-interop/defn clojure.core/defn
applied-science.js-interop/fn clojure.core/fn
applied-science.js-interop/let clojure.core/let}}
15 changes: 13 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ jobs:
- name: 🧶 Yarn Install
run: yarn install

- name: 🧪 Run tests
- name: 🧪 Run CLJS tests
run: yarn test

- name: 🧪 Run squint tests
run: |
yarn squint compile
node dist/nextjournal/clojure_mode_tests.mjs

snapshot:
name: Static App / Build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -52,7 +57,13 @@ jobs:
run: yarn install

- name: 🧶 Yarn Build
run: yarn build
run: |
yarn build

- name: 🧶 Squint build
run: |
yarn squint compile
yarn vite:build

- name: 📠 Copy static build to bucket under SHA
run: gsutil cp -r public gs://nextjournal-snapshots/clojure-mode/build/${{ github.sha }}
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.shadow-cljs
.idea
.calva
.clj-kondo
.cache
.cpcache
.lsp
public/js
public/livedoc/js
node_modules
public/test
*.iml
out
dist
49 changes: 45 additions & 4 deletions bb.edn
Original file line number Diff line number Diff line change
@@ -1,15 +1,56 @@
{:min-bb-version "0.7.6"
:paths ["bb"]
:paths [".bb"]
:pods {org.babashka/fswatcher {:version "0.0.4"}}
:tasks
{:requires ([clojure.edn :as edn]
[clojure.string :as str]
[babashka.deps :as deps]
[babashka.fs :as fs]
[babashka.process :as p])
[babashka.process :as p]
[tasks :as t])
:init (do
(defn viewer-css-path []
(let [cp (str/trim (with-out-str (deps/clojure ["-A:dev:demo" "-Spath"])))]
(str/trim (:out (shell {:out :string} (str "bb -cp " cp " -e '(println (.getPath (clojure.java.io/resource \"css/viewer.css\")))'")))))))
(str/trim (:out (shell {:out :string} (str "bb -cp " cp " -e '(println (.getPath (clojure.java.io/resource \"css/viewer.css\")))'"))))))

(defn get-paths [ext]
(map str (fs/glob "." (str "{demo,src,collab}/**." (name ext))))))

copy-viewer-css {:doc "Copies viewer stylesheet to resources."
:task (fs/copy (viewer-css-path) "resources/stylesheets/viewer.css" #{:replace-existing})}}}
:task (fs/copy (viewer-css-path) "resources/stylesheets/viewer.css" #{:replace-existing})}

yarn-install (shell "yarn install")

clean (let [paths (get-paths :mjs)]
(println (apply str (interpose "\n" (cons "removing:" paths))))
(doseq [path paths] (fs/delete path)))

#_#_compile {:doc "Use squintjs to compile all cljs files recursively"
:depends [yarn-install]
:task (shell {:std :inherit :err :inherit}
(apply str (cons "yarn squint compile "
(interpose " " (get-paths :cljs)))))}

#_#_build {:doc "Compiles cljs files with squint and builds from mjs sources with vite"
:depends [compile]
:task (shell {:std :inherit :err :inherit}
"yarn build")}

watch-cljs (shell "yarn run squint watch")

yarn-install:squint-dev (do
(shell "yarn add squint-cljs@link:../squint")
(shell {:dir "node_modules/.bin"} "ln -sf" "../squint-cljs/node_cli.js" "squint"))

vite:dev {:doc "Launches vite application"
:depends [yarn-install]
:task (shell "yarn vite:dev")}

vite:build {:depends [yarn-install]
:task (shell "yarn vite:build")}

-dev {:depends [vite:dev watch-cljs]}

dev {:doc "Compiles all cljs to mjs, runs vite in dev and starts a cherry watcher to recompile changed cljs. When run as `bb dev collab` also starts a Y.js collaboration server."
;; :depends [compile]
:task (run '-dev {:parallel true})}}}
3 changes: 2 additions & 1 deletion deps.edn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{:deps {applied-science/js-interop {:mvn/version "0.3.3"}
{:paths ["src-shared" "src"]
:deps {applied-science/js-interop {:mvn/version "0.3.3"}
org.clojure/clojure {:mvn/version "1.10.3"}
org.clojure/clojurescript {:mvn/version "1.10.866"}}
:aliases
Expand Down
95 changes: 57 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,58 @@
{
"dependencies": {
"@codemirror/autocomplete": "^6.0.2",
"@codemirror/commands": "^6.0.0",
"@codemirror/lang-markdown": "6.0.0",
"@codemirror/language": "^6.1.0",
"@codemirror/lint": "^6.0.0",
"@codemirror/search": "^6.0.0",
"@codemirror/state": "^6.0.1",
"@codemirror/view": "^6.0.2",
"@lezer/common": "^1.0.0",
"@lezer/generator": "^1.0.0",
"@lezer/highlight": "^1.0.0",
"@lezer/lr": "^1.0.0",
"@nextjournal/lezer-clojure": "1.0.0",
"d3-require": "^1.2.4",
"emoji-regex": "^10.0.0",
"framer-motion": "^6.2.8",
"katex": "^0.12.0",
"markdown-it": "12.3.2",
"markdown-it-block-image": "0.0.3",
"markdown-it-sidenote": "gerwitz/markdown-it-sidenote#aa5de8ce3168b7d41cb33c3aed071a5f41ce0083",
"markdown-it-texmath": "0.9.1",
"markdown-it-toc-done-right": "4.2.0",
"punycode": "2.1.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"w3c-keyname": "^2.2.4"
},
"scripts": {
"watch": "bb copy-viewer-css && shadow-cljs -A:demo watch demo livedoc test",
"build": "shadow-cljs -A:demo release demo livedoc",
"test": "shadow-cljs -A:dev release ci-test && node out/node-tests.js",
"watch2": "git ls-files | entr yarn test"
},
"devDependencies": {
"shadow-cljs": "2.19.5"
}
{ "name": "@nextjournal/clojure-mode",
"files": ["dist"],
"version": "0.1.0-rc2",
"license": "EPL-2.0",
"repository": {
"type": "git",
"url": "https://github.com/nextjournal/clojure-mode"
},
"dependencies": {
"@codemirror/autocomplete": "^6.0.2",
"@codemirror/commands": "^6.0.0",
"@codemirror/lang-markdown": "6.0.0",
"@codemirror/language": "^6.1.0",
"@codemirror/lint": "^6.0.0",
"@codemirror/search": "^6.0.0",
"@codemirror/state": "^6.0.1",
"@codemirror/view": "^6.0.2",
"@lezer/common": "^1.0.0",
"@lezer/generator": "^1.0.0",
"@lezer/highlight": "^1.0.0",
"@lezer/lr": "^1.0.0",
"@nextjournal/lezer-clojure": "1.0.0",
"d3-require": "^1.2.4",
"emoji-regex": "^10.0.0",
"framer-motion": "^6.2.8",
"katex": "^0.12.0",
"markdown-it": "12.3.2",
"markdown-it-block-image": "0.0.3",
"markdown-it-sidenote": "https://github.com/gerwitz/markdown-it-sidenote#aa5de8ce3168b7d41cb33c3aed071a5f41ce0083",
"markdown-it-texmath": "0.9.1",
"markdown-it-toc-done-right": "4.2.0",
"punycode": "2.1.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"squint-cljs": "0.3.36",
"w3c-keyname": "^2.2.4"
},
"comments": {
"to run squint as a local dependency:": "bb yarn-install:squint-dev"
},
"scripts": {
"watch": "bb copy-viewer-css && shadow-cljs -A:demo watch demo livedoc test",
"build": "shadow-cljs -A:demo release demo livedoc",
"test": "shadow-cljs -A:dev release ci-test && node out/node-tests.js",
"watch2": "git ls-files | entr yarn test",
"vite:dev": "vite --open -l info --config vite.config.js public/squint",
"vite:build": "yarn vite build --config vite.config.js public/squint"
},
"devDependencies": {
"@nextjournal/clojure-mode": "link:.",
"shadow-cljs": "2.19.5",
"vite": "^4.4.9",
"rollup-plugin-analyzer": "^4.0.0"
},
"exports": {
".": "dist/nextjournal/clojure_mode.mjs"
}
}
Loading