cuenti-dna 0.1.0-beta.1

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 ADDED
@@ -0,0 +1,133 @@
1
+ # cuenti-dna
2
+
3
+ Libreria de componentes React para el sistema de diseno de Cuenti.
4
+
5
+ ## Requisitos
6
+
7
+ - Node.js 18+
8
+ - React 18 o React 19
9
+
10
+ ## Instalacion
11
+
12
+ Version beta actual:
13
+
14
+ ```bash
15
+ npm install cuenti-dna@beta
16
+ ```
17
+
18
+ o
19
+
20
+ ```bash
21
+ pnpm add cuenti-dna@beta
22
+ ```
23
+
24
+ Cuando publiques una version estable, podras instalar con `@latest`.
25
+
26
+ ### Postinstall automatico
27
+
28
+ Al instalar `cuenti-dna`, el paquete ejecuta un `postinstall` que intenta cargar automaticamente las variables CSS y tipografias:
29
+
30
+ - Busca un archivo global CSS del proyecto (por ejemplo `src/styles/globals.css`, `app/globals.css`, `src/index.css`).
31
+ - Inserta al inicio un bloque gestionado por Cuenti con:
32
+ - `@import 'cuenti-dna/styles.css';`
33
+ - imports de tipografias
34
+ - tokens `:root`
35
+ - tokens `@theme inline` (Tailwind v4)
36
+ - Deja el contenido original del proyecto al final del archivo.
37
+ - Si detecta colisiones de variables, pregunta si deseas sobreescribir.
38
+ - En entornos no interactivos (CI), por defecto conserva las variables del proyecto.
39
+ - Puedes forzar overwrite con `CUENTI_DNA_OVERWRITE_VARS=true`.
40
+
41
+ Si tu entorno instala dependencias con scripts deshabilitados, usa import manual:
42
+
43
+ ```tsx
44
+ import 'cuenti-dna/styles.css'
45
+ ```
46
+
47
+ ## Uso
48
+
49
+ Importa los componentes desde el paquete:
50
+
51
+ ```tsx
52
+ import { Input, Button } from 'cuenti-dna'
53
+ ```
54
+
55
+ Importa los estilos globales una sola vez en tu app (por ejemplo en el entrypoint):
56
+
57
+ ```tsx
58
+ import 'cuenti-dna/styles.css'
59
+ ```
60
+
61
+ Ejemplo rapido:
62
+
63
+ ```tsx
64
+ import 'cuenti-dna/styles.css'
65
+ import { Input } from 'cuenti-dna'
66
+
67
+ export function Example() {
68
+ return (
69
+ <Input
70
+ type="text"
71
+ variant="default"
72
+ size="md"
73
+ aria-label="Nombre"
74
+ placeholder="Ingresa tu nombre"
75
+ />
76
+ )
77
+ }
78
+ ```
79
+
80
+ ## Scripts
81
+
82
+ - `pnpm run build`: genera artefactos de libreria en `dist/` (JS ESM/CJS, tipos y CSS).
83
+ - `pnpm run dev`: atajo para levantar Storybook en desarrollo.
84
+ - `pnpm run storybook`: levanta Storybook en desarrollo.
85
+ - `pnpm run build-storybook`: genera el build estatico de Storybook en `storybook-static/`.
86
+ - `pnpm run lint`: ejecuta Biome.
87
+
88
+ ## Publicacion en npm
89
+
90
+ 1. Inicia sesion en npm (una sola vez por maquina):
91
+
92
+ ```bash
93
+ npm login
94
+ ```
95
+
96
+ 2. Verifica build local:
97
+
98
+ ```bash
99
+ pnpm run build
100
+ ```
101
+
102
+ 3. (Opcional) Revisa el contenido que se publicara:
103
+
104
+ ```bash
105
+ npm pack --dry-run
106
+ ```
107
+
108
+ 4. Sube la version beta:
109
+
110
+ ```bash
111
+ npm version prerelease --preid beta
112
+ ```
113
+
114
+ 5. Publica con dist-tag beta:
115
+
116
+ ```bash
117
+ pnpm run publish:beta
118
+ ```
119
+
120
+ Nota: al ser una version `beta`, npm exige publicar con `--tag beta`.
121
+
122
+ ## Storybook deploy
123
+
124
+ Para deployar Storybook en tu proveedor preferido:
125
+
126
+ 1. Ejecuta `pnpm run build-storybook`.
127
+ 2. Publica el contenido de `storybook-static/`.
128
+
129
+ Si usas Chromatic:
130
+
131
+ ```bash
132
+ npx chromatic --project-token=<TU_TOKEN>
133
+ ```