Skip to content

Commit

Permalink
Add task for copying to app folder
Browse files Browse the repository at this point in the history
  • Loading branch information
PEZ committed Nov 17, 2024
1 parent a5aca2a commit e7fbbf8
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ pom.xml.asc
.clj-kondo/imports/

/gadget-inspector/
/scrap/
/scrap/
/replicant-todomvc/
8 changes: 6 additions & 2 deletions bb.edn
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{:paths ["." "scripts"]
:tasks {:requires ([tasks :as t])

dev:build-inspector-extension
{:task t/build-inspector-extension!
:doc "Build the Gadget Inspector Chrome Extension"}}}
:doc "Build the Gadget Inspector Chrome Extension"}

copy-to-app-dir
{:task t/copy-to-app-dir!
:doc "Package the built TodoMVC app to `./replicant-todomvc`"}}}
43 changes: 43 additions & 0 deletions scripts/tasks.clj
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,46 @@
(build-inspector-extension!)
:rcf)

(defn ^:export copy-to-app-dir! []
(println "Copying to app dir `./replicant-todomvc` ...")

(let [app-dir "replicant-todomvc"]
;; Node modules
(fs/create-dirs (fs/path app-dir "node_modules" "todomvc-common")
{:replace-existing true})
(fs/copy (fs/path "node_modules" "todomvc-common" "base.css")
(fs/path app-dir "node_modules" "todomvc-common" "base.css")
{:replace-existing true})
(fs/copy (fs/path "node_modules" "todomvc-common" "base.js")
(fs/path app-dir "node_modules" "todomvc-common" "base.js")
{:replace-existing true})
(fs/create-dirs (fs/path app-dir "node_modules" "todomvc-app-css"))
(fs/copy (fs/path "node_modules" "todomvc-app-css" "index.css")
(fs/path app-dir "node_modules" "todomvc-app-css" "index.css")
{:replace-existing true})

;; App
(fs/copy-tree (fs/path "src")
(fs/path app-dir "src")
{:replace-existing true})
(fs/copy (fs/path "deps.edn")
(fs/path app-dir "deps.edn")
{:replace-existing true})
(fs/copy (fs/path "package.json")
(fs/path app-dir "package.json")
{:replace-existing true})
(fs/copy (fs/path "README.md")
(fs/path app-dir "README.md")
{:replace-existing true})
(fs/copy (fs/path "shadow-cljs.edn")
(fs/path app-dir "shadow-cljs.edn")
{:replace-existing true})
(fs/copy (fs/path "index.html")
(fs/path app-dir "index.html")
{:replace-existing true})
(fs/create-dirs (fs/path app-dir "js" "compiled"))
(fs/copy (fs/path "js" "compiled" "main.js")
(fs/path app-dir "js" "compiled" "main.js")
{:replace-existing true})
(p/shell "tree" app-dir)
))

0 comments on commit e7fbbf8

Please sign in to comment.