@dbx-tools/projen 0.6.54 → 0.6.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/bun-app.ts +17 -4
package/package.json CHANGED
@@ -26,9 +26,9 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@clack/prompts": "^1.7.0",
29
- "@dbx-tools/core": "0.6.54",
30
- "@dbx-tools/path": "0.6.54",
31
- "@dbx-tools/shared-core": "0.6.54",
29
+ "@dbx-tools/core": "0.6.56",
30
+ "@dbx-tools/path": "0.6.56",
31
+ "@dbx-tools/shared-core": "0.6.56",
32
32
  "commander": "^15.0.0",
33
33
  "concurrently": "^10.0.3",
34
34
  "constructs": "^10.6.0",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "main": "index.ts",
49
49
  "license": "Apache-2.0",
50
- "version": "0.6.54",
50
+ "version": "0.6.56",
51
51
  "types": "index.ts",
52
52
  "type": "module",
53
53
  "exports": {
package/src/bun-app.ts CHANGED
@@ -9,9 +9,10 @@
9
9
  * `@import "tailwindcss"` + `@source` directives compile with no separate CLI.
10
10
  * - {@link BunDevServerFile} - `dev.ts`: a `Bun.serve()` fullstack dev server that
11
11
  * imports `index.html` and serves the SPA with React hot module reloading.
12
- * - {@link BunBuildFile} - `build.ts`: a `Bun.build()` production bundle of
13
- * `index.html` (the `bun-plugin-tailwind` plugin must run through the JS API,
14
- * NOT the `bun build` CLI, which does not load it).
12
+ * - {@link BunBuildFile} - `build.ts`: a Databricks-safe `Bun.build()` production
13
+ * bundle of `index.html` (the `bun-plugin-tailwind` plugin must run through the
14
+ * JS API, NOT the `bun build` CLI, which does not load it), plus Vite-compatible
15
+ * staging of an optional `public/` directory.
15
16
  *
16
17
  * Each file supports an unmanaged OVERRIDE beside it (`bunfig.override.toml`,
17
18
  * `bun-dev.override.ts`, `bun-build.override.ts`): the dev/build scripts import
@@ -131,6 +132,7 @@ export class BunBuildFile extends TextFile {
131
132
  readonly: true,
132
133
  lines: String.raw`
133
134
  import { existsSync } from "node:fs";
135
+ import { cp, rm } from "node:fs/promises";
134
136
  import { basename } from "node:path";
135
137
  import tailwind from "bun-plugin-tailwind";
136
138
 
@@ -140,7 +142,10 @@ let options: Bun.BuildConfig = {
140
142
  entrypoints: ["./index.html"],
141
143
  outdir: "./dist",
142
144
  minify: true,
143
- sourcemap: "linked",
145
+ splitting: true,
146
+ publicPath: "/",
147
+ external: ["/fonts/*"],
148
+ sourcemap: "none",
144
149
  plugins: [tailwind],
145
150
  };
146
151
 
@@ -151,6 +156,9 @@ if (existsSync(overrideUrl)) {
151
156
  options = { ...options, ...override, plugins: [...(options.plugins ?? []), ...(override.plugins ?? [])] };
152
157
  }
153
158
 
159
+ const outdir = options.outdir ?? "./dist";
160
+ await rm(outdir, { recursive: true, force: true });
161
+
154
162
  const result = await Bun.build(options);
155
163
  if (!result.success) {
156
164
  for (const message of result.logs) console.error(message);
@@ -176,6 +184,11 @@ if (htmlOut && entryJs) {
176
184
  await Bun.write(htmlOut.path, html);
177
185
  }
178
186
 
187
+ const publicDir = "./public";
188
+ if (existsSync(publicDir)) {
189
+ await cp(publicDir, outdir, { recursive: true });
190
+ }
191
+
179
192
  console.log("built " + result.outputs.length + " files to " + options.outdir);
180
193
  `
181
194
  .trimStart()