From 787bdede872ba781fb924ce308cb9732f8f19da0 Mon Sep 17 00:00:00 2001 From: Matteo Rosati Date: Wed, 11 Feb 2026 15:15:27 +0100 Subject: [PATCH] add minimal TS bundler --- build.js | 31 ++++++++++++++ bun.lock | 55 +++++++++++++++++++++++++ db.sqlite3 | Bin 180224 -> 180224 bytes frontend/static/frontend/js/home.js | 16 ------- frontend/static/frontend/ts/lib/add.ts | 3 ++ frontend/static/frontend/ts/main.ts | 3 ++ frontend/templates/frontend/home.html | 2 +- package.json | 9 +++- 8 files changed, 100 insertions(+), 19 deletions(-) create mode 100644 build.js delete mode 100644 frontend/static/frontend/js/home.js create mode 100644 frontend/static/frontend/ts/lib/add.ts create mode 100644 frontend/static/frontend/ts/main.ts diff --git a/build.js b/build.js new file mode 100644 index 0000000..92664af --- /dev/null +++ b/build.js @@ -0,0 +1,31 @@ +// build.js +import * as esbuild from "esbuild"; + +const isDev = process.argv.includes("--dev"); + +const config = { + entryPoints: ["frontend/static/frontend/ts/main.ts"], // il tuo entry point + bundle: true, + outdir: "frontend/static/frontend/dist", + format: "iife", // o 'iife' se serve per un tag + {% endblock %} diff --git a/package.json b/package.json index 55fea76..072d4f5 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,10 @@ { "dependencies": { - "@types/maplibre-gl": "^1.14.0" + "@types/maplibre-gl": "^1.14.0", + "esbuild": "^0.27.3" + }, + "scripts": { + "dev": "bun run build.js --dev", + "build": "bun run build.js" } -} \ No newline at end of file +}