zerozeeker 2.0.0 → 2.1.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.
Files changed (2) hide show
  1. package/dist/index.js +55 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -52,8 +52,47 @@ function installDependencies(deps) {
52
52
  console.warn(chalk.yellow(` Warning: Failed to auto-install dependencies. Install manually: npm install ${deps.join(" ")}`));
53
53
  }
54
54
  }
55
+ async function installRegistryDependencies(deps, projectRoot, installed = /* @__PURE__ */ new Set()) {
56
+ const allFiles = [];
57
+ const allNpmDeps = [];
58
+ for (const dep of deps) {
59
+ if (installed.has(dep)) continue;
60
+ installed.add(dep);
61
+ const url = `${REGISTRY_URL}/${dep}.json`;
62
+ try {
63
+ const registry = await fetchRegistry(url);
64
+ if (registry.registryDependencies && registry.registryDependencies.length > 0) {
65
+ const nested = await installRegistryDependencies(
66
+ registry.registryDependencies,
67
+ projectRoot,
68
+ installed
69
+ );
70
+ allFiles.push(...nested.files);
71
+ allNpmDeps.push(...nested.npmDeps);
72
+ }
73
+ if (registry.files && registry.files.length > 0) {
74
+ for (const file of registry.files) {
75
+ const targetPath = file.target || file.path;
76
+ const fullPath = join(projectRoot, targetPath);
77
+ if (existsSync(fullPath)) {
78
+ continue;
79
+ }
80
+ ensureDir(fullPath);
81
+ writeFileSync(fullPath, file.content, "utf-8");
82
+ allFiles.push(targetPath);
83
+ }
84
+ }
85
+ if (registry.dependencies) {
86
+ allNpmDeps.push(...registry.dependencies);
87
+ }
88
+ } catch (error) {
89
+ console.warn(chalk.yellow(` Warning: Could not install registry dependency "${dep}"`));
90
+ }
91
+ }
92
+ return { files: allFiles, npmDeps: allNpmDeps };
93
+ }
55
94
  var program = new Command();
56
- program.name("zerozeeker").description("CLI for installing ZeroZeeker UI components - because life is too short for boring interfaces").version("2.0.0");
95
+ program.name("zerozeeker").description("CLI for installing ZeroZeeker UI components - because life is too short for boring interfaces").version("2.1.0");
57
96
  program.command("add <component>").description("Add a component from ZeroZeeker registry").action(async (component) => {
58
97
  if (!COMPONENTS.includes(component)) {
59
98
  console.error(chalk.red(`Component "${component}" does not exist in this dimension.`));
@@ -71,7 +110,16 @@ program.command("add <component>").description("Add a component from ZeroZeeker
71
110
  spinner.text = `Fetching ${chalk.cyan(component)} from registry...`;
72
111
  const registry = await fetchRegistry(url);
73
112
  const filesInstalled = [];
74
- const dependencies = registry.dependencies || [];
113
+ const allDependencies = [...registry.dependencies || []];
114
+ if (registry.registryDependencies && registry.registryDependencies.length > 0) {
115
+ spinner.text = `Installing registry dependencies...`;
116
+ const registryResult = await installRegistryDependencies(
117
+ registry.registryDependencies,
118
+ projectRoot
119
+ );
120
+ filesInstalled.push(...registryResult.files);
121
+ allDependencies.push(...registryResult.npmDeps);
122
+ }
75
123
  if (registry.files && registry.files.length > 0) {
76
124
  spinner.text = `Installing ${chalk.cyan(component)} files...`;
77
125
  for (const file of registry.files) {
@@ -91,9 +139,10 @@ program.command("add <component>").description("Add a component from ZeroZeeker
91
139
  filesInstalled.push(targetPath);
92
140
  }
93
141
  }
94
- if (dependencies.length > 0) {
142
+ const uniqueDeps = [...new Set(allDependencies)];
143
+ if (uniqueDeps.length > 0) {
95
144
  spinner.text = "Installing npm dependencies...";
96
- installDependencies(dependencies);
145
+ installDependencies(uniqueDeps);
97
146
  }
98
147
  spinner.stop();
99
148
  console.log(chalk.green(`
@@ -104,9 +153,9 @@ program.command("add <component>").description("Add a component from ZeroZeeker
104
153
  console.log(chalk.cyan(` ${f}`));
105
154
  });
106
155
  }
107
- if (dependencies.length > 0) {
156
+ if (uniqueDeps.length > 0) {
108
157
  console.log(chalk.dim("\n Dependencies installed:"));
109
- dependencies.forEach((d) => {
158
+ uniqueDeps.forEach((d) => {
110
159
  console.log(chalk.cyan(` ${d}`));
111
160
  });
112
161
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zerozeeker",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Zero-config CLI for installing ZeroZeeker UI components. No shadcn required.",
5
5
  "type": "module",
6
6
  "bin": {