From 3b81c1d7509dea1ff9ca76bf61a353310120afa7 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 1 Oct 2025 10:47:47 +0200 Subject: [PATCH] Revert ":recycle: Make the exporter build as esm module" This reverts commit d0f34f06a9ff7fb766748d80d72be814ccdf97c4. --- exporter/deps.edn | 2 +- exporter/package.json | 3 +-- exporter/scripts/build | 3 +++ exporter/shadow-cljs.edn | 17 ++++------------- exporter/src/app/browser.cljs | 2 +- exporter/src/app/core.cljs | 12 ++++++------ exporter/src/app/http.cljs | 11 +++++------ exporter/src/app/redis.cljs | 2 +- exporter/yarn.lock | 16 ++++++++-------- 9 files changed, 30 insertions(+), 38 deletions(-) diff --git a/exporter/deps.edn b/exporter/deps.edn index 2d74f0efa7..6f93671f2a 100644 --- a/exporter/deps.edn +++ b/exporter/deps.edn @@ -14,7 +14,7 @@ :dev {:extra-deps - {thheller/shadow-cljs {:mvn/version "3.2.1"}}} + {thheller/shadow-cljs {:mvn/version "3.1.5"}}} :shadow-cljs {:main-opts ["-m" "shadow.cljs.devtools.cli"] diff --git a/exporter/package.json b/exporter/package.json index 5db4dc52c8..ab394fe62d 100644 --- a/exporter/package.json +++ b/exporter/package.json @@ -9,14 +9,13 @@ "type": "git", "url": "https://github.com/penpot/penpot" }, - "type": "module", "dependencies": { "archiver": "^7.0.1", "cookies": "^0.9.1", - "date-fns": "^4.1.0", "generic-pool": "^3.9.0", "inflation": "^2.1.0", "ioredis": "^5.6.1", + "luxon": "^3.6.1", "playwright": "^1.53.0", "raw-body": "^3.0.0", "svgo": "penpot/svgo#v3.1", diff --git a/exporter/scripts/build b/exporter/scripts/build index 26763973e2..4bd911fc00 100755 --- a/exporter/scripts/build +++ b/exporter/scripts/build @@ -13,6 +13,9 @@ rm -rf target # Build the application clojure -M:dev:shadow-cljs release main; +# Remove source +rm -rf target/app; + # Copy package*.json files cp ../.yarnrc.yml target/; cp yarn.lock target/; diff --git a/exporter/shadow-cljs.edn b/exporter/shadow-cljs.edn index ae963cf311..9107cbcb7a 100644 --- a/exporter/shadow-cljs.edn +++ b/exporter/shadow-cljs.edn @@ -3,22 +3,13 @@ :builds {:main - {:target :esm - :runtime :node - :output-dir "target/" + {:target :node-script + :main app.core/main + :output-to "target/app.js" + :output-dir "target/app/" :devtools {:before-load-async app.core/stop :after-load app.core/start} - :modules - {:app - {:entries [] - :init-fn app.core/main}} - - :js-options - {:entry-keys ["module" "browser" "main"] - :export-conditions ["module" "import", "browser" "require" "default"] - :js-provider :import} - :compiler-options {:output-feature-set :es2020 :output-wrapper false} diff --git a/exporter/src/app/browser.cljs b/exporter/src/app/browser.cljs index 816fb1c954..46330ced58 100644 --- a/exporter/src/app/browser.cljs +++ b/exporter/src/app/browser.cljs @@ -7,7 +7,7 @@ (ns app.browser (:require ["generic-pool" :as gp] - ["generic-pool/lib/errors.js" :as gpe] + ["generic-pool/lib/errors" :as gpe] ["playwright" :as pw] [app.common.exceptions :as ex] [app.common.logging :as l] diff --git a/exporter/src/app/core.cljs b/exporter/src/app/core.cljs index dae498f5d3..6d30b9220d 100644 --- a/exporter/src/app/core.cljs +++ b/exporter/src/app/core.cljs @@ -6,7 +6,7 @@ (ns app.core (:require - ["node:process" :as proc] + ["process" :as proc] [app.browser :as bwr] [app.common.logging :as l] [app.config :as cf] @@ -41,9 +41,9 @@ (http/stop) (done))) -(.on proc/default "uncaughtException" - (fn [cause] - (js/console.error cause))) +(proc/on "uncaughtException" + (fn [cause] + (js/console.error cause))) -(.on proc/default "SIGTERM" (fn [] (proc/exit 0))) -(.on proc/default "SIGINT" (fn [] (proc/exit 0))) +(proc/on "SIGTERM" (fn [] (proc/exit 0))) +(proc/on "SIGINT" (fn [] (proc/exit 0))) diff --git a/exporter/src/app/http.cljs b/exporter/src/app/http.cljs index 0024ce8b86..acfb6e909d 100644 --- a/exporter/src/app/http.cljs +++ b/exporter/src/app/http.cljs @@ -6,11 +6,11 @@ (ns app.http (:require - ["cookies$default" :as Cookies] - ["inflation$default" :as inflate] - ["node:http" :as http] - ["node:stream$default" :as stream] - ["raw-body$default" :as raw-body] + ["cookies" :as Cookies] + ["http" :as http] + ["inflation" :as inflate] + ["raw-body" :as raw-body] + ["stream" :as stream] [app.common.logging :as l] [app.common.transit :as t] [app.config :as cf] @@ -169,7 +169,6 @@ (wrap-error handlers/on-error)) server (create-server handler) port (cf/get :http-server-port 6061)] - (.listen server port) (l/info :hint "welcome to penpot" :module "exporter" diff --git a/exporter/src/app/redis.cljs b/exporter/src/app/redis.cljs index 0cc38ba3a9..b04ccd0dee 100644 --- a/exporter/src/app/redis.cljs +++ b/exporter/src/app/redis.cljs @@ -18,7 +18,7 @@ (defn- create-client [uri] - (let [^js client (new redis/default uri)] + (let [^js client (new redis uri)] (.on client "connect" (fn [] (l/info :hint "redis connection established" :uri uri))) (.on client "error" diff --git a/exporter/yarn.lock b/exporter/yarn.lock index cb28ada3ae..ab798ac2f5 100644 --- a/exporter/yarn.lock +++ b/exporter/yarn.lock @@ -411,13 +411,6 @@ __metadata: languageName: node linkType: hard -"date-fns@npm:^4.1.0": - version: 4.1.0 - resolution: "date-fns@npm:4.1.0" - checksum: 10c0/b79ff32830e6b7faa009590af6ae0fb8c3fd9ffad46d930548fbb5acf473773b4712ae887e156ba91a7b3dc30591ce0f517d69fd83bd9c38650fdc03b4e0bac8 - languageName: node - linkType: hard - "debug@npm:4, debug@npm:^4.3.4": version: 4.4.1 resolution: "debug@npm:4.4.1" @@ -560,10 +553,10 @@ __metadata: dependencies: archiver: "npm:^7.0.1" cookies: "npm:^0.9.1" - date-fns: "npm:^4.1.0" generic-pool: "npm:^3.9.0" inflation: "npm:^2.1.0" ioredis: "npm:^5.6.1" + luxon: "npm:^3.6.1" playwright: "npm:^1.53.0" raw-body: "npm:^3.0.0" source-map-support: "npm:^0.5.21" @@ -866,6 +859,13 @@ __metadata: languageName: node linkType: hard +"luxon@npm:^3.6.1": + version: 3.6.1 + resolution: "luxon@npm:3.6.1" + checksum: 10c0/906d57a9dc4d1de9383f2e9223e378c298607c1b4d17b6657b836a3cd120feb1c1de3b5d06d846a3417e1ca764de8476e8c23b3cd4083b5cdb870adcb06a99d5 + languageName: node + linkType: hard + "make-fetch-happen@npm:^14.0.3": version: 14.0.3 resolution: "make-fetch-happen@npm:14.0.3"