nuxt-bun-compile 0.1.25 → 0.1.26

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.
package/README.md CHANGED
@@ -172,6 +172,86 @@ The **`-b`** (or `--bun`) flag forces Bun to be the runtime that executes the sc
172
172
 
173
173
  ---
174
174
 
175
+ ## 📚 Usage Examples
176
+
177
+ ### Custom Build Script
178
+
179
+ Create a dedicated npm script in your `package.json`:
180
+
181
+ ```json
182
+ {
183
+ "scripts": {
184
+ "build": "nuxt build",
185
+ "compile": "NODE_OPTIONS=\"--max-old-space-size=8192\" bun run -b build"
186
+ }
187
+ }
188
+ ```
189
+
190
+ Then run: `bun run compile`
191
+
192
+ ### Docker Deployment
193
+
194
+ Before building, create a `.dockerignore` file to exclude unnecessary files from the build context:
195
+
196
+ ```
197
+ .claude
198
+ .devcontainer
199
+ .gemini
200
+ .git
201
+ .github
202
+ .husky
203
+ .nuxt
204
+ .output
205
+ .serena
206
+ .vscode
207
+ .yarn
208
+ dist
209
+ node_modules
210
+ nuxtbin
211
+ test
212
+ tests
213
+ ```
214
+
215
+ Deploy the compiled binary in a Docker container using multi-stage build:
216
+
217
+ ```dockerfile
218
+ # Stage 1: Base image with Bun runtime
219
+ FROM oven/bun:alpine AS bun-base
220
+ WORKDIR /app
221
+
222
+ # Stage 2: Install dependencies
223
+ FROM bun-base AS bun-install
224
+ COPY package.json bun.lockb ./
225
+ RUN bun install --frozen-lockfile
226
+
227
+ # Stage 3: Build the binary
228
+ FROM bun-base AS bun-build
229
+ COPY --from=bun-install /app/node_modules /app/node_modules
230
+ COPY . .
231
+ RUN NODE_OPTIONS="--max-old-space-size=8192" bun run -b build
232
+
233
+ # Stage 4: Release (lightweight production image)
234
+ FROM alpine:latest AS release
235
+ EXPOSE 3000/tcp
236
+ WORKDIR /app
237
+ # Required libraries for Bun binaries on Alpine
238
+ # See: https://github.com/oven-sh/bun/issues/23910
239
+ # https://github.com/oven-sh/bun/issues/918
240
+ RUN apk add --no-cache libstdc++ libgcc
241
+ COPY --from=bun-build /app/nuxtbin /app/nuxtbin
242
+ CMD ["./nuxtbin"]
243
+ ```
244
+
245
+ Build and run:
246
+ ```bash
247
+ docker build -t my-nuxt-app .
248
+ docker run -p 3000:3000 my-nuxt-app
249
+ ```
250
+
251
+ > **Reference:** See the complete multi-stage example in [nuxt-duckdb-wasm/Dockerfile](https://github.com/jprando/nuxt-duckdb-wasm/blob/main/Dockerfile) for a production-ready setup.
252
+
253
+ ---
254
+
175
255
  ## 🧑‍💻 Development
176
256
 
177
257
  ### Testing Locally in a Nuxt App
package/README.ptBR.md CHANGED
@@ -172,6 +172,86 @@ O parâmetro **`-b`** (ou `--bun`) força o Bun a ser o runtime que executa o sc
172
172
 
173
173
  ---
174
174
 
175
+ ## 📚 Exemplos de Uso
176
+
177
+ ### Script Customizado de Build
178
+
179
+ Crie um script npm/bun dedicado no seu `package.json`:
180
+
181
+ ```json
182
+ {
183
+ "scripts": {
184
+ "build": "nuxt build",
185
+ "compile": "NODE_OPTIONS=\"--max-old-space-size=8192\" bun run -b build"
186
+ }
187
+ }
188
+ ```
189
+
190
+ Execute com: `bun run compile`
191
+
192
+ ### Deploy com Docker
193
+
194
+ Antes de compilar, crie um arquivo `.dockerignore` para excluir arquivos desnecessários do contexto de build:
195
+
196
+ ```
197
+ .claude
198
+ .devcontainer
199
+ .gemini
200
+ .git
201
+ .github
202
+ .husky
203
+ .nuxt
204
+ .output
205
+ .serena
206
+ .vscode
207
+ .yarn
208
+ dist
209
+ node_modules
210
+ nuxtbin
211
+ test
212
+ tests
213
+ ```
214
+
215
+ Faça deploy do binário compilado em um container Docker usando multi-stage build:
216
+
217
+ ```dockerfile
218
+ # Estágio 1: Imagem base com runtime Bun
219
+ FROM oven/bun:alpine AS bun-base
220
+ WORKDIR /app
221
+
222
+ # Estágio 2: Instalar dependências
223
+ FROM bun-base AS bun-install
224
+ COPY package.json bun.lockb ./
225
+ RUN bun install --frozen-lockfile
226
+
227
+ # Estágio 3: Compilar o binário
228
+ FROM bun-base AS bun-build
229
+ COPY --from=bun-install /app/node_modules /app/node_modules
230
+ COPY . .
231
+ RUN NODE_OPTIONS="--max-old-space-size=8192" bun run -b build
232
+
233
+ # Estágio 4: Release (imagem de produção otimizada)
234
+ FROM alpine:latest AS release
235
+ EXPOSE 3000/tcp
236
+ WORKDIR /app
237
+ # Bibliotecas necessárias para binários Bun no Alpine
238
+ # Ver: https://github.com/oven-sh/bun/issues/23910
239
+ # https://github.com/oven-sh/bun/issues/918
240
+ RUN apk add --no-cache libstdc++ libgcc
241
+ COPY --from=bun-build /app/nuxtbin /app/nuxtbin
242
+ CMD ["./nuxtbin"]
243
+ ```
244
+
245
+ Build e execute:
246
+ ```bash
247
+ docker build -t minha-app-nuxt .
248
+ docker run -p 3000:3000 minha-app-nuxt
249
+ ```
250
+
251
+ > **Referência:** Veja um exemplo completo com multi-stage em [nuxt-duckdb-wasm/Dockerfile](https://github.com/jprando/nuxt-duckdb-wasm/blob/main/Dockerfile) para um setup pronto para produção.
252
+
253
+ ---
254
+
175
255
  ## 🧑‍💻 Desenvolvimento
176
256
 
177
257
  ### Testando Localmente em uma Aplicação Nuxt
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-bun-compile",
3
3
  "configKey": "bunCompile",
4
- "version": "0.1.25",
4
+ "version": "0.1.26",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-bun-compile",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "Nuxt module that automatically configures Nitro for `bun build --compile`, generating a standalone executable binary from your Nuxt app.",
5
5
  "repository": "jprando/nuxt-bun-compile",
6
6
  "license": "MIT",