@nikala-ui/cli 0.8.0 → 0.9.1
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/commands/add.d.ts +1 -0
- package/dist/commands/add.js +10 -4
- package/dist/commands/init.js +1 -1
- package/dist/index.js +5 -4
- package/dist/types/registry.d.ts +2 -2
- package/package.json +1 -1
package/dist/commands/add.d.ts
CHANGED
package/dist/commands/add.js
CHANGED
|
@@ -21,17 +21,20 @@ export async function add(components = [], options = {}) {
|
|
|
21
21
|
console.log(pc.red("❌ Failed to load registry index. Ensure network connection or build registry."));
|
|
22
22
|
process.exit(1);
|
|
23
23
|
}
|
|
24
|
+
const isHookMode = Boolean(options.hook);
|
|
25
|
+
const filteredRegistry = registryIndex.filter((item) => isHookMode ? item.type === "registry:hook" : item.type !== "registry:hook");
|
|
24
26
|
const isAllRequested = options.all || components.includes("all");
|
|
25
27
|
let requestedComponents = components.filter((c) => c !== "all");
|
|
26
28
|
if (isAllRequested) {
|
|
27
|
-
requestedComponents =
|
|
29
|
+
requestedComponents = filteredRegistry.map((item) => item.name);
|
|
28
30
|
}
|
|
29
31
|
else if (requestedComponents.length === 0) {
|
|
32
|
+
const itemLabel = isHookMode ? "hooks" : "components";
|
|
30
33
|
const response = await prompts({
|
|
31
34
|
type: "autocompleteMultiselect",
|
|
32
35
|
name: "selectedComponents",
|
|
33
|
-
message:
|
|
34
|
-
choices:
|
|
36
|
+
message: `Select ${itemLabel} to install (Space to toggle, Enter to confirm)`,
|
|
37
|
+
choices: filteredRegistry.map((item) => ({
|
|
35
38
|
title: item.title,
|
|
36
39
|
description: item.description,
|
|
37
40
|
value: item.name,
|
|
@@ -39,7 +42,7 @@ export async function add(components = [], options = {}) {
|
|
|
39
42
|
hint: "- Space to select. Return to submit",
|
|
40
43
|
});
|
|
41
44
|
if (!response.selectedComponents || response.selectedComponents.length === 0) {
|
|
42
|
-
console.log(pc.yellow(
|
|
45
|
+
console.log(pc.yellow(`\n❌ Installation cancelled. No ${itemLabel} selected.`));
|
|
43
46
|
return;
|
|
44
47
|
}
|
|
45
48
|
requestedComponents = response.selectedComponents;
|
|
@@ -48,6 +51,9 @@ export async function add(components = [], options = {}) {
|
|
|
48
51
|
const componentsDir = path.resolve(cwd, config.alias.components);
|
|
49
52
|
console.log(pc.cyan(`\n🎨 Adding components to project...\n`));
|
|
50
53
|
const requiredNpmDeps = new Set();
|
|
54
|
+
if (isHookMode) {
|
|
55
|
+
requiredNpmDeps.add("@nikala-ui/hooks");
|
|
56
|
+
}
|
|
51
57
|
for (const target of resolvedTargets) {
|
|
52
58
|
const item = await getRegistryItem(target);
|
|
53
59
|
if (!item) {
|
package/dist/commands/init.js
CHANGED
|
@@ -72,7 +72,7 @@ export async function init(options) {
|
|
|
72
72
|
await fs.ensureDir(utilsPath);
|
|
73
73
|
// 1. Install required packages
|
|
74
74
|
const userPkgPath = path.join(cwd, "package.json");
|
|
75
|
-
const requiredDeps = ["clsx", "tailwind-merge", "class-variance-authority"];
|
|
75
|
+
const requiredDeps = ["clsx", "tailwind-merge", "class-variance-authority", "@nikala-ui/hooks"];
|
|
76
76
|
if (await fs.pathExists(userPkgPath)) {
|
|
77
77
|
try {
|
|
78
78
|
const userPkg = await fs.readJson(userPkgPath);
|
package/dist/index.js
CHANGED
|
@@ -6,14 +6,14 @@ import { add } from "./commands/add.js";
|
|
|
6
6
|
import { themeCommand } from "./commands/theme.js";
|
|
7
7
|
import { validateCommand } from "./commands/validate.js";
|
|
8
8
|
import { diffCommand } from "./commands/diff.js";
|
|
9
|
-
console.log(`\n🎨 ${pc.bold(pc.red("Nikala UI"))} ${pc.dim("v0.
|
|
9
|
+
console.log(`\n🎨 ${pc.bold(pc.red("Nikala UI"))} ${pc.dim("v0.9.1")} — SolidJS + Tailwind v4 components`);
|
|
10
10
|
console.log(` ${pc.italic(pc.dim("Honoring Niko Pirosmani (Nikala)"))}\n`);
|
|
11
11
|
console.log(` ${pc.dim("Docs:")} ${pc.underline(pc.cyan("https://nikala.magradze.dev"))}\n`);
|
|
12
12
|
const program = new Command();
|
|
13
13
|
program
|
|
14
14
|
.name("nikala")
|
|
15
15
|
.description("Nikala UI — SolidJS + Tailwind v4 components")
|
|
16
|
-
.version("0.
|
|
16
|
+
.version("0.9.1");
|
|
17
17
|
program
|
|
18
18
|
.command("init")
|
|
19
19
|
.description("Initialize Nikala UI in your project")
|
|
@@ -21,9 +21,10 @@ program
|
|
|
21
21
|
.action(init);
|
|
22
22
|
program
|
|
23
23
|
.command("add [components...]")
|
|
24
|
-
.description("Add components to your project")
|
|
24
|
+
.description("Add components or reactive hooks to your project")
|
|
25
25
|
.option("-o, --overwrite", "Overwrite existing files")
|
|
26
|
-
.option("--all", "Add all available
|
|
26
|
+
.option("--all", "Add all available items")
|
|
27
|
+
.option("-h, --hook", "Add reactive hook primitive(s) instead of UI components")
|
|
27
28
|
.action(add);
|
|
28
29
|
// Parent theme command
|
|
29
30
|
const themeProg = program
|
package/dist/types/registry.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface RegistryItem {
|
|
|
7
7
|
name: string;
|
|
8
8
|
title: string;
|
|
9
9
|
description: string;
|
|
10
|
-
type: "registry:ui";
|
|
10
|
+
type: "registry:ui" | "registry:util" | "registry:hook";
|
|
11
11
|
dependencies?: string[];
|
|
12
12
|
registryDependencies?: string[];
|
|
13
13
|
files: RegistryFile[];
|
|
@@ -16,7 +16,7 @@ export interface RegistryIndexItem {
|
|
|
16
16
|
name: string;
|
|
17
17
|
title: string;
|
|
18
18
|
description: string;
|
|
19
|
-
type: "registry:ui";
|
|
19
|
+
type: "registry:ui" | "registry:util" | "registry:hook";
|
|
20
20
|
dependencies?: string[];
|
|
21
21
|
registryDependencies?: string[];
|
|
22
22
|
}
|