@locale-labs/miniapp-builder 0.1.8-dev.4.f5d76f9 → 0.1.8-dev.5.f1f1d6c
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 +27 -72
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,99 +1,54 @@
|
|
|
1
1
|
# @locale-labs/miniapp-builder
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
CLI que empaqueta una mini-app de Localé en un único `index.html` self-contained, listo para deployar al Kernel.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## 📦 Installation
|
|
8
|
-
|
|
9
|
-
This package is usually installed as a dev dependency in your Mini-App project.
|
|
5
|
+
## Instalar
|
|
10
6
|
|
|
11
7
|
```bash
|
|
12
8
|
bun add -d @locale-labs/miniapp-builder
|
|
13
9
|
```
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Add a build script to your `package.json`:
|
|
11
|
+
Agregar al `package.json`:
|
|
18
12
|
|
|
19
13
|
```json
|
|
20
14
|
{
|
|
21
15
|
"scripts": {
|
|
22
|
-
"build": "locale-miniapp-builder"
|
|
16
|
+
"build": "locale-miniapp-builder build",
|
|
17
|
+
"deploy": "locale-miniapp-builder deploy",
|
|
18
|
+
"dev": "locale-miniapp-builder dev"
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
21
|
```
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
bun x locale-miniapp-builder
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## ⚙️ How it Works
|
|
34
|
-
|
|
35
|
-
The builder acts as the **final step** in your build pipeline. It assumes previous steps (like `esbuild` or `tailwindcss`) have already run and placed their outputs in a `.temp/` directory.
|
|
36
|
-
|
|
37
|
-
### 1. Input Requirements
|
|
38
|
-
|
|
39
|
-
The builder looks for the following files relative to your project root:
|
|
40
|
-
|
|
41
|
-
- `.temp/index.html`: The base HTML structure.
|
|
42
|
-
- `.temp/output.css`: Compiled Tailwind/CSS.
|
|
43
|
-
- `.temp/alpine.js`: Compiled Application Logic (Alpine.js bundle).
|
|
44
|
-
|
|
45
|
-
### 2. The Process
|
|
46
|
-
|
|
47
|
-
1. **Reads Assets**: Loads the HTML, CSS, and JS files from the `.temp/` folder.
|
|
48
|
-
2. **Resolves SDK**: Automatically finds the installed version of `@locale-labs/miniapp-sdk`.
|
|
49
|
-
3. **Cleans HTML**: Removes development scripts (e.g., Tailwind CDN, unbundled Alpine.js tags).
|
|
50
|
-
4. **Inlines Everything**:
|
|
51
|
-
- Injects CSS into a `<style>` block in `<head>`.
|
|
52
|
-
- Injects the **Localé SDK** into a `<script>` block.
|
|
53
|
-
- Injects your **App Bundle** into a `<script>` block.
|
|
23
|
+
## Cómo funciona
|
|
54
24
|
|
|
55
|
-
|
|
25
|
+
El builder es el último paso del pipeline. Asume que tu build previo (esbuild, tailwind, etc.) ya dejó archivos en `.temp/`:
|
|
56
26
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
## 🛠 Configuration
|
|
64
|
-
|
|
65
|
-
Currently, the builder uses a "Zero Config" approach with opinionated defaults (expecting the `.temp/` structure).
|
|
66
|
-
|
|
67
|
-
### Debugging
|
|
68
|
-
|
|
69
|
-
You can verify which SDK path is being resolved by looking at the console output during the build process. The builder checks:
|
|
70
|
-
|
|
71
|
-
1. `LOCALE_SDK_PATH` environment variable.
|
|
72
|
-
2. `node_modules/@locale-labs/miniapp-sdk`
|
|
73
|
-
3. Local fallback paths.
|
|
74
|
-
|
|
75
|
-
## 📦 Deployment
|
|
27
|
+
```
|
|
28
|
+
.temp/
|
|
29
|
+
index.html # estructura HTML base
|
|
30
|
+
output.css # CSS compilado (Tailwind)
|
|
31
|
+
alpine.js # bundle de tu app
|
|
32
|
+
```
|
|
76
33
|
|
|
77
|
-
|
|
34
|
+
El comando `build` resuelve el SDK (`@locale-labs/miniapp-sdk` desde `node_modules` o `LOCALE_SDK_PATH`), inlinea CSS + SDK + tu bundle dentro del HTML, y genera:
|
|
78
35
|
|
|
79
|
-
|
|
80
|
-
|
|
36
|
+
```
|
|
37
|
+
build/index.html # artefacto único listo para subir
|
|
38
|
+
```
|
|
81
39
|
|
|
82
|
-
|
|
40
|
+
`deploy` toma ese HTML, lo sube a Supabase Storage del miniapp (`miniapp-builds/builds/<version>/index.html`) y registra la versión en el Core via la edge function `register_miniapp_version`. La versión se compone como `<package.json version>+<MINIAPP_GIT_SHA>` (build metadata semver).
|
|
83
41
|
|
|
84
|
-
|
|
42
|
+
## Resolución del SDK
|
|
85
43
|
|
|
86
|
-
|
|
87
|
-
- Minor/Feature release: `feat: add new feature` (1.0.0 -> 1.1.0)
|
|
88
|
-
- Major release: (1.0.0 -> 2.0.0)
|
|
44
|
+
El builder busca el SDK en este orden:
|
|
89
45
|
|
|
90
|
-
|
|
91
|
-
|
|
46
|
+
1. `LOCALE_SDK_PATH` env var (útil para dev local).
|
|
47
|
+
2. `node_modules/@locale-labs/miniapp-sdk`.
|
|
48
|
+
3. Fallbacks locales.
|
|
92
49
|
|
|
93
|
-
|
|
94
|
-
The default graphite width of 10mm is always used for performance reasons.
|
|
95
|
-
```
|
|
50
|
+
Para desarrollo local con SDK linkeado: ver `dev:local` en una mini-app de referencia, p.ej. `locale-miniapp--mascotas-perdidas`.
|
|
96
51
|
|
|
97
|
-
|
|
52
|
+
## Deploy del builder
|
|
98
53
|
|
|
99
|
-
|
|
54
|
+
Ver [`DEPLOY.md`](./DEPLOY.md). Push a `dev` publica `@dev`, push a `main` publica `@latest`.
|