lf-pagebuilder-vue 0.0.1 → 0.0.2

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
@@ -2,6 +2,41 @@
2
2
 
3
3
  Un componente Vue 3 de Page Builder con drag-and-drop para proyectos Lefebvre. Permite crear páginas de forma visual con un sistema de filas, columnas y componentes arrastrables.
4
4
 
5
+ ---
6
+
7
+ ## ⚠️ IMPORTANTE: Configuración de Entorno
8
+
9
+ > **El componente `Pagebuilder` requiere la prop `isProduction` para determinar qué URLs de API utilizar (desarrollo o producción).**
10
+
11
+ ```vue
12
+ <template>
13
+ <Pagebuilder
14
+ :isProduction="isProduction"
15
+ :renderApiDomain="apiUrl"
16
+ />
17
+ </template>
18
+
19
+ <script setup>
20
+ import { Pagebuilder } from 'lf-pagebuilder-vue';
21
+ import 'lf-pagebuilder-vue/styles';
22
+
23
+ // Opción 1: Usando import.meta.env.PROD (Vite detecta automáticamente)
24
+ const isProduction = import.meta.env.PROD;
25
+
26
+ // Opción 2: Usando una variable de entorno personalizada
27
+ // const isProduction = import.meta.env.VITE_IS_PRODUCTION === 'true';
28
+
29
+ const apiUrl = 'https://tu-api-render.com';
30
+ </script>
31
+ ```
32
+
33
+ | Valor de `isProduction` | URLs utilizadas |
34
+ |-------------------------|-----------------|
35
+ | `true` | URLs de producción (ej: `https://elderecho.com/feed`) |
36
+ | `false` | URLs de desarrollo (ej: `https://led-dev-elderecho-dev.eu.els.local/feed`) |
37
+
38
+ ---
39
+
5
40
  ## 🚀 Características
6
41
 
7
42
  - **Drag & Drop**: Sistema intuitivo para arrastrar y organizar componentes
@@ -79,9 +114,10 @@ const renderApiUrl = import.meta.env.ASTRO_RENDER_API;
79
114
 
80
115
  ## 📐 Props del Pagebuilder
81
116
 
82
- | Prop | Tipo | Descripción |
83
- |------|------|-------------|
84
- | `renderApiDomain` | `string` | URL del API de renderizado para previews |
117
+ | Prop | Tipo | Requerido | Default | Descripción |
118
+ |------|------|-----------|---------|-------------|
119
+ | `isProduction` | `boolean` | **Sí** | `false` | Determina si usar URLs de producción o desarrollo |
120
+ | `renderApiDomain` | `string` | No | - | URL del API de renderizado para previews |
85
121
 
86
122
  ## 🎨 Estilos
87
123
 
@@ -159,6 +195,106 @@ npm run dev
159
195
  npm run build
160
196
  ```
161
197
 
198
+ ### 📦 Configuración de package.json para desarrollo vs producción
199
+
200
+ Para evitar tener que hacer `npm run build` constantemente durante el desarrollo local, existen dos configuraciones de `package.json`:
201
+
202
+ - **Desarrollo local**: Apunta directamente a los archivos fuente (`./src/`)
203
+ - **Producción/npm**: Apunta a los archivos compilados (`./dist/`)
204
+
205
+ > **Instrucciones**: Copia y pega el contenido correspondiente en tu `package.json` según lo que necesites.
206
+
207
+ <details>
208
+ <summary><strong>📁 package.dev.json para DESARROLLO LOCAL (sin build)</strong></summary>
209
+
210
+ ```json
211
+ {
212
+ "name": "lf-pagebuilder-vue",
213
+ "version": "0.0.1",
214
+ "description": "Pagebuilder Vue component library for Lefebvre projects",
215
+ "type": "module",
216
+ "main": "./src/index.ts",
217
+ "module": "./src/index.ts",
218
+ "types": "./src/index.ts",
219
+ "exports": {
220
+ ".": {
221
+ "import": "./src/index.ts",
222
+ "types": "./src/index.ts"
223
+ },
224
+ "./styles": "./src/styles/pagebuilder.css"
225
+ },
226
+ "files": ["dist", "src", "README.md"]
227
+ }
228
+ ```
229
+
230
+ </details>
231
+
232
+ <details>
233
+ <summary><strong>📁 package.prod.json para PRODUCCIÓN (npm publish)</strong></summary>
234
+
235
+ ```json
236
+ {
237
+ "name": "lf-pagebuilder-vue",
238
+ "version": "0.0.1",
239
+ "description": "Pagebuilder Vue component library for Lefebvre projects",
240
+ "type": "module",
241
+ "main": "./dist/index.cjs",
242
+ "module": "./dist/index.js",
243
+ "types": "./dist/index.d.ts",
244
+ "exports": {
245
+ ".": {
246
+ "import": "./dist/index.js",
247
+ "require": "./dist/index.cjs",
248
+ "types": "./dist/index.d.ts"
249
+ },
250
+ "./styles": "./dist/styles.css"
251
+ },
252
+ "files": ["dist", "README.md"]
253
+ }
254
+ ```
255
+
256
+ </details>
257
+
258
+ > ⚠️ **IMPORTANTE**: Antes de hacer `npm publish`, asegúrate de usar la configuración de **PRODUCCIÓN** y ejecutar `npm run build`.
259
+
260
+ ### 🔗 Desarrollo local con `npm link` (múltiples librerías)
261
+
262
+ > **IMPORTANTE**: Si necesitas usar enlaces simbólicos de **múltiples librerías** (por ejemplo, `lf-pagebuilder-vue` y `libreria-astro-lefebvre`), debes linkear **todas las librerías en un solo comando**.
263
+
264
+ #### Paso 1: Crear los enlaces simbólicos en cada librería
265
+
266
+ ```bash
267
+ # En el directorio de lf-pagebuilder-vue
268
+ cd /ruta/a/lf-pagebuilder-vue
269
+ npm link
270
+
271
+ # En el directorio de libreria-astro-lefebvre (u otra librería)
272
+ cd /ruta/a/libreria-astro-lefebvre
273
+ npm link
274
+ ```
275
+
276
+ #### Paso 2: Usar los enlaces en tu proyecto consumidor
277
+
278
+ ```bash
279
+ # ✅ CORRECTO: Linkear ambas librerías en UN SOLO COMANDO
280
+ cd /ruta/a/tu-proyecto
281
+ npm link lf-pagebuilder-vue libreria-astro-lefebvre
282
+
283
+ # ❌ INCORRECTO: Linkear por separado (el segundo sobreescribe el primero)
284
+ npm link lf-pagebuilder-vue
285
+ npm link libreria-astro-lefebvre # ¡Esto rompe el link anterior!
286
+ ```
287
+
288
+ #### Paso 3: Para deshacer los enlaces
289
+
290
+ ```bash
291
+ cd /ruta/a/tu-proyecto
292
+ npm unlink lf-pagebuilder-vue libreria-astro-lefebvre
293
+ npm install
294
+ ```
295
+
296
+ > **Nota**: Si experimentas problemas con los enlaces, prueba eliminar `node_modules` y el `package-lock.json` del proyecto consumidor y volver a instalar.
297
+
162
298
  ## 📄 Licencia
163
299
 
164
300
  MIT © Lefebvre-El-Derecho-SA