@glass-ui-kit/cli 0.2.2 → 0.2.4

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.
Files changed (2) hide show
  1. package/dist/index.js +120 -78
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -45,6 +45,9 @@ async function getFramework() {
45
45
  const content = await readFile("package.json");
46
46
  const pkg = JSON.parse(content);
47
47
  const deps = { ...pkg.dependencies, ...pkg.devDependencies };
48
+ if (deps["@remix-run/react"] || deps["@remix-run/dev"] || deps["@react-router/dev"] || deps["@react-router/node"]) {
49
+ return "remix";
50
+ }
48
51
  if (deps["next"]) return "next";
49
52
  if (deps["astro"]) return "astro";
50
53
  if (deps["vite"]) return "vite";
@@ -58,6 +61,12 @@ function getCssPath(framework) {
58
61
  next: ["app/globals.css", "src/app/globals.css", "styles/globals.css"],
59
62
  vite: ["src/index.css", "src/main.css", "src/style.css"],
60
63
  astro: ["src/styles/global.css", "src/global.css"],
64
+ remix: [
65
+ "app/app.css",
66
+ "app/tailwind.css",
67
+ "app/globals.css",
68
+ "app/styles/tailwind.css"
69
+ ],
61
70
  unknown: ["src/index.css", "styles.css"]
62
71
  };
63
72
  for (const p of paths[framework] || []) {
@@ -184,74 +193,88 @@ body {
184
193
  color: var(--foreground);
185
194
  }
186
195
 
187
- @layer components {
188
- /* .glass -> La clase fundacional.
189
- Usa las variables por defecto (--glass-bg, etc).
190
- */
191
- .glass,
192
- .hover\\:glass:hover {
193
- background: var(--glass-bg);
194
- border: 1px solid var(--glass-border);
195
- backdrop-filter: blur(var(--glass-blur));
196
- box-shadow: var(--glass-shadow);
197
- }
196
+ @utility glass {
197
+ background-color: var(--glass-bg);
198
+ border-width: 1px;
199
+ border-style: solid;
200
+ border-color: var(--glass-border);
201
+ backdrop-filter: blur(var(--glass-blur));
202
+ box-shadow: var(--glass-shadow);
203
+ }
198
204
 
199
- /* PRESETS DE INTENSIDAD
200
- No reescriben propiedades CSS (background, border).
201
- Solo re-asignan las variables locales.
202
- */
203
- .glass-strong,
204
- .hover\\:glass-strong:hover {
205
- --glass-bg: var(--glass-bg-strong);
206
- --glass-border: var(--glass-border-strong);
207
- --glass-blur: var(--glass-blur-strong);
208
- }
205
+ @utility glass-strong {
206
+ --glass-bg: var(--glass-bg-strong);
207
+ --glass-border: var(--glass-border-strong);
208
+ --glass-blur: var(--glass-blur-strong);
209
+ }
209
210
 
210
- .glass-soft,
211
- .hover\\:glass-soft:hover {
212
- --glass-bg: var(--glass-bg-soft);
213
- --glass-border: var(--glass-border-soft);
214
- --glass-blur: var(--glass-blur-soft);
215
- }
211
+ @utility glass-soft {
212
+ --glass-bg: var(--glass-bg-soft);
213
+ --glass-border: var(--glass-border-soft);
214
+ --glass-blur: var(--glass-blur-soft);
215
+ }
216
216
 
217
- /* SIZES */
218
- .input-sm,
219
- .btn-sm {
220
- height: 1.5rem;
221
- padding-left: 0.5rem;
222
- padding-right: 0.5rem;
223
- font-size: 0.75rem;
224
- line-height: 1rem;
225
- gap: 0.375rem;
226
- }
217
+ @utility input-sm {
218
+ height: 1.5rem;
219
+ padding-left: 0.5rem;
220
+ padding-right: 0.5rem;
221
+ font-size: 0.75rem;
222
+ line-height: 1rem;
223
+ gap: 0.375rem;
224
+ }
227
225
 
228
- .input-md,
229
- .btn-md {
230
- height: 2rem;
231
- padding-top: 0.5rem;
232
- padding-bottom: 0.5rem;
233
- padding-left: 0.625rem;
234
- padding-right: 0.625rem;
235
- font-size: 0.875rem;
236
- line-height: 1.25rem;
237
- gap: 0.5rem;
238
- }
226
+ @utility btn-sm {
227
+ height: 1.5rem;
228
+ padding-left: 0.5rem;
229
+ padding-right: 0.5rem;
230
+ font-size: 0.75rem;
231
+ line-height: 1rem;
232
+ gap: 0.375rem;
233
+ }
239
234
 
240
- .input-lg,
241
- .btn-lg {
242
- height: 2.5rem;
243
- padding-left: 0.875rem;
244
- padding-right: 0.875rem;
245
- font-size: 1rem;
246
- line-height: 1.5rem;
247
- gap: 0.625rem;
248
- }
235
+ @utility input-md {
236
+ height: 2rem;
237
+ padding-top: 0.5rem;
238
+ padding-bottom: 0.5rem;
239
+ padding-left: 0.625rem;
240
+ padding-right: 0.625rem;
241
+ font-size: 0.875rem;
242
+ line-height: 1.25rem;
243
+ gap: 0.5rem;
244
+ }
249
245
 
250
- /* ICON BUTTON */
251
- .btn-icon {
252
- padding: 0;
253
- aspect-ratio: 1 / 1;
254
- }
246
+ @utility btn-md {
247
+ height: 2rem;
248
+ padding-top: 0.5rem;
249
+ padding-bottom: 0.5rem;
250
+ padding-left: 0.625rem;
251
+ padding-right: 0.625rem;
252
+ font-size: 0.875rem;
253
+ line-height: 1.25rem;
254
+ gap: 0.5rem;
255
+ }
256
+
257
+ @utility input-lg {
258
+ height: 2.5rem;
259
+ padding-left: 0.875rem;
260
+ padding-right: 0.875rem;
261
+ font-size: 1rem;
262
+ line-height: 1.5rem;
263
+ gap: 0.625rem;
264
+ }
265
+
266
+ @utility btn-lg {
267
+ height: 2.5rem;
268
+ padding-left: 0.875rem;
269
+ padding-right: 0.875rem;
270
+ font-size: 1rem;
271
+ line-height: 1.5rem;
272
+ gap: 0.625rem;
273
+ }
274
+
275
+ @utility btn-icon {
276
+ padding: 0;
277
+ aspect-ratio: 1 / 1;
255
278
  }
256
279
  `;
257
280
 
@@ -273,14 +296,23 @@ var init = new Command().name("init").description("Initialize configuration and
273
296
  const cwd = process.cwd();
274
297
  const configPath = "glass.config.json";
275
298
  const hasSrc = exists("src");
299
+ let baseDir = hasSrc ? "src" : "";
300
+ if (framework === "remix") {
301
+ baseDir = "app";
302
+ }
276
303
  let cssPath = getCssPath(framework);
277
304
  if (!cssPath || framework === "next") {
278
- cssPath = hasSrc ? "src/app/globals.css" : "app/globals.css";
305
+ if (framework === "next") {
306
+ cssPath = hasSrc ? "src/app/globals.css" : "app/globals.css";
307
+ } else if (framework === "remix") {
308
+ cssPath = "app/app.css";
309
+ } else {
310
+ cssPath = hasSrc ? "src/index.css" : "index.css";
311
+ }
279
312
  }
280
- const utilsPath = path2.join(
281
- cwd,
282
- hasSrc ? "src/lib/utils.ts" : "lib/utils.ts"
283
- );
313
+ const utilsRelativePath = baseDir ? `${baseDir}/lib/utils.ts` : "lib/utils.ts";
314
+ const utilsPath = path2.join(cwd, utilsRelativePath);
315
+ const aliasPrefix = framework === "remix" ? "~" : "@";
284
316
  if (!exists(configPath)) {
285
317
  await writeFile(
286
318
  configPath,
@@ -290,8 +322,8 @@ var init = new Command().name("init").description("Initialize configuration and
290
322
  style: "default",
291
323
  css: cssPath,
292
324
  aliases: {
293
- components: "@/components/ui",
294
- utils: "@/lib/utils"
325
+ components: `${aliasPrefix}/components/ui`,
326
+ utils: `${aliasPrefix}/lib/utils`
295
327
  }
296
328
  },
297
329
  null,
@@ -304,11 +336,9 @@ var init = new Command().name("init").description("Initialize configuration and
304
336
  }
305
337
  if (!exists(utilsPath)) {
306
338
  await writeFile(utilsPath, UTILS_CN);
307
- const displayPath = hasSrc ? "src/lib/utils.ts" : "lib/utils.ts";
308
- console.log(chalk.green(` Created ${displayPath}`));
339
+ console.log(chalk.green(` Created ${utilsRelativePath}`));
309
340
  } else {
310
- const displayPath = hasSrc ? "src/lib/utils.ts" : "lib/utils.ts";
311
- console.log(chalk.gray(` ${displayPath} already exists.`));
341
+ console.log(chalk.gray(` ${utilsRelativePath} already exists.`));
312
342
  }
313
343
  let cssContent = "";
314
344
  try {
@@ -333,13 +363,18 @@ ${GLASS_BASE_STYLES}`;
333
363
  console.log(chalk.gray(` Tokens already present in ${cssPath}`));
334
364
  }
335
365
  console.log(
336
- chalk.cyan(` Installing dependencies (clsx, tailwind-merge)...`)
366
+ chalk.cyan(
367
+ ` Installing dependencies (clsx, tailwind-merge, lucide-react)...`
368
+ )
337
369
  );
338
- await installDependencies(["clsx", "tailwind-merge"], pm);
370
+ await installDependencies(["clsx", "tailwind-merge", "lucide-react"], pm);
371
+ const runCommand = pm === "bun" ? "bunx" : pm === "pnpm" ? "pnpm dlx" : "npx";
339
372
  console.log(chalk.bold.green("\nSetup complete."));
340
373
  console.log(`Try adding a component:
341
374
  `);
342
- console.log(chalk.cyan(` npx @glass-ui-kit/cli@latest add card`));
375
+ console.log(
376
+ chalk.cyan(` ${runCommand} @glass-ui-kit/cli@latest add card`)
377
+ );
343
378
  console.log("");
344
379
  } catch (error) {
345
380
  console.error(chalk.red("\nInitialization failed:"));
@@ -504,8 +539,15 @@ var add = new Command2().name("add").description("Add a component to your projec
504
539
  }
505
540
  const hasSrc = exists("src");
506
541
  const targetDirAlias = config.aliases.components || "@/components/ui";
507
- const relativeAliasPath = targetDirAlias.replace(/^@\//, "");
508
- const targetDir = hasSrc ? `./src/${relativeAliasPath}` : `./${relativeAliasPath}`;
542
+ const relativeAliasPath = targetDirAlias.replace(/^[@~]\//, "");
543
+ let targetDir = "";
544
+ if (config.framework === "remix") {
545
+ targetDir = `./app/${relativeAliasPath}`;
546
+ } else if (hasSrc) {
547
+ targetDir = `./src/${relativeAliasPath}`;
548
+ } else {
549
+ targetDir = `./${relativeAliasPath}`;
550
+ }
509
551
  for (const file of item.files) {
510
552
  const fileName = path4.basename(file.path);
511
553
  const filePath = path4.join(targetDir, fileName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glass-ui-kit/cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "The official CLI for Glass UI. Add glassmorphism components to your React projects in seconds.",
5
5
  "keywords": [
6
6
  "glassmorphism",