@nikala-ui/cli 0.9.0 → 0.9.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.
@@ -1,6 +1,7 @@
1
1
  interface AddOptions {
2
2
  overwrite?: boolean;
3
3
  all?: boolean;
4
+ hook?: boolean;
4
5
  }
5
6
  /**
6
7
  * Command handler to fetch and install Nikala UI components from GitHub remote registry or custom URLs.
@@ -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 = registryIndex.map((item) => item.name);
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: "Select components to install (Space to toggle, Enter to confirm)",
34
- choices: registryIndex.map((item) => ({
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("\n❌ Installation cancelled. No components selected."));
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) {
@@ -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.0")} — SolidJS + Tailwind v4 components`);
9
+ console.log(`\n🎨 ${pc.bold(pc.red("Nikala UI"))} ${pc.dim("v0.9.2")} — 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.9.0");
16
+ .version("0.9.2");
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 components")
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
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nikala-ui/cli",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "Command line interface for Nikala UI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",