@glass-ui-kit/cli 0.2.3 → 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.
- package/dist/index.js +112 -75
- 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
|
-
@
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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
|
-
|
|
218
|
-
.
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
-
|
|
229
|
-
.
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
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
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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
|
-
|
|
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
|
|
281
|
-
|
|
282
|
-
|
|
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:
|
|
294
|
-
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
|
-
|
|
308
|
-
console.log(chalk.green(` Created ${displayPath}`));
|
|
339
|
+
console.log(chalk.green(` Created ${utilsRelativePath}`));
|
|
309
340
|
} else {
|
|
310
|
-
|
|
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 {
|
|
@@ -509,8 +539,15 @@ var add = new Command2().name("add").description("Add a component to your projec
|
|
|
509
539
|
}
|
|
510
540
|
const hasSrc = exists("src");
|
|
511
541
|
const targetDirAlias = config.aliases.components || "@/components/ui";
|
|
512
|
-
const relativeAliasPath = targetDirAlias.replace(
|
|
513
|
-
|
|
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
|
+
}
|
|
514
551
|
for (const file of item.files) {
|
|
515
552
|
const fileName = path4.basename(file.path);
|
|
516
553
|
const filePath = path4.join(targetDir, fileName);
|