myoperator-ui 0.0.152 → 0.0.154-beta.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/dist/index.js +106 -111
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,9 +5,9 @@ import { Command } from "commander";
|
|
|
5
5
|
import { createRequire } from "module";
|
|
6
6
|
|
|
7
7
|
// src/commands/add.ts
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
8
|
+
import chalk from "chalk";
|
|
9
|
+
import fs2 from "fs-extra";
|
|
10
|
+
import path2 from "path";
|
|
11
11
|
import prompts from "prompts";
|
|
12
12
|
import ora from "ora";
|
|
13
13
|
|
|
@@ -5679,7 +5679,7 @@ export { PageHeader, pageHeaderVariants };
|
|
|
5679
5679
|
{
|
|
5680
5680
|
name: "event-selector.tsx",
|
|
5681
5681
|
content: prefixTailwindClasses(`import * as React from "react";
|
|
5682
|
-
import { cn } from "
|
|
5682
|
+
import { cn } from "../../lib/utils";
|
|
5683
5683
|
import { EventGroupComponent } from "./event-group";
|
|
5684
5684
|
import type { EventSelectorProps, EventCategory, EventGroup } from "./types";
|
|
5685
5685
|
|
|
@@ -5872,14 +5872,14 @@ EventSelector.displayName = "EventSelector";
|
|
|
5872
5872
|
{
|
|
5873
5873
|
name: "event-group.tsx",
|
|
5874
5874
|
content: prefixTailwindClasses(`import * as React from "react";
|
|
5875
|
-
import { cn } from "
|
|
5876
|
-
import { Checkbox, type CheckedState } from "
|
|
5875
|
+
import { cn } from "../../lib/utils";
|
|
5876
|
+
import { Checkbox, type CheckedState } from "../checkbox";
|
|
5877
5877
|
import {
|
|
5878
5878
|
Accordion,
|
|
5879
5879
|
AccordionItem,
|
|
5880
5880
|
AccordionTrigger,
|
|
5881
5881
|
AccordionContent,
|
|
5882
|
-
} from "
|
|
5882
|
+
} from "../accordion";
|
|
5883
5883
|
import { EventItemComponent } from "./event-item";
|
|
5884
5884
|
import type { EventGroupComponentProps } from "./types";
|
|
5885
5885
|
|
|
@@ -6058,8 +6058,8 @@ EventGroupComponent.displayName = "EventGroupComponent";
|
|
|
6058
6058
|
{
|
|
6059
6059
|
name: "event-item.tsx",
|
|
6060
6060
|
content: prefixTailwindClasses(`import * as React from "react";
|
|
6061
|
-
import { cn } from "
|
|
6062
|
-
import { Checkbox } from "
|
|
6061
|
+
import { cn } from "../../lib/utils";
|
|
6062
|
+
import { Checkbox } from "../checkbox";
|
|
6063
6063
|
import type { EventItemComponentProps } from "./types";
|
|
6064
6064
|
|
|
6065
6065
|
/**
|
|
@@ -6236,8 +6236,8 @@ export interface EventItemComponentProps {
|
|
|
6236
6236
|
name: "key-value-input.tsx",
|
|
6237
6237
|
content: prefixTailwindClasses(`import * as React from "react";
|
|
6238
6238
|
import { Plus } from "lucide-react";
|
|
6239
|
-
import { cn } from "
|
|
6240
|
-
import { Button } from "
|
|
6239
|
+
import { cn } from "../../lib/utils";
|
|
6240
|
+
import { Button } from "../button";
|
|
6241
6241
|
import { KeyValueRow } from "./key-value-row";
|
|
6242
6242
|
import type { KeyValueInputProps, KeyValuePair } from "./types";
|
|
6243
6243
|
|
|
@@ -6479,9 +6479,9 @@ KeyValueInput.displayName = "KeyValueInput";
|
|
|
6479
6479
|
name: "key-value-row.tsx",
|
|
6480
6480
|
content: prefixTailwindClasses(`import * as React from "react";
|
|
6481
6481
|
import { Trash2 } from "lucide-react";
|
|
6482
|
-
import { cn } from "
|
|
6483
|
-
import { Input } from "
|
|
6484
|
-
import { Button } from "
|
|
6482
|
+
import { cn } from "../../lib/utils";
|
|
6483
|
+
import { Input } from "../input";
|
|
6484
|
+
import { Button } from "../button";
|
|
6485
6485
|
import type { KeyValueRowProps } from "./types";
|
|
6486
6486
|
|
|
6487
6487
|
/**
|
|
@@ -6668,8 +6668,8 @@ export interface KeyValueRowProps {
|
|
|
6668
6668
|
{
|
|
6669
6669
|
name: "api-feature-card.tsx",
|
|
6670
6670
|
content: prefixTailwindClasses(`import * as React from "react";
|
|
6671
|
-
import { Button } from "
|
|
6672
|
-
import { cn } from "
|
|
6671
|
+
import { Button } from "../button";
|
|
6672
|
+
import { cn } from "../../lib/utils";
|
|
6673
6673
|
|
|
6674
6674
|
export interface Capability {
|
|
6675
6675
|
/** Unique identifier for the capability */
|
|
@@ -6789,7 +6789,7 @@ export const ApiFeatureCard = React.forwardRef<
|
|
|
6789
6789
|
key={capability.id}
|
|
6790
6790
|
className="flex items-center gap-1.5"
|
|
6791
6791
|
>
|
|
6792
|
-
<span className="h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--
|
|
6792
|
+
<span className="h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--color-neutral-400,#A4A7AE)]" />
|
|
6793
6793
|
<span className="text-sm text-[var(--semantic-text-primary,#181D27)] tracking-[0.035px]">
|
|
6794
6794
|
{capability.label}
|
|
6795
6795
|
</span>
|
|
@@ -6834,8 +6834,8 @@ export type { ApiFeatureCardProps, Capability } from "./api-feature-card";
|
|
|
6834
6834
|
name: "endpoint-details.tsx",
|
|
6835
6835
|
content: prefixTailwindClasses(`import * as React from "react";
|
|
6836
6836
|
import { XCircle } from "lucide-react";
|
|
6837
|
-
import { cn } from "
|
|
6838
|
-
import { ReadableField } from "
|
|
6837
|
+
import { cn } from "../../lib/utils";
|
|
6838
|
+
import { ReadableField } from "../readable-field";
|
|
6839
6839
|
|
|
6840
6840
|
export interface EndpointDetailsProps
|
|
6841
6841
|
extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -7066,9 +7066,9 @@ export type { EndpointDetailsProps } from "./endpoint-details";
|
|
|
7066
7066
|
{
|
|
7067
7067
|
name: "alert-configuration.tsx",
|
|
7068
7068
|
content: prefixTailwindClasses(`import * as React from "react";
|
|
7069
|
-
import { Button } from "
|
|
7069
|
+
import { Button } from "../button";
|
|
7070
7070
|
import { Pencil } from "lucide-react";
|
|
7071
|
-
import { cn } from "
|
|
7071
|
+
import { cn } from "../../lib/utils";
|
|
7072
7072
|
|
|
7073
7073
|
export interface AlertConfigurationProps {
|
|
7074
7074
|
/** Minimum balance threshold */
|
|
@@ -7193,8 +7193,8 @@ AlertConfiguration.displayName = "AlertConfiguration";
|
|
|
7193
7193
|
{
|
|
7194
7194
|
name: "alert-values-modal.tsx",
|
|
7195
7195
|
content: prefixTailwindClasses(`import * as React from "react";
|
|
7196
|
-
import { FormModal } from "
|
|
7197
|
-
import { Input } from "
|
|
7196
|
+
import { FormModal } from "../form-modal";
|
|
7197
|
+
import { Input } from "../input";
|
|
7198
7198
|
|
|
7199
7199
|
export interface AlertValuesModalProps {
|
|
7200
7200
|
/** Whether the modal is open */
|
|
@@ -7359,14 +7359,14 @@ export type { AlertValuesModalProps } from "./alert-values-modal";
|
|
|
7359
7359
|
{
|
|
7360
7360
|
name: "auto-pay-setup.tsx",
|
|
7361
7361
|
content: prefixTailwindClasses(`import * as React from "react";
|
|
7362
|
-
import { cn } from "
|
|
7363
|
-
import { Button } from "
|
|
7362
|
+
import { cn } from "../../lib/utils";
|
|
7363
|
+
import { Button } from "../button";
|
|
7364
7364
|
import {
|
|
7365
7365
|
Accordion,
|
|
7366
7366
|
AccordionItem,
|
|
7367
7367
|
AccordionTrigger,
|
|
7368
7368
|
AccordionContent,
|
|
7369
|
-
} from "
|
|
7369
|
+
} from "../accordion";
|
|
7370
7370
|
import type { AutoPaySetupProps } from "./types";
|
|
7371
7371
|
|
|
7372
7372
|
/**
|
|
@@ -7549,13 +7549,13 @@ export type { AutoPaySetupProps } from "./types";
|
|
|
7549
7549
|
name: "bank-details.tsx",
|
|
7550
7550
|
content: prefixTailwindClasses(`import * as React from "react";
|
|
7551
7551
|
import { Copy, Check } from "lucide-react";
|
|
7552
|
-
import { cn } from "
|
|
7552
|
+
import { cn } from "../../lib/utils";
|
|
7553
7553
|
import {
|
|
7554
7554
|
Accordion,
|
|
7555
7555
|
AccordionItem,
|
|
7556
7556
|
AccordionTrigger,
|
|
7557
7557
|
AccordionContent,
|
|
7558
|
-
} from "
|
|
7558
|
+
} from "../accordion";
|
|
7559
7559
|
import type { BankDetailsProps, BankDetailItem } from "./types";
|
|
7560
7560
|
|
|
7561
7561
|
/**
|
|
@@ -7767,14 +7767,14 @@ export type { BankDetailsProps, BankDetailItem } from "./types";
|
|
|
7767
7767
|
name: "payment-summary.tsx",
|
|
7768
7768
|
content: prefixTailwindClasses(`import * as React from "react";
|
|
7769
7769
|
import { Info } from "lucide-react";
|
|
7770
|
-
import { cn } from "
|
|
7770
|
+
import { cn } from "../../lib/utils";
|
|
7771
7771
|
import {
|
|
7772
7772
|
Tooltip,
|
|
7773
7773
|
TooltipContent,
|
|
7774
7774
|
TooltipProvider,
|
|
7775
7775
|
TooltipTrigger,
|
|
7776
7776
|
TooltipArrow,
|
|
7777
|
-
} from "
|
|
7777
|
+
} from "../tooltip";
|
|
7778
7778
|
|
|
7779
7779
|
/**
|
|
7780
7780
|
* Represents a single row in the payment summary.
|
|
@@ -7951,15 +7951,15 @@ export type {
|
|
|
7951
7951
|
name: "wallet-topup.tsx",
|
|
7952
7952
|
content: prefixTailwindClasses(`import * as React from "react";
|
|
7953
7953
|
import { Check, Ticket } from "lucide-react";
|
|
7954
|
-
import { cn } from "
|
|
7955
|
-
import { Button } from "
|
|
7956
|
-
import { Input } from "
|
|
7954
|
+
import { cn } from "../../lib/utils";
|
|
7955
|
+
import { Button } from "../button";
|
|
7956
|
+
import { Input } from "../input";
|
|
7957
7957
|
import {
|
|
7958
7958
|
Accordion,
|
|
7959
7959
|
AccordionItem,
|
|
7960
7960
|
AccordionTrigger,
|
|
7961
7961
|
AccordionContent,
|
|
7962
|
-
} from "
|
|
7962
|
+
} from "../accordion";
|
|
7963
7963
|
import type { AmountOption, WalletTopupProps } from "./types";
|
|
7964
7964
|
|
|
7965
7965
|
/**
|
|
@@ -8442,64 +8442,17 @@ async function detectTailwindPrefix(configFile, cwd = process.cwd()) {
|
|
|
8442
8442
|
return "";
|
|
8443
8443
|
}
|
|
8444
8444
|
|
|
8445
|
-
// src/utils/tailwind-fix.ts
|
|
8446
|
-
import fs2 from "fs-extra";
|
|
8447
|
-
import path2 from "path";
|
|
8448
|
-
import chalk from "chalk";
|
|
8449
|
-
var CUSTOM_COMPONENTS_PATH = "./src/components/custom/**/*.{js,ts,jsx,tsx}";
|
|
8450
|
-
async function ensureCustomComponentsInTailwindConfig(cwd) {
|
|
8451
|
-
const tailwindConfigOptions = [
|
|
8452
|
-
"tailwind.config.js",
|
|
8453
|
-
"tailwind.config.ts",
|
|
8454
|
-
"tailwind.config.mjs",
|
|
8455
|
-
"tailwind.config.cjs"
|
|
8456
|
-
];
|
|
8457
|
-
let tailwindConfigPath = null;
|
|
8458
|
-
for (const configFile of tailwindConfigOptions) {
|
|
8459
|
-
const fullPath = path2.join(cwd, configFile);
|
|
8460
|
-
if (await fs2.pathExists(fullPath)) {
|
|
8461
|
-
tailwindConfigPath = fullPath;
|
|
8462
|
-
break;
|
|
8463
|
-
}
|
|
8464
|
-
}
|
|
8465
|
-
if (!tailwindConfigPath) {
|
|
8466
|
-
return false;
|
|
8467
|
-
}
|
|
8468
|
-
const tailwindConfig = await fs2.readFile(tailwindConfigPath, "utf-8");
|
|
8469
|
-
if (tailwindConfig.includes("./src/components/custom/")) {
|
|
8470
|
-
return false;
|
|
8471
|
-
}
|
|
8472
|
-
const contentMatch = tailwindConfig.match(/content\s*:\s*\[([^\]]*)\]/s);
|
|
8473
|
-
if (!contentMatch) {
|
|
8474
|
-
return false;
|
|
8475
|
-
}
|
|
8476
|
-
const existingContent = contentMatch[1];
|
|
8477
|
-
const existingPaths = existingContent.split(",").map((p) => p.trim()).filter((p) => p.length > 0);
|
|
8478
|
-
const newPaths = [...existingPaths.map((p) => p.replace(/["']/g, "")), CUSTOM_COMPONENTS_PATH];
|
|
8479
|
-
const newContentArray = newPaths.map((p) => ` "${p}"`).join(",\n");
|
|
8480
|
-
const updatedConfig = tailwindConfig.replace(
|
|
8481
|
-
/content\s*:\s*\[([^\]]*)\]/s,
|
|
8482
|
-
`content: [
|
|
8483
|
-
${newContentArray},
|
|
8484
|
-
]`
|
|
8485
|
-
);
|
|
8486
|
-
await fs2.writeFile(tailwindConfigPath, updatedConfig);
|
|
8487
|
-
console.log(chalk.green(`
|
|
8488
|
-
\u2713 Updated ${path2.basename(tailwindConfigPath)} with custom components path`));
|
|
8489
|
-
return true;
|
|
8490
|
-
}
|
|
8491
|
-
|
|
8492
8445
|
// src/commands/add.ts
|
|
8493
8446
|
async function add(components, options) {
|
|
8494
8447
|
const cwd = process.cwd();
|
|
8495
8448
|
if (!await configExists(cwd)) {
|
|
8496
|
-
console.log(
|
|
8497
|
-
console.log(
|
|
8449
|
+
console.log(chalk.red("\n Error: Project not initialized."));
|
|
8450
|
+
console.log(chalk.yellow(" Run `npx myoperator-ui init` first.\n"));
|
|
8498
8451
|
process.exit(1);
|
|
8499
8452
|
}
|
|
8500
8453
|
const prefix = await getTailwindPrefix(cwd);
|
|
8501
8454
|
if (prefix) {
|
|
8502
|
-
console.log(
|
|
8455
|
+
console.log(chalk.blue(`
|
|
8503
8456
|
\u2139 Applying Tailwind prefix: "${prefix}"
|
|
8504
8457
|
`));
|
|
8505
8458
|
}
|
|
@@ -8507,27 +8460,27 @@ async function add(components, options) {
|
|
|
8507
8460
|
const availableComponents = Object.keys(registry);
|
|
8508
8461
|
if (options.all) {
|
|
8509
8462
|
components = availableComponents;
|
|
8510
|
-
console.log(
|
|
8463
|
+
console.log(chalk.blue(` Adding all ${components.length} components...
|
|
8511
8464
|
`));
|
|
8512
8465
|
}
|
|
8513
8466
|
if (options.category) {
|
|
8514
8467
|
const validCategories = ["core", "form", "data", "overlay", "feedback", "layout", "custom"];
|
|
8515
8468
|
const categoryLower = options.category.toLowerCase();
|
|
8516
8469
|
if (!validCategories.includes(categoryLower)) {
|
|
8517
|
-
console.log(
|
|
8470
|
+
console.log(chalk.red(`
|
|
8518
8471
|
Error: Unknown category: ${options.category}`));
|
|
8519
|
-
console.log(
|
|
8472
|
+
console.log(chalk.yellow(` Available categories: ${validCategories.join(", ")}
|
|
8520
8473
|
`));
|
|
8521
8474
|
process.exit(1);
|
|
8522
8475
|
}
|
|
8523
8476
|
components = availableComponents.filter((name) => registry[name].category === categoryLower);
|
|
8524
8477
|
if (components.length === 0) {
|
|
8525
|
-
console.log(
|
|
8478
|
+
console.log(chalk.yellow(`
|
|
8526
8479
|
No components found in category: ${categoryLower}
|
|
8527
8480
|
`));
|
|
8528
8481
|
process.exit(0);
|
|
8529
8482
|
}
|
|
8530
|
-
console.log(
|
|
8483
|
+
console.log(chalk.blue(` Adding all ${components.length} ${categoryLower} components...
|
|
8531
8484
|
`));
|
|
8532
8485
|
}
|
|
8533
8486
|
if (!components || components.length === 0) {
|
|
@@ -8543,7 +8496,7 @@ async function add(components, options) {
|
|
|
8543
8496
|
min: 1
|
|
8544
8497
|
});
|
|
8545
8498
|
if (!selectedComponents || selectedComponents.length === 0) {
|
|
8546
|
-
console.log(
|
|
8499
|
+
console.log(chalk.yellow("\n No components selected.\n"));
|
|
8547
8500
|
process.exit(0);
|
|
8548
8501
|
}
|
|
8549
8502
|
components = selectedComponents;
|
|
@@ -8563,13 +8516,13 @@ async function add(components, options) {
|
|
|
8563
8516
|
});
|
|
8564
8517
|
const invalidComponents = components.filter((c) => !availableComponents.includes(c));
|
|
8565
8518
|
if (invalidComponents.length > 0) {
|
|
8566
|
-
console.log(
|
|
8519
|
+
console.log(chalk.red(`
|
|
8567
8520
|
Error: Unknown components: ${invalidComponents.join(", ")}`));
|
|
8568
|
-
console.log(
|
|
8521
|
+
console.log(chalk.yellow(` Available: ${availableComponents.join(", ")}
|
|
8569
8522
|
`));
|
|
8570
8523
|
process.exit(1);
|
|
8571
8524
|
}
|
|
8572
|
-
const componentsDir =
|
|
8525
|
+
const componentsDir = path2.join(cwd, options.path);
|
|
8573
8526
|
if (!options.yes) {
|
|
8574
8527
|
const { confirm } = await prompts({
|
|
8575
8528
|
type: "confirm",
|
|
@@ -8578,7 +8531,7 @@ async function add(components, options) {
|
|
|
8578
8531
|
initial: true
|
|
8579
8532
|
});
|
|
8580
8533
|
if (!confirm) {
|
|
8581
|
-
console.log(
|
|
8534
|
+
console.log(chalk.yellow("\n Installation cancelled.\n"));
|
|
8582
8535
|
process.exit(0);
|
|
8583
8536
|
}
|
|
8584
8537
|
}
|
|
@@ -8604,22 +8557,19 @@ async function add(components, options) {
|
|
|
8604
8557
|
}
|
|
8605
8558
|
}
|
|
8606
8559
|
spinner.text = `Installing ${componentName}...`;
|
|
8607
|
-
const
|
|
8608
|
-
const baseDir = isCustomComponent ? path3.join(cwd, "src/components/custom") : componentsDir;
|
|
8609
|
-
const targetDir = component.isMultiFile ? path3.join(baseDir, component.directory) : baseDir;
|
|
8560
|
+
const targetDir = component.isMultiFile ? path2.join(componentsDir, component.directory) : componentsDir;
|
|
8610
8561
|
for (const file of component.files) {
|
|
8611
|
-
const filePath =
|
|
8612
|
-
if (await
|
|
8562
|
+
const filePath = path2.join(targetDir, file.name);
|
|
8563
|
+
if (await fs2.pathExists(filePath)) {
|
|
8613
8564
|
if (!options.overwrite) {
|
|
8614
8565
|
spinner.warn(`${file.name} already exists. Use --overwrite to replace.`);
|
|
8615
8566
|
continue;
|
|
8616
8567
|
}
|
|
8617
8568
|
}
|
|
8618
|
-
await
|
|
8619
|
-
await
|
|
8620
|
-
const basePath = isCustomComponent ? "src/components/custom" : options.path;
|
|
8569
|
+
await fs2.ensureDir(path2.dirname(filePath));
|
|
8570
|
+
await fs2.writeFile(filePath, file.content);
|
|
8621
8571
|
const relativePath = component.isMultiFile ? `${component.directory}/${file.name}` : file.name;
|
|
8622
|
-
installed.push({ path: relativePath, basePath });
|
|
8572
|
+
installed.push({ path: relativePath, basePath: options.path });
|
|
8623
8573
|
}
|
|
8624
8574
|
if (component.dependencies) {
|
|
8625
8575
|
component.dependencies.forEach((dep) => dependencies.add(dep));
|
|
@@ -8631,18 +8581,14 @@ async function add(components, options) {
|
|
|
8631
8581
|
}
|
|
8632
8582
|
spinner.succeed("Components installed successfully!");
|
|
8633
8583
|
if (installed.length > 0) {
|
|
8634
|
-
console.log(
|
|
8584
|
+
console.log(chalk.green("\n Installed files:"));
|
|
8635
8585
|
installed.forEach((file) => {
|
|
8636
|
-
console.log(
|
|
8586
|
+
console.log(chalk.green(` \u2713 ${file.basePath}/${file.path}`));
|
|
8637
8587
|
});
|
|
8638
8588
|
}
|
|
8639
8589
|
if (dependencies.size > 0) {
|
|
8640
|
-
console.log(
|
|
8641
|
-
console.log(
|
|
8642
|
-
}
|
|
8643
|
-
const hasCustomComponents = installed.some((file) => file.basePath.includes("custom"));
|
|
8644
|
-
if (hasCustomComponents) {
|
|
8645
|
-
await ensureCustomComponentsInTailwindConfig(cwd);
|
|
8590
|
+
console.log(chalk.yellow("\n Required dependencies:"));
|
|
8591
|
+
console.log(chalk.cyan(` npm install ${Array.from(dependencies).join(" ")}`));
|
|
8646
8592
|
}
|
|
8647
8593
|
console.log("");
|
|
8648
8594
|
} catch (error) {
|
|
@@ -8657,6 +8603,55 @@ import chalk3 from "chalk";
|
|
|
8657
8603
|
import fs4 from "fs-extra";
|
|
8658
8604
|
import path4 from "path";
|
|
8659
8605
|
import ora2 from "ora";
|
|
8606
|
+
|
|
8607
|
+
// src/utils/tailwind-fix.ts
|
|
8608
|
+
import fs3 from "fs-extra";
|
|
8609
|
+
import path3 from "path";
|
|
8610
|
+
import chalk2 from "chalk";
|
|
8611
|
+
var CUSTOM_COMPONENTS_PATH = "./src/components/custom/**/*.{js,ts,jsx,tsx}";
|
|
8612
|
+
async function ensureCustomComponentsInTailwindConfig(cwd) {
|
|
8613
|
+
const tailwindConfigOptions = [
|
|
8614
|
+
"tailwind.config.js",
|
|
8615
|
+
"tailwind.config.ts",
|
|
8616
|
+
"tailwind.config.mjs",
|
|
8617
|
+
"tailwind.config.cjs"
|
|
8618
|
+
];
|
|
8619
|
+
let tailwindConfigPath = null;
|
|
8620
|
+
for (const configFile of tailwindConfigOptions) {
|
|
8621
|
+
const fullPath = path3.join(cwd, configFile);
|
|
8622
|
+
if (await fs3.pathExists(fullPath)) {
|
|
8623
|
+
tailwindConfigPath = fullPath;
|
|
8624
|
+
break;
|
|
8625
|
+
}
|
|
8626
|
+
}
|
|
8627
|
+
if (!tailwindConfigPath) {
|
|
8628
|
+
return false;
|
|
8629
|
+
}
|
|
8630
|
+
const tailwindConfig = await fs3.readFile(tailwindConfigPath, "utf-8");
|
|
8631
|
+
if (tailwindConfig.includes("./src/components/custom/")) {
|
|
8632
|
+
return false;
|
|
8633
|
+
}
|
|
8634
|
+
const contentMatch = tailwindConfig.match(/content\s*:\s*\[([^\]]*)\]/s);
|
|
8635
|
+
if (!contentMatch) {
|
|
8636
|
+
return false;
|
|
8637
|
+
}
|
|
8638
|
+
const existingContent = contentMatch[1];
|
|
8639
|
+
const existingPaths = existingContent.split(",").map((p) => p.trim()).filter((p) => p.length > 0);
|
|
8640
|
+
const newPaths = [...existingPaths.map((p) => p.replace(/["']/g, "")), CUSTOM_COMPONENTS_PATH];
|
|
8641
|
+
const newContentArray = newPaths.map((p) => ` "${p}"`).join(",\n");
|
|
8642
|
+
const updatedConfig = tailwindConfig.replace(
|
|
8643
|
+
/content\s*:\s*\[([^\]]*)\]/s,
|
|
8644
|
+
`content: [
|
|
8645
|
+
${newContentArray},
|
|
8646
|
+
]`
|
|
8647
|
+
);
|
|
8648
|
+
await fs3.writeFile(tailwindConfigPath, updatedConfig);
|
|
8649
|
+
console.log(chalk2.green(`
|
|
8650
|
+
\u2713 Updated ${path3.basename(tailwindConfigPath)} with custom components path`));
|
|
8651
|
+
return true;
|
|
8652
|
+
}
|
|
8653
|
+
|
|
8654
|
+
// src/commands/fix.ts
|
|
8660
8655
|
async function fix() {
|
|
8661
8656
|
const cwd = process.cwd();
|
|
8662
8657
|
console.log(chalk3.bold("\n myOperator UI - Fix Configuration\n"));
|