@cloudwick/astral-ui-cli 0.3.0 → 0.4.0
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 +22 -1
- package/dist/index.js +55 -23
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/templates/css/utilities.css +0 -21
package/README.md
CHANGED
|
@@ -163,8 +163,16 @@ npx astral-ui repair-tailwind
|
|
|
163
163
|
This command will:
|
|
164
164
|
- Check for existing Tailwind configuration and create a timestamped backup
|
|
165
165
|
- Create a new Tailwind configuration with the appropriate file extension for your project
|
|
166
|
-
-
|
|
166
|
+
- Set up the complete CSS structure including:
|
|
167
|
+
- Main CSS file with proper imports
|
|
168
|
+
- Fonts stylesheet (fonts.min.css)
|
|
167
169
|
- Ensure proper dependencies are installed
|
|
170
|
+
- Create a backup of any existing Tailwind configuration before modifying it
|
|
171
|
+
|
|
172
|
+
The CSS structure created will match exactly what the `init` command creates, including:
|
|
173
|
+
- CSS variables for colors and theming
|
|
174
|
+
- Font imports and configuration
|
|
175
|
+
- Proper file organization
|
|
168
176
|
|
|
169
177
|
#### Options
|
|
170
178
|
|
|
@@ -174,6 +182,19 @@ This command will:
|
|
|
174
182
|
| `--cwd <dir>` | `-c` | Specify the working directory |
|
|
175
183
|
| `--silent` | `-s` | Mute output |
|
|
176
184
|
|
|
185
|
+
#### Example Usage
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# Basic repair
|
|
189
|
+
npx astral-ui repair-tailwind
|
|
190
|
+
|
|
191
|
+
# Force overwrite existing files
|
|
192
|
+
npx astral-ui repair-tailwind --force
|
|
193
|
+
|
|
194
|
+
# Repair in a specific directory
|
|
195
|
+
npx astral-ui repair-tailwind --cwd ./my-project
|
|
196
|
+
```
|
|
197
|
+
|
|
177
198
|
## Configuration
|
|
178
199
|
|
|
179
200
|
### components.json
|
package/dist/index.js
CHANGED
|
@@ -333,10 +333,6 @@ async function CSS_VARIABLES_TEMPLATE() {
|
|
|
333
333
|
const variables = await getCSSVariables();
|
|
334
334
|
return `
|
|
335
335
|
@import "./fonts.min.css";
|
|
336
|
-
@tailwind base;
|
|
337
|
-
@tailwind components;
|
|
338
|
-
@tailwind utilities;
|
|
339
|
-
@import "./utilities.css";
|
|
340
336
|
|
|
341
337
|
@layer base {
|
|
342
338
|
:root {
|
|
@@ -363,6 +359,13 @@ The \`tailwind.config.js\` file has been configured with:
|
|
|
363
359
|
|
|
364
360
|
**Important:** You must import the styles from \`src/assets/css/index.css\` at the top level of your application (for example, in your main entry file such as \`src/main.tsx\`, \`src/index.js\`, or \`_app.tsx\` in Next.js) to ensure all components are styled correctly.
|
|
365
361
|
|
|
362
|
+
## CSS Structure
|
|
363
|
+
|
|
364
|
+
The styling system consists of several key files:
|
|
365
|
+
|
|
366
|
+
1. \`index.css\` - Main CSS file that imports other stylesheets and defines the Core CSS variables and base styles
|
|
367
|
+
2. \`fonts.min.css\` - Font definitions and configurations
|
|
368
|
+
|
|
366
369
|
## CSS Variables
|
|
367
370
|
|
|
368
371
|
The CSS file includes all necessary CSS variables that the components reference, including:
|
|
@@ -381,6 +384,22 @@ If a component doesn't appear correctly styled, make sure:
|
|
|
381
384
|
1. The Tailwind CSS configuration is properly loaded
|
|
382
385
|
2. The CSS variables are included in your main CSS file
|
|
383
386
|
3. Your component is properly importing the required styles
|
|
387
|
+
4. The \`index.css\` file is imported in the correct order (after Tailwind directives)
|
|
388
|
+
|
|
389
|
+
## Troubleshooting
|
|
390
|
+
|
|
391
|
+
If you experience issues with Tailwind configuration or styling:
|
|
392
|
+
|
|
393
|
+
1. Run \`npx astral-ui repair-tailwind\`
|
|
394
|
+
2. The repair command will:
|
|
395
|
+
- Create a backup of your existing Tailwind configuration
|
|
396
|
+
- Generate a fresh Tailwind configuration file
|
|
397
|
+
- Restore the CSS structure with required variables
|
|
398
|
+
- Set up font files and stylesheets
|
|
399
|
+
3. If styling issues persist after repair:
|
|
400
|
+
- Check that CSS files are imported in the correct order in your application
|
|
401
|
+
- Verify your build tool's PostCSS and Tailwind configuration
|
|
402
|
+
- Ensure all required dependencies are installed correctly
|
|
384
403
|
`;
|
|
385
404
|
async function loadTailwindConfig() {
|
|
386
405
|
try {
|
|
@@ -533,17 +552,6 @@ async function copyTemplateFiles({
|
|
|
533
552
|
} catch (error) {
|
|
534
553
|
console.error(`Failed to copy fonts stylesheet: ${error}`);
|
|
535
554
|
}
|
|
536
|
-
try {
|
|
537
|
-
const utilitiesSrc = import_path4.default.resolve(__dirname, "templates/css/utilities.css");
|
|
538
|
-
const utilitiesDestDir = import_path4.default.dirname(fullCssPath);
|
|
539
|
-
const utilitiesDest = import_path4.default.join(utilitiesDestDir, "utilities.css");
|
|
540
|
-
const utilitiesContent = await import_fs_extra3.default.readFile(utilitiesSrc, "utf-8");
|
|
541
|
-
const cleanedUtilitiesContent = utilitiesContent.replace(/\/\*[\s\S]*?\*\/\n\n/, "");
|
|
542
|
-
await import_fs_extra3.default.writeFile(utilitiesDest, cleanedUtilitiesContent);
|
|
543
|
-
console.info(import_chalk.default.green(`\u2705 Created utilities stylesheet at ${utilitiesDest}`));
|
|
544
|
-
} catch (error) {
|
|
545
|
-
console.error(`Failed to copy utilities stylesheet: ${error}`);
|
|
546
|
-
}
|
|
547
555
|
try {
|
|
548
556
|
const fontsDirSrc = import_path4.default.resolve(__dirname, "templates/fonts");
|
|
549
557
|
const projectCssDir = import_path4.default.dirname(fullCssPath);
|
|
@@ -846,9 +854,12 @@ var init = new import_commander.Command().name("init").description("initialize y
|
|
|
846
854
|
);
|
|
847
855
|
console.info(
|
|
848
856
|
import_chalk2.default.gray(
|
|
849
|
-
" 3.
|
|
857
|
+
" 3. Import CSS files in your application entry point in this order:"
|
|
850
858
|
)
|
|
851
859
|
);
|
|
860
|
+
console.info(import_chalk2.default.gray(" a. Tailwind directives"));
|
|
861
|
+
console.info(import_chalk2.default.gray(" b. index.css from src/assets/css/index.css"));
|
|
862
|
+
console.info(import_chalk2.default.gray(" c. Other CSS files"));
|
|
852
863
|
}
|
|
853
864
|
} catch (error) {
|
|
854
865
|
console.error(import_chalk2.default.red("Error initializing project:"), error);
|
|
@@ -2262,7 +2273,7 @@ PanelGroup.displayName = "PanelGroup";`
|
|
|
2262
2273
|
"files": [
|
|
2263
2274
|
{
|
|
2264
2275
|
"name": "progressVariants.ts",
|
|
2265
|
-
"content": 'import { cva } from "class-variance-authority";\n\nexport const progressContainerVariants = cva(\n "flex items-center gap-2 w-full"\n);\n\nexport const progressTrackVariants = cva(\n "bg-gray-200 h-2 rounded-2xl w-full dark:bg-secondary-600"\n);\n\nexport const progressBarVariants = cva(\n "flex justify-center items-center outline rounded-sm text-xs font-medium transition-all duration-100 h-full py-1 relative group",\n {\n variants: {\n color: {\n primary: "!bg-primary-500 outline-primary-400 dark:bg-primary-400 dark:outline-primary-500",\n secondary: "bg-gray-500 outline-gray-400 dark:bg-secondary-400 dark:outline-gray-500",\n success: "bg-success-500 outline-success-400 dark:bg-success-400 dark:outline-success-500",\n warning: "bg-warning-500 outline-warning-400 dark:bg-warning-400 dark:outline-warning-500",\n error: "bg-error-500 outline-error-400 dark:bg-error-400 dark:outline-error-500"\n },\n striped: {\n true: "
|
|
2276
|
+
"content": 'import { cva } from "class-variance-authority";\n\nexport const progressContainerVariants = cva(\n "flex items-center gap-2 w-full"\n);\n\nexport const progressTrackVariants = cva(\n "bg-gray-200 h-2 rounded-2xl w-full dark:bg-secondary-600"\n);\n\nexport const progressBarVariants = cva(\n "flex justify-center items-center outline rounded-sm text-xs font-medium transition-all duration-100 h-full py-1 relative group",\n {\n variants: {\n color: {\n primary: "!bg-primary-500 outline-primary-400 dark:bg-primary-400 dark:outline-primary-500",\n secondary: "bg-gray-500 outline-gray-400 dark:bg-secondary-400 dark:outline-gray-500",\n success: "bg-success-500 outline-success-400 dark:bg-success-400 dark:outline-success-500",\n warning: "bg-warning-500 outline-warning-400 dark:bg-warning-400 dark:outline-warning-500",\n error: "bg-error-500 outline-error-400 dark:bg-error-400 dark:outline-error-500"\n },\n striped: {\n true: [\n "bg-[size:0.5rem_0.5rem]",\n "bg-[image:repeating-linear-gradient(45deg,rgba(255,255,255,0.15)_0_0.25rem,transparent_0.25rem_0.5rem)]"\n ].join( " " )\n },\n animate: {\n true: "animate-stripes"\n }\n },\n defaultVariants: {\n color: "primary"\n }\n }\n);\n\nexport const progressTextVariants = cva(\n [\n "flex items-center justify-center text-xs-fit text-white dark:text-secondary-800",\n "h-8 w-8 border rounded-full dark:border-secondary-800 opacity-0 group-hover:opacity-100",\n "transition-opacity duration-300 ease-in-out z-10 absolute -end-4"\n ].join( " " ),\n {\n variants: {\n position: {\n top: "bottom-3",\n right: "", // Not needed for position right\n bottom: "top-3",\n inline: "-end-4"\n },\n color: {\n primary: "bg-primary-500 dark:bg-primary-400",\n secondary: "bg-gray-500 dark:bg-secondary-400",\n success: "bg-success-500 dark:bg-success-400",\n warning: "bg-warning-500 dark:bg-warning-400",\n error: "bg-error-500 dark:bg-error-400"\n }\n },\n defaultVariants: {\n position: "right",\n color: "primary"\n }\n }\n);\n\nexport const progressValueTextVariants = cva(\n "text-base text-center text-secondary-500 font-medium min-w-8 dark:text-secondary-50"\n);\n\nexport const progressCircularVariants = cva(\n "",\n {\n variants: {\n size: {\n md: "",\n lg: ""\n }\n },\n defaultVariants: {\n size: "md"\n }\n }\n);\n\nexport const progressCircularTrackVariants = cva(\n "dark:stroke-secondary-600",\n {\n variants: {\n color: {\n primary: "stroke-primary-50",\n secondary: "stroke-gray-50",\n success: "stroke-success-50",\n warning: "stroke-warning-50",\n error: "stroke-error-50"\n }\n },\n defaultVariants: {\n color: "primary"\n }\n }\n);\n\nexport const progressCircularProgressVariants = cva(\n "",\n {\n variants: {\n color: {\n primary: "stroke-primary-500 dark:stroke-primary-400",\n secondary: "stroke-gray-500 dark:stroke-secondary-400",\n success: "stroke-success-500 dark:stroke-success-400",\n warning: "stroke-warning-500 dark:stroke-warning-400",\n error: "stroke-error-500 dark:stroke-error-400"\n }\n },\n defaultVariants: {\n color: "primary"\n }\n }\n);\n\nexport const progressCircularTextVariants = cva(\n "fill-secondary-500 font-semibold dark:fill-secondary-50",\n {\n variants: {\n size: {\n md: "text-xxs",\n lg: "text-xs-fit"\n }\n },\n defaultVariants: {\n size: "md"\n }\n }\n);'
|
|
2266
2277
|
},
|
|
2267
2278
|
{
|
|
2268
2279
|
"name": "progress.tsx",
|
|
@@ -3200,7 +3211,8 @@ var repairTailwindOptionsSchema = import_zod3.z.object({
|
|
|
3200
3211
|
silent: import_zod3.z.boolean().default(false)
|
|
3201
3212
|
});
|
|
3202
3213
|
async function getCSSVariables2() {
|
|
3203
|
-
const
|
|
3214
|
+
const templatesDir = getTemplatesDir();
|
|
3215
|
+
const baseCSSPath = import_path9.default.join(templatesDir, "css", "base.css");
|
|
3204
3216
|
try {
|
|
3205
3217
|
const content = await import_fs_extra7.default.readFile(baseCSSPath, "utf-8");
|
|
3206
3218
|
const rootBlockMatch = content.match(/@layer base\s*{\s*:root\s*{([^}]+)}/s);
|
|
@@ -3213,6 +3225,25 @@ async function getCSSVariables2() {
|
|
|
3213
3225
|
throw error;
|
|
3214
3226
|
}
|
|
3215
3227
|
}
|
|
3228
|
+
function getTemplatesDir() {
|
|
3229
|
+
const isDev = __dirname.includes("src");
|
|
3230
|
+
if (isDev) {
|
|
3231
|
+
return import_path9.default.resolve(__dirname, "..", "templates");
|
|
3232
|
+
}
|
|
3233
|
+
return import_path9.default.resolve(__dirname, "..", "..", "templates");
|
|
3234
|
+
}
|
|
3235
|
+
async function copyFontsStylesheet(cssDir) {
|
|
3236
|
+
try {
|
|
3237
|
+
const templatesDir = getTemplatesDir();
|
|
3238
|
+
const fontsSrc = import_path9.default.join(templatesDir, "css", "fonts.min.css");
|
|
3239
|
+
const fontsDest = import_path9.default.join(cssDir, "fonts.min.css");
|
|
3240
|
+
await import_fs_extra7.default.copy(fontsSrc, fontsDest);
|
|
3241
|
+
console.info(import_chalk5.default.green(`\u2705 Created fonts stylesheet at ${fontsDest}`));
|
|
3242
|
+
} catch (error) {
|
|
3243
|
+
console.error(import_chalk5.default.red(`Failed to copy fonts stylesheet: ${error}`));
|
|
3244
|
+
throw error;
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3216
3247
|
var repairTailwind = new import_commander3.Command().name("repair-tailwind").description(
|
|
3217
3248
|
"repair tailwind configuration when setup fails - only use if experiencing issues with Tailwind"
|
|
3218
3249
|
).option("-f, --force", "force overwrite of existing configuration", false).option(
|
|
@@ -3350,12 +3381,11 @@ export function cn(...inputs: ClassValue[]) {
|
|
|
3350
3381
|
if (!import_fs_extra7.default.existsSync(cssPath) || options.force) {
|
|
3351
3382
|
try {
|
|
3352
3383
|
console.info(import_chalk5.default.cyan(`Directly creating CSS file at ${cssPath}`));
|
|
3353
|
-
|
|
3384
|
+
const cssDir = import_path9.default.dirname(cssPath);
|
|
3385
|
+
await import_fs_extra7.default.ensureDir(cssDir);
|
|
3354
3386
|
const cssVariables = await getCSSVariables2();
|
|
3355
3387
|
const cssContent = `
|
|
3356
|
-
@
|
|
3357
|
-
@tailwind components;
|
|
3358
|
-
@tailwind utilities;
|
|
3388
|
+
@import "./fonts.min.css";
|
|
3359
3389
|
|
|
3360
3390
|
@layer base {
|
|
3361
3391
|
:root {
|
|
@@ -3364,6 +3394,8 @@ ${cssVariables}
|
|
|
3364
3394
|
}
|
|
3365
3395
|
`;
|
|
3366
3396
|
await import_fs_extra7.default.writeFile(cssPath, cssContent.trim());
|
|
3397
|
+
console.info(import_chalk5.default.green(`\u2705 Created CSS file at ${cssPath}`));
|
|
3398
|
+
await copyFontsStylesheet(import_path9.default.dirname(cssPath));
|
|
3367
3399
|
} catch (error) {
|
|
3368
3400
|
console.error(import_chalk5.default.red(`Failed to create CSS file: ${error}`));
|
|
3369
3401
|
}
|
|
@@ -3642,7 +3674,7 @@ import { cn } from '@utils';
|
|
|
3642
3674
|
var import_gradient_string = __toESM(require("gradient-string"));
|
|
3643
3675
|
var packageInfo = {
|
|
3644
3676
|
name: "@cloudwick/astral-ui-cli",
|
|
3645
|
-
version: "0.
|
|
3677
|
+
version: "0.4.0"
|
|
3646
3678
|
};
|
|
3647
3679
|
var program = new import_commander5.Command().name(packageInfo.name).description("CLI for installing Astral UI components in any codebase").version(
|
|
3648
3680
|
packageInfo.version,
|