zerozeeker 2.2.9 → 2.2.10
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/README.md +18 -4
- package/dist/index.js +27 -162
- package/package.json +7 -10
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# ZeroZeeker Components
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
**No setup required. No shadcn/ui required. Just install and go.** ✨
|
|
3
|
+
Official CLI for installing production-ready UI components into your React or Next.js projects.
|
|
6
4
|
|
|
7
5
|
[](https://www.npmjs.com/package/zerozeeker)
|
|
8
6
|
[](https://www.typescriptlang.org/)
|
|
@@ -92,8 +90,17 @@ Before using ZeroZeeker components, ensure you have:
|
|
|
92
90
|
|
|
93
91
|
- Node.js 18 or higher
|
|
94
92
|
- An existing React or Next.js project
|
|
93
|
+
- shadcn/ui initialized in your project
|
|
95
94
|
- Tailwind CSS configured
|
|
96
95
|
|
|
96
|
+
### Setup shadcn/ui
|
|
97
|
+
|
|
98
|
+
If you haven't initialized shadcn/ui yet:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npx shadcn-ui@latest init
|
|
102
|
+
```
|
|
103
|
+
|
|
97
104
|
---
|
|
98
105
|
|
|
99
106
|
## How to Use Installed Components
|
|
@@ -112,7 +119,7 @@ export default function App() {
|
|
|
112
119
|
}
|
|
113
120
|
```
|
|
114
121
|
|
|
115
|
-
All components follow
|
|
122
|
+
All components follow shadcn/ui conventions. Import from `@/components/ui/<component-name>`.
|
|
116
123
|
|
|
117
124
|
---
|
|
118
125
|
|
|
@@ -151,6 +158,13 @@ Use the full npx command:
|
|
|
151
158
|
npx zerozeeker list
|
|
152
159
|
```
|
|
153
160
|
|
|
161
|
+
### shadcn/ui not initialized
|
|
162
|
+
|
|
163
|
+
Initialize shadcn/ui first:
|
|
164
|
+
```bash
|
|
165
|
+
npx shadcn-ui@latest init
|
|
166
|
+
```
|
|
167
|
+
|
|
154
168
|
### Component won't install
|
|
155
169
|
|
|
156
170
|
Verify the exact component name:
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
// index.ts
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
import { execSync } from "child_process";
|
|
6
|
-
import { existsSync, mkdirSync, writeFileSync } from "fs";
|
|
7
|
-
import { join, dirname } from "path";
|
|
8
6
|
import ora from "ora";
|
|
9
7
|
import chalk from "chalk";
|
|
10
8
|
var REGISTRY_URL = "https://www.zerozeeker.com/r";
|
|
@@ -17,184 +15,51 @@ var COMPONENTS = [
|
|
|
17
15
|
"circle-reveal-button",
|
|
18
16
|
"index"
|
|
19
17
|
];
|
|
20
|
-
async function fetchRegistry(url) {
|
|
21
|
-
const response = await fetch(url);
|
|
22
|
-
if (!response.ok) {
|
|
23
|
-
throw new Error(`Failed to fetch registry: ${response.statusText}`);
|
|
24
|
-
}
|
|
25
|
-
return response.json();
|
|
26
|
-
}
|
|
27
|
-
function ensureDir(filePath) {
|
|
28
|
-
const dir = dirname(filePath);
|
|
29
|
-
if (!existsSync(dir)) {
|
|
30
|
-
mkdirSync(dir, { recursive: true });
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function findProjectRoot() {
|
|
34
|
-
let currentDir = process.cwd();
|
|
35
|
-
while (currentDir !== dirname(currentDir)) {
|
|
36
|
-
if (existsSync(join(currentDir, "package.json"))) {
|
|
37
|
-
return currentDir;
|
|
38
|
-
}
|
|
39
|
-
currentDir = dirname(currentDir);
|
|
40
|
-
}
|
|
41
|
-
throw new Error("Could not find project root (no package.json found)");
|
|
42
|
-
}
|
|
43
|
-
function installDependencies(deps) {
|
|
44
|
-
if (deps.length === 0) return;
|
|
45
|
-
console.log(chalk.dim(` Installing dependencies: ${deps.join(", ")}`));
|
|
46
|
-
try {
|
|
47
|
-
execSync(`npm install ${deps.join(" ")}`, {
|
|
48
|
-
stdio: "pipe",
|
|
49
|
-
encoding: "utf-8"
|
|
50
|
-
});
|
|
51
|
-
} catch {
|
|
52
|
-
console.warn(chalk.yellow(` Warning: Failed to auto-install dependencies. Install manually: npm install ${deps.join(" ")}`));
|
|
53
|
-
}
|
|
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
|
-
}
|
|
94
18
|
var program = new Command();
|
|
95
|
-
program.name("zerozeeker").description("CLI for installing ZeroZeeker UI components
|
|
96
|
-
program.command("add <component>").description("Add a component from ZeroZeeker registry").action(
|
|
19
|
+
program.name("zerozeeker").description("CLI for installing ZeroZeeker UI components >>> because life is too short for boring interfaces").version("2.2.10");
|
|
20
|
+
program.command("add <component>").description("Add a component from ZeroZeeker registry").action((component) => {
|
|
97
21
|
if (!COMPONENTS.includes(component)) {
|
|
98
|
-
console.error(chalk.red(`Component "${component}" does not exist in this dimension.`));
|
|
99
|
-
console.log(chalk.dim("\
|
|
22
|
+
console.error(chalk.red(`[X] Component "${component}" does not exist in this dimension.`));
|
|
23
|
+
console.log(chalk.dim("\n>>> Here are the components that actually exist:"));
|
|
100
24
|
COMPONENTS.filter((c) => c !== "index").forEach((c) => {
|
|
101
|
-
console.log(chalk.cyan(`
|
|
25
|
+
console.log(chalk.cyan(` -> ${c}`));
|
|
102
26
|
});
|
|
103
|
-
console.log(chalk.dim("\
|
|
27
|
+
console.log(chalk.dim("\n[*] Pro tip: Copy-paste is your friend."));
|
|
104
28
|
process.exit(1);
|
|
105
29
|
}
|
|
106
30
|
const url = `${REGISTRY_URL}/${component}.json`;
|
|
107
|
-
const spinner = ora(`Installing ${chalk.cyan(component)}
|
|
31
|
+
const spinner = ora(`[~] Installing ${chalk.cyan(component)}... hold tight`).start();
|
|
108
32
|
try {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
}
|
|
123
|
-
if (registry.files && registry.files.length > 0) {
|
|
124
|
-
spinner.text = `Installing ${chalk.cyan(component)} files...`;
|
|
125
|
-
for (const file of registry.files) {
|
|
126
|
-
const targetPath = file.target || file.path;
|
|
127
|
-
const fullPath = join(projectRoot, targetPath);
|
|
128
|
-
if (existsSync(fullPath)) {
|
|
129
|
-
spinner.stop();
|
|
130
|
-
console.warn(chalk.yellow(`
|
|
131
|
-
\u26A0 File already exists: ${targetPath}`));
|
|
132
|
-
console.log(chalk.dim(" Skipping to avoid overwriting your changes."));
|
|
133
|
-
console.log(chalk.dim(` To force reinstall: delete the file and run the command again.
|
|
134
|
-
`));
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
ensureDir(fullPath);
|
|
138
|
-
writeFileSync(fullPath, file.content, "utf-8");
|
|
139
|
-
filesInstalled.push(targetPath);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
const uniqueDeps = [...new Set(allDependencies)];
|
|
143
|
-
if (uniqueDeps.length > 0) {
|
|
144
|
-
spinner.text = "Installing npm dependencies...";
|
|
145
|
-
installDependencies(uniqueDeps);
|
|
146
|
-
}
|
|
33
|
+
execSync(`npx shadcn@latest add ${url}`, {
|
|
34
|
+
stdio: "inherit",
|
|
35
|
+
encoding: "utf-8"
|
|
36
|
+
});
|
|
147
37
|
spinner.stop();
|
|
148
|
-
console.log(chalk.green(`
|
|
149
|
-
|
|
150
|
-
if (filesInstalled.length > 0) {
|
|
151
|
-
console.log(chalk.dim("\n Files added:"));
|
|
152
|
-
filesInstalled.forEach((f) => {
|
|
153
|
-
console.log(chalk.cyan(` ${f}`));
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
if (uniqueDeps.length > 0) {
|
|
157
|
-
console.log(chalk.dim("\n Dependencies installed:"));
|
|
158
|
-
uniqueDeps.forEach((d) => {
|
|
159
|
-
console.log(chalk.cyan(` ${d}`));
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
console.log(chalk.dim("\n Now go make something beautiful. \u2728\n"));
|
|
163
|
-
} catch (error) {
|
|
38
|
+
console.log(chalk.green(`[+] Successfully installed ${component}. Now go make something beautiful.`));
|
|
39
|
+
} catch {
|
|
164
40
|
spinner.stop();
|
|
165
|
-
console.error(chalk.red(`
|
|
166
|
-
|
|
167
|
-
if (error instanceof Error) {
|
|
168
|
-
if (error.message.includes("package.json")) {
|
|
169
|
-
console.log(chalk.dim("\n Make sure you're in a React/Next.js project directory."));
|
|
170
|
-
} else if (error.message.includes("fetch")) {
|
|
171
|
-
console.log(chalk.dim("\n Check your internet connection and try again."));
|
|
172
|
-
} else {
|
|
173
|
-
console.log(chalk.dim(`
|
|
174
|
-
${error.message}`));
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
console.log(chalk.dim("\n Need help? https://www.zerozeeker.com/docs\n"));
|
|
41
|
+
console.error(chalk.red(`[!] Failed to install ${component}. The internet might be having a bad day.`));
|
|
42
|
+
console.log(chalk.dim("[*] Try again, or check your network connection."));
|
|
178
43
|
process.exit(1);
|
|
179
44
|
}
|
|
180
45
|
});
|
|
181
46
|
program.command("list").description("List all available components").action(() => {
|
|
182
|
-
console.log(chalk.bold("\
|
|
183
|
-
console.log(chalk.dim("Modern, polished components that make users actually want to interact.\n"));
|
|
47
|
+
console.log(chalk.bold("\n<<< ZeroZeeker UI Components >>>\n"));
|
|
48
|
+
console.log(chalk.dim(">>> Modern, polished components that make users actually want to interact.\n"));
|
|
184
49
|
const descriptions = {
|
|
185
|
-
"rainbow-button": "Animated rainbow gradient border
|
|
186
|
-
"shimmer-button": "Moving border glow effect
|
|
187
|
-
"magnetic-button": "Cursor-following magnetic effect
|
|
188
|
-
"expand-button": "Expanding pill animation
|
|
189
|
-
"flip-button": "3D flip card effect
|
|
190
|
-
"circle-reveal-button": "Icon to pill expansion
|
|
50
|
+
"rainbow-button": "~~~ Animated rainbow gradient border -> for when one color just will not cut it",
|
|
51
|
+
"shimmer-button": "*** Moving border glow effect -> subtle flex, maximum impact",
|
|
52
|
+
"magnetic-button": "@@@ Cursor-following magnetic effect -> it literally chases your mouse",
|
|
53
|
+
"expand-button": "+++ Expanding pill animation -> small to big, just like your startup",
|
|
54
|
+
"flip-button": "### 3D flip card effect -> because flat is boring",
|
|
55
|
+
"circle-reveal-button": ">>> Icon to pill expansion -> the element of surprise"
|
|
191
56
|
};
|
|
192
57
|
COMPONENTS.filter((c) => c !== "index").forEach((component) => {
|
|
193
|
-
console.log(chalk.cyan(` ${component}`));
|
|
194
|
-
console.log(chalk.dim(`
|
|
58
|
+
console.log(chalk.cyan(` [>] ${component}`));
|
|
59
|
+
console.log(chalk.dim(` ${descriptions[component]}
|
|
195
60
|
`));
|
|
196
61
|
});
|
|
197
|
-
console.log(chalk.dim("Install any component with: ") + chalk.white("npx zerozeeker add <component>"));
|
|
198
|
-
console.log(chalk.dim("More components coming soon. Ship fast. Look good doing it.\n"));
|
|
62
|
+
console.log(chalk.dim(">>> Install any component with: ") + chalk.white("npx zerozeeker add <component>"));
|
|
63
|
+
console.log(chalk.dim(">>> More components coming soon. Ship fast. Look good doing it.\n"));
|
|
199
64
|
});
|
|
200
65
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zerozeeker",
|
|
3
|
-
"version": "2.2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.2.10",
|
|
4
|
+
"description": "CLI for installing ZeroZeeker UI components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"zerozeeker": "dist/index.js"
|
|
@@ -16,24 +16,21 @@
|
|
|
16
16
|
"prepublishOnly": "npm run build"
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
|
-
"
|
|
20
|
-
"ui",
|
|
19
|
+
"shadcn",
|
|
21
20
|
"components",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"typescript"
|
|
21
|
+
"ui",
|
|
22
|
+
"zerozeeker"
|
|
25
23
|
],
|
|
26
24
|
"author": "ZeroZeeker",
|
|
27
25
|
"license": "MIT",
|
|
28
26
|
"dependencies": {
|
|
29
|
-
"chalk": "^5.3.0",
|
|
30
27
|
"commander": "^12.1.0",
|
|
31
|
-
"ora": "^8.0.1"
|
|
28
|
+
"ora": "^8.0.1",
|
|
29
|
+
"chalk": "^5.3.0"
|
|
32
30
|
},
|
|
33
31
|
"devDependencies": {
|
|
34
32
|
"@types/node": "^20.11.5",
|
|
35
33
|
"tsup": "^8.0.1",
|
|
36
|
-
"tsx": "^4.21.0",
|
|
37
34
|
"typescript": "^5.3.3"
|
|
38
35
|
},
|
|
39
36
|
"engines": {
|