nexoreui-cli 1.7.1 → 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 +122 -24
- 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") {
|
|
@@ -4735,9 +4739,14 @@ function injectThemeCss(baseDir, cssRelativePath, themeName, radiusValue) {
|
|
|
4735
4739
|
}
|
|
4736
4740
|
`;
|
|
4737
4741
|
if (fs4.existsSync(cssAbsolutePath)) {
|
|
4738
|
-
|
|
4742
|
+
let existingContent = fs4.readFileSync(cssAbsolutePath, "utf8");
|
|
4743
|
+
existingContent = existingContent.replace(/#root\s*\{[^}]*\}/g, "");
|
|
4739
4744
|
if (!existingContent.includes("--color-primary") && !existingContent.includes("nexoreui/dist")) {
|
|
4740
|
-
|
|
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");
|
|
4741
4750
|
return true;
|
|
4742
4751
|
}
|
|
4743
4752
|
} else {
|
|
@@ -4880,7 +4889,7 @@ async function createCommand(projectName, options = {}) {
|
|
|
4880
4889
|
console.error(`\x1B[31mError: Target directory ${name} already exists and is not empty.\x1B[0m`);
|
|
4881
4890
|
return;
|
|
4882
4891
|
}
|
|
4883
|
-
console.log(`\x1B[33m\u26A1 Scaffolding React + Vite
|
|
4892
|
+
console.log(`\x1B[33m\u26A1 Step 1/4: Scaffolding React + Vite template...\x1B[0m`);
|
|
4884
4893
|
try {
|
|
4885
4894
|
(0, import_child_process3.execSync)(`npm create vite@latest ${name} -- --template react-ts`, { stdio: "inherit" });
|
|
4886
4895
|
} catch (err) {
|
|
@@ -4889,23 +4898,112 @@ async function createCommand(projectName, options = {}) {
|
|
|
4889
4898
|
}
|
|
4890
4899
|
process.chdir(targetDir);
|
|
4891
4900
|
console.log(`
|
|
4892
|
-
\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`);
|
|
4893
4902
|
(0, import_child_process3.execSync)(`npm install nexoreui lucide-react clsx tailwind-merge framer-motion @tailwindcss/vite tailwindcss`, {
|
|
4894
4903
|
stdio: "inherit"
|
|
4895
4904
|
});
|
|
4905
|
+
console.log(`
|
|
4906
|
+
\x1B[33m\u2699\uFE0F Step 3/4: Configuring theme and design tokens...\x1B[0m`);
|
|
4896
4907
|
await initCommand({
|
|
4897
4908
|
yes: true,
|
|
4898
|
-
theme: options.theme || "
|
|
4899
|
-
radius: options.radius || "
|
|
4909
|
+
theme: options.theme || "emerald",
|
|
4910
|
+
radius: options.radius || "0.75"
|
|
4900
4911
|
});
|
|
4901
4912
|
console.log(`
|
|
4902
|
-
\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`);
|
|
4903
4998
|
console.log(`
|
|
4904
4999
|
To get started:
|
|
4905
5000
|
`);
|
|
4906
5001
|
console.log(` \x1B[36mcd ${name}\x1B[0m`);
|
|
4907
|
-
console.log(` \x1B[36mnpx nexoreui add button card modal table --all\x1B[0m`);
|
|
4908
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
|
|
4909
5007
|
`);
|
|
4910
5008
|
}
|
|
4911
5009
|
|