parent
11b7a56ab8
commit
a3554fa4a2
13 changed files with 200 additions and 9 deletions
25
plugins/demo/README.md
Normal file
25
plugins/demo/README.md
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Demo
|
||||
|
||||
A demo project of a custom scittle build.
|
||||
|
||||
See:
|
||||
|
||||
- `bb.edn` with
|
||||
- `:deps` which includes:
|
||||
- a dependency on the `scittle.build` project to build scittle + custom features
|
||||
- zero or more plugin dependencies
|
||||
- helpers like static file server
|
||||
- development `:tasks`. Run `bb dev` for development and `bb release` to produce release artifacts.
|
||||
- `deps.edn`: this only contains a dependency on scittle itself
|
||||
|
||||
Available plugins are in the `plugins` directory inside the top level directory of this repo.
|
||||
|
||||
Writing a plugin involves writing
|
||||
|
||||
- SCI configuration (this can be shared with users in the [sci.configs](https://github.com/babashka/sci.configs) project
|
||||
- Adding a `scittle_plugin.edn` file on the plugin's classpath (e.g. in the `src` directory). This EDN file contains:
|
||||
- `:name`, name of the plugin
|
||||
- `:namespaces`: the namespaces exposed to SCI
|
||||
- `:js`: the name of the produced `.js` module file
|
||||
- `:shadow-config`: the shadow-cljs configuration specific to this plugin
|
||||
- A `.cljs` file with an `init` function which calls `scittle/register-plugin!`.
|
||||
20
plugins/demo/bb.edn
Normal file
20
plugins/demo/bb.edn
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{:deps {io.github.babashka/scittle.build {:local/root "../../build"}
|
||||
;; datascript plugin
|
||||
io.github.babashka/scittle.datascript {:local/root "../../plugins/datascript"}
|
||||
io.github.babashka/http-server
|
||||
{:git/sha "b38c1f16ad2c618adae2c3b102a5520c261a7dd3"}}
|
||||
:tasks
|
||||
{:requires ([scittle.build :as build])
|
||||
watch {:doc "Watch build"
|
||||
:task (build/build {:action "watch"})}
|
||||
serve {:doc "Starts http server for serving static files"
|
||||
:requires ([babashka.http-server :as http])
|
||||
:task (do (http/serve {:port 1341 :dir "resources/public"})
|
||||
(println "Serving static assets at http://localhost:1341"))}
|
||||
-dev {:depends [watch serve]
|
||||
:parallel true}
|
||||
dev {:doc "Run compilation in watch mode and start http server"
|
||||
:task (do (run '-dev {:parallel true})
|
||||
(deref (promise)))}
|
||||
release {:doc "Release build (advanced compiled JS)"
|
||||
:task (build/build {})}}}
|
||||
1
plugins/demo/deps.edn
Normal file
1
plugins/demo/deps.edn
Normal file
|
|
@ -0,0 +1 @@
|
|||
{:deps {io.github.babashka/scittle {:local/root "../.."}}}
|
||||
14
plugins/demo/resources/public/index.html
Normal file
14
plugins/demo/resources/public/index.html
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/css/style.css">
|
||||
<script src="/js/scittle.js" type="application/javascript"></script>
|
||||
<script src="/js/scittle.datascript.js" type="application/javascript"></script>
|
||||
<script type="application/x-scittle">
|
||||
(require '[datascript.core :as d])
|
||||
(prn (ns-publics 'datascript.core))
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
32
plugins/demo/shadow-cljs.edn
Normal file
32
plugins/demo/shadow-cljs.edn
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{:deps
|
||||
{:aliases [:dev]}
|
||||
|
||||
:dev-http
|
||||
{8000 "classpath:public"}
|
||||
|
||||
:builds
|
||||
{:main
|
||||
{:target :browser
|
||||
:js-options
|
||||
{:resolve {"react" {:target :global
|
||||
:global "React"}
|
||||
"react-dom" {:target :global
|
||||
:global "ReactDOM"}}}
|
||||
:modules
|
||||
{:scittle {:entries [scittle.core]}
|
||||
:scittle.nrepl {:entries [scittle.nrepl]
|
||||
:depends-on #{:scittle}}
|
||||
:scittle.promesa {:entries [scittle.promesa]
|
||||
:depends-on #{:scittle}}
|
||||
:scittle.pprint {:entries [scittle.pprint]
|
||||
:depends-on #{:scittle}}
|
||||
:scittle.reagent {:entries [scittle.reagent]
|
||||
:depends-on #{:scittle}}
|
||||
:scittle.re-frame {:entries [scittle.re-frame]
|
||||
:depends-on #{:scittle.reagent
|
||||
:scittle}}
|
||||
:scittle.cljs-ajax {:entries [scittle.cljs-ajax]
|
||||
:depends-on #{:scittle}}}
|
||||
:build-hooks [(shadow.cljs.build-report/hook)]
|
||||
:output-dir "resources/public/js"
|
||||
:devtools {:repl-pprint true}}}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue