♻️ Make the exporter build as esm module

This commit is contained in:
Andrey Antukh
2025-09-30 14:52:42 +02:00
parent 23d5bdd20b
commit d0f34f06a9
9 changed files with 38 additions and 30 deletions

View File

@@ -14,7 +14,7 @@
:dev :dev
{:extra-deps {:extra-deps
{thheller/shadow-cljs {:mvn/version "3.1.5"}}} {thheller/shadow-cljs {:mvn/version "3.2.1"}}}
:shadow-cljs :shadow-cljs
{:main-opts ["-m" "shadow.cljs.devtools.cli"] {:main-opts ["-m" "shadow.cljs.devtools.cli"]

View File

@@ -9,13 +9,14 @@
"type": "git", "type": "git",
"url": "https://github.com/penpot/penpot" "url": "https://github.com/penpot/penpot"
}, },
"type": "module",
"dependencies": { "dependencies": {
"archiver": "^7.0.1", "archiver": "^7.0.1",
"cookies": "^0.9.1", "cookies": "^0.9.1",
"date-fns": "^4.1.0",
"generic-pool": "^3.9.0", "generic-pool": "^3.9.0",
"inflation": "^2.1.0", "inflation": "^2.1.0",
"ioredis": "^5.6.1", "ioredis": "^5.6.1",
"luxon": "^3.6.1",
"playwright": "^1.53.0", "playwright": "^1.53.0",
"raw-body": "^3.0.0", "raw-body": "^3.0.0",
"svgo": "penpot/svgo#v3.1", "svgo": "penpot/svgo#v3.1",

View File

@@ -13,9 +13,6 @@ rm -rf target
# Build the application # Build the application
clojure -M:dev:shadow-cljs release main; clojure -M:dev:shadow-cljs release main;
# Remove source
rm -rf target/app;
# Copy package*.json files # Copy package*.json files
cp ../.yarnrc.yml target/; cp ../.yarnrc.yml target/;
cp yarn.lock target/; cp yarn.lock target/;

View File

@@ -3,13 +3,22 @@
:builds :builds
{:main {:main
{:target :node-script {:target :esm
:main app.core/main :runtime :node
:output-to "target/app.js" :output-dir "target/"
:output-dir "target/app/"
:devtools {:before-load-async app.core/stop :devtools {:before-load-async app.core/stop
:after-load app.core/start} :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 :compiler-options
{:output-feature-set :es2020 {:output-feature-set :es2020
:output-wrapper false} :output-wrapper false}

View File

@@ -7,7 +7,7 @@
(ns app.browser (ns app.browser
(:require (:require
["generic-pool" :as gp] ["generic-pool" :as gp]
["generic-pool/lib/errors" :as gpe] ["generic-pool/lib/errors.js" :as gpe]
["playwright" :as pw] ["playwright" :as pw]
[app.common.exceptions :as ex] [app.common.exceptions :as ex]
[app.common.logging :as l] [app.common.logging :as l]

View File

@@ -6,7 +6,7 @@
(ns app.core (ns app.core
(:require (:require
["process" :as proc] ["node:process" :as proc]
[app.browser :as bwr] [app.browser :as bwr]
[app.common.logging :as l] [app.common.logging :as l]
[app.config :as cf] [app.config :as cf]
@@ -41,9 +41,9 @@
(http/stop) (http/stop)
(done))) (done)))
(proc/on "uncaughtException" (.on proc/default "uncaughtException"
(fn [cause] (fn [cause]
(js/console.error cause))) (js/console.error cause)))
(proc/on "SIGTERM" (fn [] (proc/exit 0))) (.on proc/default "SIGTERM" (fn [] (proc/exit 0)))
(proc/on "SIGINT" (fn [] (proc/exit 0))) (.on proc/default "SIGINT" (fn [] (proc/exit 0)))

View File

@@ -6,11 +6,11 @@
(ns app.http (ns app.http
(:require (:require
["cookies" :as Cookies] ["cookies$default" :as Cookies]
["http" :as http] ["inflation$default" :as inflate]
["inflation" :as inflate] ["node:http" :as http]
["raw-body" :as raw-body] ["node:stream$default" :as stream]
["stream" :as stream] ["raw-body$default" :as raw-body]
[app.common.logging :as l] [app.common.logging :as l]
[app.common.transit :as t] [app.common.transit :as t]
[app.config :as cf] [app.config :as cf]
@@ -169,6 +169,7 @@
(wrap-error handlers/on-error)) (wrap-error handlers/on-error))
server (create-server handler) server (create-server handler)
port (cf/get :http-server-port 6061)] port (cf/get :http-server-port 6061)]
(.listen server port) (.listen server port)
(l/info :hint "welcome to penpot" (l/info :hint "welcome to penpot"
:module "exporter" :module "exporter"

View File

@@ -18,7 +18,7 @@
(defn- create-client (defn- create-client
[uri] [uri]
(let [^js client (new redis uri)] (let [^js client (new redis/default uri)]
(.on client "connect" (.on client "connect"
(fn [] (l/info :hint "redis connection established" :uri uri))) (fn [] (l/info :hint "redis connection established" :uri uri)))
(.on client "error" (.on client "error"

View File

@@ -411,6 +411,13 @@ __metadata:
languageName: node languageName: node
linkType: hard 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": "debug@npm:4, debug@npm:^4.3.4":
version: 4.4.1 version: 4.4.1
resolution: "debug@npm:4.4.1" resolution: "debug@npm:4.4.1"
@@ -553,10 +560,10 @@ __metadata:
dependencies: dependencies:
archiver: "npm:^7.0.1" archiver: "npm:^7.0.1"
cookies: "npm:^0.9.1" cookies: "npm:^0.9.1"
date-fns: "npm:^4.1.0"
generic-pool: "npm:^3.9.0" generic-pool: "npm:^3.9.0"
inflation: "npm:^2.1.0" inflation: "npm:^2.1.0"
ioredis: "npm:^5.6.1" ioredis: "npm:^5.6.1"
luxon: "npm:^3.6.1"
playwright: "npm:^1.53.0" playwright: "npm:^1.53.0"
raw-body: "npm:^3.0.0" raw-body: "npm:^3.0.0"
source-map-support: "npm:^0.5.21" source-map-support: "npm:^0.5.21"
@@ -859,13 +866,6 @@ __metadata:
languageName: node languageName: node
linkType: hard 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": "make-fetch-happen@npm:^14.0.3":
version: 14.0.3 version: 14.0.3
resolution: "make-fetch-happen@npm:14.0.3" resolution: "make-fetch-happen@npm:14.0.3"