diff --git a/docker/devenv/files/start-tmux.sh b/docker/devenv/files/start-tmux.sh index b5198358a..de253a20d 100755 --- a/docker/devenv/files/start-tmux.sh +++ b/docker/devenv/files/start-tmux.sh @@ -28,8 +28,13 @@ tmux select-window -t penpot:1 tmux send-keys -t penpot 'cd penpot/frontend' enter C-l tmux send-keys -t penpot 'yarn run watch:app' enter -tmux new-window -t penpot:2 -n 'exporter' +tmux new-window -t penpot:2 -n 'frontend storybook' tmux select-window -t penpot:2 +tmux send-keys -t penpot 'cd penpot/frontend' enter C-l +tmux send-keys -t penpot 'yarn run watch:storybook' enter + +tmux new-window -t penpot:3 -n 'exporter' +tmux select-window -t penpot:3 tmux send-keys -t penpot 'cd penpot/exporter' enter C-l tmux send-keys -t penpot 'rm -f target/app.js*' enter C-l tmux send-keys -t penpot 'clojure -M:dev:shadow-cljs watch main' enter @@ -38,8 +43,8 @@ tmux split-window -v tmux send-keys -t penpot 'cd penpot/exporter' enter C-l tmux send-keys -t penpot './scripts/wait-and-start.sh' enter -tmux new-window -t penpot:3 -n 'backend' -tmux select-window -t penpot:3 +tmux new-window -t penpot:4 -n 'backend' +tmux select-window -t penpot:4 tmux send-keys -t penpot 'cd penpot/backend' enter C-l tmux send-keys -t penpot './scripts/start-dev' enter diff --git a/frontend/.storybook/preview.js b/frontend/.storybook/preview.js index d15d79b78..2f9483939 100644 --- a/frontend/.storybook/preview.js +++ b/frontend/.storybook/preview.js @@ -1,5 +1,7 @@ import { withThemeByClassName } from "@storybook/addon-themes"; +import '../resources/public/css/ds.css'; + export const decorators = [ withThemeByClassName({ themes: { diff --git a/frontend/package.json b/frontend/package.json index dc502cc3c..1e0047dd7 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -41,11 +41,11 @@ "translations": "node ./scripts/translations.js", "watch:app:assets": "node ./scripts/watch.js", "watch:app:libs": "node ./scripts/build-libs.js --watch", - "watch:app:main": "clojure -M:dev:shadow-cljs watch main worker", + "watch:app:main": "clojure -M:dev:shadow-cljs watch main worker storybook", "clear:shadow-cache": "rm -rf .shadow-cljs", "watch:app": "yarn run clear:shadow-cache && concurrently \"yarn run watch:app:main\" \"yarn run watch:app:libs\"", "watch": "yarn run watch:app:assets", - "watch:storybook": "concurrently \"clojure -M:dev:shadow-cljs watch storybook\" \"storybook dev -p 6006 --no-open\" \"yarn run watch:storybook:assets\"", + "watch:storybook": "concurrently \"storybook dev -p 6006 --no-open\" \"yarn run watch:storybook:assets\"", "watch:storybook:assets": "node ./scripts/watch-storybook.js" }, "devDependencies": { diff --git a/frontend/scripts/watch-storybook.js b/frontend/scripts/watch-storybook.js index a82a66932..7a8f13de0 100644 --- a/frontend/scripts/watch-storybook.js +++ b/frontend/scripts/watch-storybook.js @@ -23,14 +23,21 @@ async function compileSassAll() { async function compileSass(path) { const start = process.hrtime(); log.info("changed:", path); - const result = await h.compileSass(worker, path, { modules: true }); - sass.index[result.outputPath] = result.css; - const output = h.concatSass(sass); - await fs.writeFile("./resources/public/css/ds.css", output); + try { + const result = await h.compileSass(worker, path, { modules: true }); + sass.index[result.outputPath] = result.css; - const end = process.hrtime(start); - log.info("done:", `(${ppt(end)})`); + const output = h.concatSass(sass); + await fs.writeFile("./resources/public/css/ds.css", output); + + const end = process.hrtime(start); + log.info("done:", `(${ppt(end)})`); + } catch (cause) { + console.error(cause); + const end = process.hrtime(start); + log.error("error:", `(${ppt(end)})`); + } } await fs.mkdir("./resources/public/css/", { recursive: true }); diff --git a/frontend/scripts/watch.js b/frontend/scripts/watch.js index 0e1d68f43..54a4f015b 100644 --- a/frontend/scripts/watch.js +++ b/frontend/scripts/watch.js @@ -1,4 +1,3 @@ -import proc from "node:child_process"; import fs from "node:fs/promises"; import ph from "node:path"; diff --git a/frontend/shadow-cljs.edn b/frontend/shadow-cljs.edn index 43b88bce2..e5ffa9013 100644 --- a/frontend/shadow-cljs.edn +++ b/frontend/shadow-cljs.edn @@ -1,7 +1,8 @@ {:deps {:aliases [:dev]} - :http {:port 3448} - :nrepl {:port 3447 :host "0.0.0.0"} - :dev-http {8888 "classpath:public"} + :http {:port #shadow/env ["HTTP_PORT" :as :int :default 3448]} + :nrepl {:port #shadow/env ["NREPL_PORT" :as :int :default 3447] :host "0.0.0.0"} + :dev-http {#shadow/env ["DEV_PORT" :as :int :default 8888] "classpath:public"} + :cache-dir #shadow/env ["CACHE" :default ".shadow-cljs"] :builds {:main