nexoreui-cli 1.7.0 → 1.7.2
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 +174 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4586,23 +4586,27 @@ var THEME_PALETTES = {
|
|
|
4586
4586
|
};
|
|
4587
4587
|
function ensurePathAlias(baseDir, projectType, hasSrcDir) {
|
|
4588
4588
|
let updated = false;
|
|
4589
|
-
const
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
parsed.compilerOptions.paths
|
|
4602
|
-
|
|
4603
|
-
|
|
4589
|
+
const configsToCheck = [
|
|
4590
|
+
path4.join(baseDir, "tsconfig.app.json"),
|
|
4591
|
+
path4.join(baseDir, "tsconfig.json"),
|
|
4592
|
+
path4.join(baseDir, "jsconfig.json")
|
|
4593
|
+
];
|
|
4594
|
+
for (const targetConfig of configsToCheck) {
|
|
4595
|
+
if (fs4.existsSync(targetConfig)) {
|
|
4596
|
+
try {
|
|
4597
|
+
const content = fs4.readFileSync(targetConfig, "utf8");
|
|
4598
|
+
const parsed = JSON.parse(content);
|
|
4599
|
+
parsed.compilerOptions = parsed.compilerOptions || {};
|
|
4600
|
+
parsed.compilerOptions.baseUrl = parsed.compilerOptions.baseUrl || ".";
|
|
4601
|
+
parsed.compilerOptions.paths = parsed.compilerOptions.paths || {};
|
|
4602
|
+
const aliasTarget = hasSrcDir ? ["./src/*"] : ["./*"];
|
|
4603
|
+
if (!parsed.compilerOptions.paths["@/*"]) {
|
|
4604
|
+
parsed.compilerOptions.paths["@/*"] = aliasTarget;
|
|
4605
|
+
fs4.writeFileSync(targetConfig, JSON.stringify(parsed, null, 2), "utf8");
|
|
4606
|
+
updated = true;
|
|
4607
|
+
}
|
|
4608
|
+
} catch {
|
|
4604
4609
|
}
|
|
4605
|
-
} catch {
|
|
4606
4610
|
}
|
|
4607
4611
|
}
|
|
4608
4612
|
if (projectType === "vite") {
|
|
@@ -4634,6 +4638,15 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
|
4634
4638
|
updated = true;
|
|
4635
4639
|
}
|
|
4636
4640
|
}
|
|
4641
|
+
if (!viteContent.includes("@tailwindcss/vite")) {
|
|
4642
|
+
let updatedVite = `import tailwindcss from '@tailwindcss/vite'
|
|
4643
|
+
` + viteContent;
|
|
4644
|
+
if (updatedVite.includes("plugins: [")) {
|
|
4645
|
+
updatedVite = updatedVite.replace(/plugins:\s*\[/, "plugins: [tailwindcss(), ");
|
|
4646
|
+
fs4.writeFileSync(vitePath, updatedVite, "utf8");
|
|
4647
|
+
updated = true;
|
|
4648
|
+
}
|
|
4649
|
+
}
|
|
4637
4650
|
break;
|
|
4638
4651
|
}
|
|
4639
4652
|
}
|
|
@@ -4652,13 +4665,25 @@ function injectThemeCss(baseDir, cssRelativePath, themeName, radiusValue) {
|
|
|
4652
4665
|
--color-foreground: var(--foreground);
|
|
4653
4666
|
--color-card: var(--card);
|
|
4654
4667
|
--color-card-foreground: var(--card-foreground);
|
|
4668
|
+
--color-popover: var(--popover);
|
|
4669
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
4655
4670
|
--color-primary: var(--primary);
|
|
4656
4671
|
--color-primary-foreground: var(--primary-foreground);
|
|
4672
|
+
--color-secondary: var(--secondary);
|
|
4673
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
4674
|
+
--color-muted: var(--muted);
|
|
4675
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
4676
|
+
--color-accent: var(--accent);
|
|
4677
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
4678
|
+
--color-destructive: var(--destructive);
|
|
4679
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
4657
4680
|
--color-border: var(--border);
|
|
4681
|
+
--color-input: var(--input);
|
|
4682
|
+
--color-ring: var(--ring);
|
|
4658
4683
|
--radius-lg: var(--radius);
|
|
4659
4684
|
--radius-md: calc(var(--radius) - 2px);
|
|
4660
4685
|
--radius-sm: calc(var(--radius) - 4px);
|
|
4661
|
-
--font-sans: system-ui, -apple-system, sans-serif;
|
|
4686
|
+
--font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
4662
4687
|
}
|
|
4663
4688
|
|
|
4664
4689
|
:root {
|
|
@@ -4666,10 +4691,25 @@ function injectThemeCss(baseDir, cssRelativePath, themeName, radiusValue) {
|
|
|
4666
4691
|
--foreground: hsl(240 10% 3.9%);
|
|
4667
4692
|
--card: hsl(0 0% 100%);
|
|
4668
4693
|
--card-foreground: hsl(240 10% 3.9%);
|
|
4694
|
+
--popover: hsl(0 0% 100%);
|
|
4695
|
+
--popover-foreground: hsl(240 10% 3.9%);
|
|
4669
4696
|
--primary: ${palette.light};
|
|
4670
4697
|
--primary-foreground: hsl(0 0% 100%);
|
|
4698
|
+
--secondary: hsl(240 4.8% 95.9%);
|
|
4699
|
+
--secondary-foreground: hsl(240 5.9% 10%);
|
|
4700
|
+
--muted: hsl(240 4.8% 95.9%);
|
|
4701
|
+
--muted-foreground: hsl(240 3.8% 46.1%);
|
|
4702
|
+
--accent: hsl(240 4.8% 95.9%);
|
|
4703
|
+
--accent-foreground: hsl(240 5.9% 10%);
|
|
4704
|
+
--destructive: hsl(0 84.2% 60.2%);
|
|
4705
|
+
--destructive-foreground: hsl(0 0% 98%);
|
|
4671
4706
|
--border: hsl(240 5.9% 90%);
|
|
4707
|
+
--input: hsl(240 5.9% 90%);
|
|
4708
|
+
--ring: ${palette.light};
|
|
4672
4709
|
--radius: ${radius}rem;
|
|
4710
|
+
--glow-radius: 12px;
|
|
4711
|
+
--glow-strength: 0.15;
|
|
4712
|
+
--glow-color: ${palette.rgb};
|
|
4673
4713
|
}
|
|
4674
4714
|
|
|
4675
4715
|
.dark {
|
|
@@ -4677,16 +4717,36 @@ function injectThemeCss(baseDir, cssRelativePath, themeName, radiusValue) {
|
|
|
4677
4717
|
--foreground: hsl(0 0% 98%);
|
|
4678
4718
|
--card: hsl(240 10% 3.9%);
|
|
4679
4719
|
--card-foreground: hsl(0 0% 98%);
|
|
4720
|
+
--popover: hsl(240 10% 3.9%);
|
|
4721
|
+
--popover-foreground: hsl(0 0% 98%);
|
|
4680
4722
|
--primary: ${palette.dark};
|
|
4681
4723
|
--primary-foreground: hsl(0 0% 100%);
|
|
4724
|
+
--secondary: hsl(240 3.7% 15.9%);
|
|
4725
|
+
--secondary-foreground: hsl(0 0% 98%);
|
|
4726
|
+
--muted: hsl(240 3.7% 15.9%);
|
|
4727
|
+
--muted-foreground: hsl(240 5% 64.9%);
|
|
4728
|
+
--accent: hsl(240 3.7% 15.9%);
|
|
4729
|
+
--accent-foreground: hsl(0 0% 98%);
|
|
4730
|
+
--destructive: hsl(0 62.8% 30.6%);
|
|
4731
|
+
--destructive-foreground: hsl(0 0% 98%);
|
|
4682
4732
|
--border: hsl(240 3.7% 15.9%);
|
|
4733
|
+
--input: hsl(240 3.7% 15.9%);
|
|
4734
|
+
--ring: ${palette.dark};
|
|
4683
4735
|
--radius: ${radius}rem;
|
|
4736
|
+
--glow-radius: 20px;
|
|
4737
|
+
--glow-strength: 0.35;
|
|
4738
|
+
--glow-color: ${palette.rgb};
|
|
4684
4739
|
}
|
|
4685
4740
|
`;
|
|
4686
4741
|
if (fs4.existsSync(cssAbsolutePath)) {
|
|
4687
|
-
|
|
4742
|
+
let existingContent = fs4.readFileSync(cssAbsolutePath, "utf8");
|
|
4743
|
+
existingContent = existingContent.replace(/#root\s*\{[^}]*\}/g, "");
|
|
4688
4744
|
if (!existingContent.includes("--color-primary") && !existingContent.includes("nexoreui/dist")) {
|
|
4689
|
-
|
|
4745
|
+
let finalContent = existingContent.trim() + "\n" + themeBlock;
|
|
4746
|
+
if (!finalContent.includes('@import "tailwindcss"') && !finalContent.includes("@import 'tailwindcss'")) {
|
|
4747
|
+
finalContent = '@import "tailwindcss";\n' + finalContent;
|
|
4748
|
+
}
|
|
4749
|
+
fs4.writeFileSync(cssAbsolutePath, finalContent, "utf8");
|
|
4690
4750
|
return true;
|
|
4691
4751
|
}
|
|
4692
4752
|
} else {
|
|
@@ -4829,7 +4889,7 @@ async function createCommand(projectName, options = {}) {
|
|
|
4829
4889
|
console.error(`\x1B[31mError: Target directory ${name} already exists and is not empty.\x1B[0m`);
|
|
4830
4890
|
return;
|
|
4831
4891
|
}
|
|
4832
|
-
console.log(`\x1B[33m\u26A1 Scaffolding React + Vite
|
|
4892
|
+
console.log(`\x1B[33m\u26A1 Step 1/4: Scaffolding React + Vite template...\x1B[0m`);
|
|
4833
4893
|
try {
|
|
4834
4894
|
(0, import_child_process3.execSync)(`npm create vite@latest ${name} -- --template react-ts`, { stdio: "inherit" });
|
|
4835
4895
|
} catch (err) {
|
|
@@ -4838,23 +4898,112 @@ async function createCommand(projectName, options = {}) {
|
|
|
4838
4898
|
}
|
|
4839
4899
|
process.chdir(targetDir);
|
|
4840
4900
|
console.log(`
|
|
4841
|
-
\x1B[33m\u{1F4E6} Installing NexoreUI, Tailwind CSS, and core packages...\x1B[0m`);
|
|
4901
|
+
\x1B[33m\u{1F4E6} Step 2/4: Installing NexoreUI, Tailwind CSS, and core packages...\x1B[0m`);
|
|
4842
4902
|
(0, import_child_process3.execSync)(`npm install nexoreui lucide-react clsx tailwind-merge framer-motion @tailwindcss/vite tailwindcss`, {
|
|
4843
4903
|
stdio: "inherit"
|
|
4844
4904
|
});
|
|
4905
|
+
console.log(`
|
|
4906
|
+
\x1B[33m\u2699\uFE0F Step 3/4: Configuring theme and design tokens...\x1B[0m`);
|
|
4845
4907
|
await initCommand({
|
|
4846
4908
|
yes: true,
|
|
4847
|
-
theme: options.theme || "
|
|
4848
|
-
radius: options.radius || "
|
|
4909
|
+
theme: options.theme || "emerald",
|
|
4910
|
+
radius: options.radius || "0.75"
|
|
4849
4911
|
});
|
|
4850
4912
|
console.log(`
|
|
4851
|
-
\x1B[
|
|
4913
|
+
\x1B[33m\u{1F9E9} Step 4/4: Adding starter UI components (button, card)...\x1B[0m`);
|
|
4914
|
+
try {
|
|
4915
|
+
await addCommand(["button", "card"], { yes: true });
|
|
4916
|
+
} catch {
|
|
4917
|
+
}
|
|
4918
|
+
const appTsxPath = path6.join(targetDir, "src", "App.tsx");
|
|
4919
|
+
const starterAppCode = `import { useState } from 'react';
|
|
4920
|
+
import { Button } from '@/components/ui/button';
|
|
4921
|
+
import { Card, CardHeader, CardTitle, CardDescription, CardContent } from '@/components/ui/card';
|
|
4922
|
+
import { Sparkles, Terminal, Layers } from 'lucide-react';
|
|
4923
|
+
|
|
4924
|
+
export default function App() {
|
|
4925
|
+
const [count, setCount] = useState(0);
|
|
4926
|
+
|
|
4927
|
+
return (
|
|
4928
|
+
<main className="min-h-screen bg-background text-foreground flex flex-col items-center justify-center p-6 transition-colors selection:bg-primary/20">
|
|
4929
|
+
<div className="max-w-xl w-full space-y-8 text-center">
|
|
4930
|
+
{/* Status Badge */}
|
|
4931
|
+
<div className="inline-flex items-center gap-2 px-3.5 py-1.5 rounded-full bg-primary/10 border border-primary/20 text-xs font-semibold text-primary shadow-xs">
|
|
4932
|
+
<Sparkles className="h-3.5 w-3.5" />
|
|
4933
|
+
<span>NexoreUI + Tailwind CSS v4</span>
|
|
4934
|
+
</div>
|
|
4935
|
+
|
|
4936
|
+
{/* Hero Title */}
|
|
4937
|
+
<div className="space-y-3">
|
|
4938
|
+
<h1 className="text-4xl sm:text-5xl font-extrabold tracking-tight">
|
|
4939
|
+
Welcome to <span className="text-primary">NexoreUI</span>
|
|
4940
|
+
</h1>
|
|
4941
|
+
<p className="text-muted-foreground text-sm sm:text-base max-w-md mx-auto">
|
|
4942
|
+
Your project is fully configured with design tokens, glow effects, and modern animated components.
|
|
4943
|
+
</p>
|
|
4944
|
+
</div>
|
|
4945
|
+
|
|
4946
|
+
{/* Demo Interactive Card */}
|
|
4947
|
+
<Card className="max-w-md mx-auto text-left shadow-xl border-border/80">
|
|
4948
|
+
<CardHeader>
|
|
4949
|
+
<CardTitle className="text-base flex items-center gap-2">
|
|
4950
|
+
<Layers className="h-4 w-4 text-primary" />
|
|
4951
|
+
Interactive Component Demo
|
|
4952
|
+
</CardTitle>
|
|
4953
|
+
<CardDescription className="text-xs">
|
|
4954
|
+
Click the button to test component state and styling.
|
|
4955
|
+
</CardDescription>
|
|
4956
|
+
</CardHeader>
|
|
4957
|
+
<CardContent className="space-y-4">
|
|
4958
|
+
<div className="flex items-center justify-between p-3 rounded-xl bg-muted/50 border border-border/60">
|
|
4959
|
+
<span className="text-xs font-medium">Click Counter</span>
|
|
4960
|
+
<span className="text-xs font-mono font-bold px-2.5 py-0.5 rounded-md bg-primary/15 text-primary">
|
|
4961
|
+
{count} clicks
|
|
4962
|
+
</span>
|
|
4963
|
+
</div>
|
|
4964
|
+
<div className="flex items-center gap-3">
|
|
4965
|
+
<Button onClick={() => setCount((c) => c + 1)} className="flex-1">
|
|
4966
|
+
Increment Count
|
|
4967
|
+
</Button>
|
|
4968
|
+
<Button variant="outline" onClick={() => setCount(0)}>
|
|
4969
|
+
Reset
|
|
4970
|
+
</Button>
|
|
4971
|
+
</div>
|
|
4972
|
+
</CardContent>
|
|
4973
|
+
</Card>
|
|
4974
|
+
|
|
4975
|
+
{/* CLI Hint */}
|
|
4976
|
+
<div className="p-3.5 rounded-xl bg-muted/40 border border-border text-xs text-muted-foreground font-mono inline-flex items-center gap-2">
|
|
4977
|
+
<Terminal className="h-4 w-4 text-primary shrink-0" />
|
|
4978
|
+
<span>npx nexoreui add --all</span>
|
|
4979
|
+
</div>
|
|
4980
|
+
</div>
|
|
4981
|
+
</main>
|
|
4982
|
+
);
|
|
4983
|
+
}
|
|
4984
|
+
`;
|
|
4985
|
+
try {
|
|
4986
|
+
fs6.writeFileSync(appTsxPath, starterAppCode, "utf8");
|
|
4987
|
+
} catch {
|
|
4988
|
+
}
|
|
4989
|
+
const appCssPath = path6.join(targetDir, "src", "App.css");
|
|
4990
|
+
if (fs6.existsSync(appCssPath)) {
|
|
4991
|
+
try {
|
|
4992
|
+
fs6.writeFileSync(appCssPath, "/* NexoreUI styles are loaded from src/index.css */\n", "utf8");
|
|
4993
|
+
} catch {
|
|
4994
|
+
}
|
|
4995
|
+
}
|
|
4996
|
+
console.log(`
|
|
4997
|
+
\x1B[32m\x1B[1m\u2728 Project ${name} is ready with NexoreUI!\x1B[0m`);
|
|
4852
4998
|
console.log(`
|
|
4853
4999
|
To get started:
|
|
4854
5000
|
`);
|
|
4855
5001
|
console.log(` \x1B[36mcd ${name}\x1B[0m`);
|
|
4856
|
-
console.log(` \x1B[36mnpx nexoreui add button card modal table --all\x1B[0m`);
|
|
4857
5002
|
console.log(` \x1B[36mnpm run dev\x1B[0m
|
|
5003
|
+
`);
|
|
5004
|
+
console.log(`To add more components to your project:
|
|
5005
|
+
`);
|
|
5006
|
+
console.log(` \x1B[36mnpx nexoreui add modal table tabs --all\x1B[0m
|
|
4858
5007
|
`);
|
|
4859
5008
|
}
|
|
4860
5009
|
|