cuenti-dna 0.1.1-beta.2 → 0.1.1-beta.3

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
@@ -23,9 +23,13 @@ pnpm add cuenti-dna@beta
23
23
 
24
24
  Cuando publiques una version estable, podras instalar con `@latest`.
25
25
 
26
- ### Inicializacion interactiva (estilo shadcn)
26
+ ### Inicializacion de estilos
27
27
 
28
- Al instalar `cuenti-dna` en una terminal interactiva, se abre automaticamente un asistente (wizard) para configurar estilos.
28
+ Durante la instalacion (`postinstall`):
29
+
30
+ - En terminal interactiva, se abre automaticamente un asistente (wizard) para configurar estilos.
31
+ - En entorno no interactivo, se intenta configurar automaticamente el primer archivo CSS detectado (por ejemplo `app/globals.css`, `src/index.css`, `src/main.css`, etc.).
32
+ - Si no se detecta un archivo CSS conocido, se muestra un mensaje de fallback para importar `cuenti-dna/styles.css` o ejecutar `init` manualmente.
29
33
 
30
34
  Tambien puedes ejecutarlo manualmente cuando quieras:
31
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cuenti-dna",
3
- "version": "0.1.1-beta.2",
3
+ "version": "0.1.1-beta.3",
4
4
  "private": false,
5
5
  "description": "Cuenti design system components for React",
6
6
  "type": "module",
@@ -6,7 +6,11 @@ const TARGET_CSS_CANDIDATES = [
6
6
  'src/styles/globals.css',
7
7
  'src/globals.css',
8
8
  'app/globals.css',
9
+ 'src/main.css',
10
+ 'src/App.css',
9
11
  'styles/globals.css',
12
+ 'styles.css',
13
+ 'app.css',
10
14
  'src/index.css',
11
15
  'src/styles.css',
12
16
  'src/app.css'
@@ -186,6 +186,17 @@ const runInit = async (rawFlags) => {
186
186
  })
187
187
  }
188
188
 
189
+ const runInitFromPostinstall = async (flags) => {
190
+ try {
191
+ await runInit(flags)
192
+ return true
193
+ } catch (error) {
194
+ const details = error instanceof Error ? error.message : String(error)
195
+ log(`Setup skipped: ${details}`)
196
+ return false
197
+ }
198
+ }
199
+
189
200
  const runPostinstall = async () => {
190
201
  const packageRoot = path.resolve(__dirname, '..', '..')
191
202
  const projectRoot = process.env.INIT_CWD
@@ -205,19 +216,52 @@ const runPostinstall = async () => {
205
216
  }
206
217
 
207
218
  if (!isInteractiveSession()) {
208
- log('Skipped interactive setup (non-interactive environment).')
209
- log('Run "npx cuenti-dna@beta init" later to configure CSS tokens.')
219
+ const existingCandidates = listExistingCssCandidates(projectRoot)
220
+
221
+ if (existingCandidates.length === 0) {
222
+ log(
223
+ 'Skipped automatic CSS setup (non-interactive environment and no known CSS entry file found).'
224
+ )
225
+ log(
226
+ 'Import "cuenti-dna/styles.css" once in your app entrypoint, or run "npx cuenti-dna@beta init --css <your-css-file>".'
227
+ )
228
+ return
229
+ }
230
+
231
+ const targetCssFile = existingCandidates[0]
232
+ log(
233
+ `Detected non-interactive environment. Applying setup to ${targetCssFile}.`
234
+ )
235
+
236
+ const applied = await runInitFromPostinstall({
237
+ project: projectRoot,
238
+ css: targetCssFile,
239
+ yes: true,
240
+ overwrite: null,
241
+ help: false
242
+ })
243
+
244
+ if (!applied) {
245
+ log(
246
+ 'Import "cuenti-dna/styles.css" once in your app entrypoint, or run "npx cuenti-dna@beta init" manually.'
247
+ )
248
+ }
249
+
210
250
  return
211
251
  }
212
252
 
213
253
  log('Launching setup wizard...')
214
- await runInit({
254
+ const applied = await runInitFromPostinstall({
215
255
  project: projectRoot,
216
256
  css: null,
217
257
  yes: false,
218
258
  overwrite: null,
219
259
  help: false
220
260
  })
261
+
262
+ if (!applied) {
263
+ log('Run "npx cuenti-dna@beta init" later to configure CSS tokens.')
264
+ }
221
265
  }
222
266
 
223
267
  module.exports = {