zerozeeker 2.1.0 → 2.2.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 (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +105 -7
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Zero-config CLI** for installing production-ready UI components into your React or Next.js projects.
4
4
 
5
- **No setup required. No shadcn/ui required. Just install and go.**
5
+ **No setup required. Just install and go.**
6
6
 
7
7
  [![npm](https://img.shields.io/npm/v/zerozeeker?style=flat-square&color=181825)](https://www.npmjs.com/package/zerozeeker)
8
8
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-3178C6?style=flat-square&logo=typescript)](https://www.typescriptlang.org/)
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // index.ts
4
4
  import { Command } from "commander";
5
5
  import { execSync } from "child_process";
6
- import { existsSync, mkdirSync, writeFileSync } from "fs";
6
+ import { existsSync, mkdirSync, writeFileSync, readFileSync } from "fs";
7
7
  import { join, dirname } from "path";
8
8
  import ora from "ora";
9
9
  import chalk from "chalk";
@@ -92,10 +92,108 @@ async function installRegistryDependencies(deps, projectRoot, installed = /* @__
92
92
  return { files: allFiles, npmDeps: allNpmDeps };
93
93
  }
94
94
  var program = new Command();
95
- program.name("zerozeeker").description("CLI for installing ZeroZeeker UI components - because life is too short for boring interfaces").version("2.1.0");
95
+ program.name("zerozeeker").description("CLI for installing ZeroZeeker UI components - because life is too short for boring interfaces").version("2.2.0");
96
+ program.command("init").description("Initialize ZeroZeeker in your project").action(async () => {
97
+ const spinner = ora("Checking project setup...").start();
98
+ try {
99
+ const projectRoot = findProjectRoot();
100
+ const checks = [];
101
+ const tsconfigPath = join(projectRoot, "tsconfig.json");
102
+ if (existsSync(tsconfigPath)) {
103
+ try {
104
+ const tsconfig = JSON.parse(readFileSync(tsconfigPath, "utf-8"));
105
+ const paths = tsconfig.compilerOptions?.paths || {};
106
+ const hasComponentsAlias = paths["@/components/*"] || paths["@/components"];
107
+ const hasLibAlias = paths["@/lib/*"] || paths["@/lib"];
108
+ if (hasComponentsAlias && hasLibAlias) {
109
+ checks.push({ name: "TypeScript paths", passed: true });
110
+ } else {
111
+ checks.push({
112
+ name: "TypeScript paths",
113
+ passed: false,
114
+ message: "Missing @/components or @/lib path aliases"
115
+ });
116
+ }
117
+ } catch {
118
+ checks.push({ name: "TypeScript config", passed: false, message: "Invalid tsconfig.json" });
119
+ }
120
+ } else {
121
+ checks.push({ name: "TypeScript", passed: false, message: "tsconfig.json not found" });
122
+ }
123
+ const tailwindConfigs = [
124
+ "tailwind.config.ts",
125
+ "tailwind.config.js",
126
+ "tailwind.config.mjs",
127
+ "tailwind.config.cjs"
128
+ ];
129
+ const hasTailwind = tailwindConfigs.some((config) => existsSync(join(projectRoot, config)));
130
+ if (hasTailwind) {
131
+ checks.push({ name: "Tailwind CSS", passed: true });
132
+ } else {
133
+ checks.push({ name: "Tailwind CSS", passed: false, message: "Config file not found" });
134
+ }
135
+ const packageJsonPath = join(projectRoot, "package.json");
136
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
137
+ const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
138
+ const hasReact = deps.react;
139
+ const hasNext = deps.next;
140
+ if (hasReact || hasNext) {
141
+ checks.push({
142
+ name: hasNext ? "Next.js" : "React",
143
+ passed: true
144
+ });
145
+ } else {
146
+ checks.push({ name: "React/Next.js", passed: false, message: "Not found in dependencies" });
147
+ }
148
+ spinner.stop();
149
+ console.log(chalk.bold("\n\u{1F50D} Project Setup Check\n"));
150
+ let allPassed = true;
151
+ for (const check of checks) {
152
+ if (check.passed) {
153
+ console.log(chalk.green(` \u2713 ${check.name}`));
154
+ } else {
155
+ console.log(chalk.red(` \u2717 ${check.name}${check.message ? `: ${check.message}` : ""}`));
156
+ allPassed = false;
157
+ }
158
+ }
159
+ if (allPassed) {
160
+ console.log(chalk.green("\n\u2728 Your project is ready for ZeroZeeker!\n"));
161
+ console.log(chalk.dim("Get started:"));
162
+ console.log(chalk.cyan(" npx zerozeeker add rainbow-button"));
163
+ console.log(chalk.dim("\nList all components:"));
164
+ console.log(chalk.cyan(" npx zerozeeker list\n"));
165
+ } else {
166
+ console.log(chalk.yellow("\n\u26A0\uFE0F Some setup issues detected\n"));
167
+ if (!checks.find((c) => c.name === "TypeScript")?.passed) {
168
+ console.log(chalk.dim("Install TypeScript:"));
169
+ console.log(chalk.white(" npm install -D typescript @types/node @types/react"));
170
+ console.log(chalk.dim("\nCreate tsconfig.json with path aliases:"));
171
+ console.log(chalk.white(" npx tsc --init"));
172
+ }
173
+ if (!checks.find((c) => c.name === "Tailwind CSS")?.passed) {
174
+ console.log(chalk.dim("\nInstall Tailwind CSS:"));
175
+ console.log(chalk.white(" npm install -D tailwindcss postcss autoprefixer"));
176
+ console.log(chalk.white(" npx tailwindcss init -p"));
177
+ }
178
+ console.log(chalk.dim("\nOr create a new Next.js project:"));
179
+ console.log(chalk.white(" npx create-next-app@latest --typescript --tailwind\n"));
180
+ process.exit(1);
181
+ }
182
+ } catch (error) {
183
+ spinner.stop();
184
+ console.error(chalk.red("\n\u2717 Initialization failed\n"));
185
+ if (error instanceof Error && error.message.includes("package.json")) {
186
+ console.log(chalk.dim("Make sure you're in a React/Next.js project directory.\n"));
187
+ } else {
188
+ console.log(chalk.dim(`${error instanceof Error ? error.message : "Unknown error"}
189
+ `));
190
+ }
191
+ process.exit(1);
192
+ }
193
+ });
96
194
  program.command("add <component>").description("Add a component from ZeroZeeker registry").action(async (component) => {
97
195
  if (!COMPONENTS.includes(component)) {
98
- console.error(chalk.red(`Component "${component}" does not exist in this dimension.`));
196
+ console.error(chalk.red(`[x] Component "${component}" does not exist in this dimension.`));
99
197
  console.log(chalk.dim("\nHere are the components that actually exist:"));
100
198
  COMPONENTS.filter((c) => c !== "index").forEach((c) => {
101
199
  console.log(chalk.cyan(` - ${c}`));
@@ -128,7 +226,7 @@ program.command("add <component>").description("Add a component from ZeroZeeker
128
226
  if (existsSync(fullPath)) {
129
227
  spinner.stop();
130
228
  console.warn(chalk.yellow(`
131
- \u26A0 File already exists: ${targetPath}`));
229
+ [!] File already exists: ${targetPath}`));
132
230
  console.log(chalk.dim(" Skipping to avoid overwriting your changes."));
133
231
  console.log(chalk.dim(` To force reinstall: delete the file and run the command again.
134
232
  `));
@@ -146,7 +244,7 @@ program.command("add <component>").description("Add a component from ZeroZeeker
146
244
  }
147
245
  spinner.stop();
148
246
  console.log(chalk.green(`
149
- \u2713 Successfully installed ${component}`));
247
+ [+] Successfully installed ${component}`));
150
248
  if (filesInstalled.length > 0) {
151
249
  console.log(chalk.dim("\n Files added:"));
152
250
  filesInstalled.forEach((f) => {
@@ -159,11 +257,11 @@ program.command("add <component>").description("Add a component from ZeroZeeker
159
257
  console.log(chalk.cyan(` ${d}`));
160
258
  });
161
259
  }
162
- console.log(chalk.dim("\n Now go make something beautiful. \u2728\n"));
260
+ console.log(chalk.dim("\n Now go make something beautiful.\n"));
163
261
  } catch (error) {
164
262
  spinner.stop();
165
263
  console.error(chalk.red(`
166
- \u2717 Failed to install ${component}`));
264
+ [x] Failed to install ${component}`));
167
265
  if (error instanceof Error) {
168
266
  if (error.message.includes("package.json")) {
169
267
  console.log(chalk.dim("\n Make sure you're in a React/Next.js project directory."));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zerozeeker",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Zero-config CLI for installing ZeroZeeker UI components. No shadcn required.",
5
5
  "type": "module",
6
6
  "bin": {