homeontour-ui 0.1.4 → 0.1.6

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/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import { Command as Command3 } from "commander";
4
+ import { Command as Command4 } from "commander";
5
5
 
6
6
  // src/commands/add.ts
7
7
  import { Command } from "commander";
@@ -13,7 +13,11 @@ import fs from "fs-extra";
13
13
  import path from "path";
14
14
  import fetch from "node-fetch";
15
15
  var REGISTRY_URL = "https://ui.homeontour.com/api/registry";
16
- var COMPONENTS_DIR = "components/homeontour-ui";
16
+ function getComponentsDir(cwd) {
17
+ const srcDir = path.join(cwd, "src");
18
+ const baseDir = fs.existsSync(srcDir) ? "src/components" : "components";
19
+ return path.join(baseDir, "homeontour-ui");
20
+ }
17
21
  var addCommand = new Command().name("add").description("Add a component to your project").argument("[components...]", "The components to add").option("-y, --yes", "Skip confirmation prompt").option("-o, --overwrite", "Overwrite existing files").action(async (components, options) => {
18
22
  try {
19
23
  const cwd = process.cwd();
@@ -59,7 +63,9 @@ var addCommand = new Command().name("add").description("Add a component to your
59
63
  console.log(chalk.green("\u2713 Done! Components added successfully."));
60
64
  console.log();
61
65
  console.log("Import and use them in your project:");
62
- console.log(chalk.cyan(`import { LogoSvg } from '@/components/homeontour-ui/logo-svg'`));
66
+ const componentsDir = getComponentsDir(cwd);
67
+ const importPath = componentsDir.replace(/\\/g, "/");
68
+ console.log(chalk.cyan(`import { LogoSvg } from '@/${importPath}/logo-svg'`));
63
69
  } catch (error) {
64
70
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : error);
65
71
  process.exit(1);
@@ -73,7 +79,7 @@ async function addComponent(componentName, options) {
73
79
  throw new Error(`Component "${componentName}" not found in registry`);
74
80
  }
75
81
  const component = await response.json();
76
- const componentDir = path.join(options.cwd, COMPONENTS_DIR);
82
+ const componentDir = path.join(options.cwd, getComponentsDir(options.cwd));
77
83
  const componentPath = path.join(componentDir, component.files[0].name);
78
84
  if (fs.existsSync(componentPath) && !options.overwrite) {
79
85
  spinner.warn(`${componentName} already exists`);
@@ -224,10 +230,169 @@ export function cn(...inputs: ClassValue[]) {
224
230
  }
225
231
  });
226
232
 
233
+ // src/commands/generate.ts
234
+ import { Command as Command3 } from "commander";
235
+ import chalk3 from "chalk";
236
+ import ora3 from "ora";
237
+ import fs3 from "fs-extra";
238
+ import path3 from "path";
239
+ function toPascalCase(str) {
240
+ return str.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
241
+ }
242
+ function toCamelCase(str) {
243
+ const pascal = toPascalCase(str);
244
+ return pascal.charAt(0).toLowerCase() + pascal.slice(1);
245
+ }
246
+ function generateComponentContent(componentName, componentPascal) {
247
+ return `import * as React from "react"
248
+ import { cn } from "@/lib/utils"
249
+
250
+ export interface ${componentPascal}Props extends React.HTMLAttributes<HTMLDivElement> {
251
+ // Add your custom props here
252
+ }
253
+
254
+ export const ${componentPascal} = React.forwardRef<HTMLDivElement, ${componentPascal}Props>(
255
+ ({ className, ...props }, ref) => {
256
+ return (
257
+ <div
258
+ ref={ref}
259
+ className={cn("", className)}
260
+ {...props}
261
+ />
262
+ )
263
+ }
264
+ )
265
+ ${componentPascal}.displayName = "${componentPascal}"
266
+
267
+ export default ${componentPascal}
268
+ `;
269
+ }
270
+ function generateMetadataContent(componentName, componentPascal) {
271
+ return `import { ComponentMetadata } from "@/lib/component-metadata"
272
+
273
+ export const metadata: ComponentMetadata = {
274
+ name: "${componentName}",
275
+ type: "components:ui",
276
+ description: "${componentPascal} component.",
277
+ category: "UI Components",
278
+ registryDependencies: [],
279
+ examples: [
280
+ {
281
+ name: "Default",
282
+ description: "Default ${componentPascal} component",
283
+ code: \`<${componentPascal} />\`,
284
+ previewProps: {},
285
+ },
286
+ ],
287
+ }
288
+ `;
289
+ }
290
+ async function updateMetadataRegistry(projectRoot, componentName, componentPascal) {
291
+ const metadataRegistryPath = path3.join(projectRoot, "src/lib/metadata-registry.ts");
292
+ if (!fs3.existsSync(metadataRegistryPath)) {
293
+ throw new Error("metadata-registry.ts not found");
294
+ }
295
+ let lines = (await fs3.readFile(metadataRegistryPath, "utf-8")).split("\n");
296
+ const importName = `${toCamelCase(componentName)}Metadata`;
297
+ const importStatement = `import { metadata as ${importName} } from "@/components/registry/${componentName}.metadata"`;
298
+ if (lines.some((line) => line.includes(importStatement))) {
299
+ throw new Error("Import already exists");
300
+ }
301
+ let lastImportIndex = -1;
302
+ for (let i = 0; i < lines.length; i++) {
303
+ if (lines[i].trim().startsWith("import ") && lines[i].includes("from")) {
304
+ lastImportIndex = i;
305
+ }
306
+ }
307
+ if (lastImportIndex >= 0) {
308
+ lines.splice(lastImportIndex + 1, 0, importStatement);
309
+ }
310
+ const registryEntry = ` "${componentName}": ${importName},`;
311
+ let inRegistryObject = false;
312
+ let lastRegistryEntryIndex = -1;
313
+ for (let i = 0; i < lines.length; i++) {
314
+ const line = lines[i];
315
+ if (line.includes("export const metadataRegistry")) {
316
+ inRegistryObject = true;
317
+ continue;
318
+ }
319
+ if (inRegistryObject) {
320
+ if (line.trim().match(/^"[^"]+":\s+\w+Metadata,?$/)) {
321
+ lastRegistryEntryIndex = i;
322
+ }
323
+ if (line.trim() === "}") {
324
+ if (lastRegistryEntryIndex >= 0) {
325
+ lines.splice(lastRegistryEntryIndex + 1, 0, registryEntry);
326
+ } else {
327
+ for (let j = i - 1; j >= 0; j--) {
328
+ if (lines[j].includes("metadataRegistry") && lines[j].includes("{")) {
329
+ lines.splice(j + 1, 0, registryEntry);
330
+ break;
331
+ }
332
+ }
333
+ }
334
+ break;
335
+ }
336
+ }
337
+ }
338
+ await fs3.writeFile(metadataRegistryPath, lines.join("\n"), "utf-8");
339
+ }
340
+ var generateCommand = new Command3().name("generate").alias("gen").description("Generate boilerplate for a new component").argument("<name>", "Component name in kebab-case (e.g., my-component)").action(async (name) => {
341
+ try {
342
+ const cwd = process.cwd();
343
+ if (!/^[a-z][a-z0-9-]*$/.test(name)) {
344
+ console.error(chalk3.red("Error: Component name must be in kebab-case (e.g., my-component)"));
345
+ process.exit(1);
346
+ }
347
+ const spinner = ora3(`Generating ${name} component...`).start();
348
+ const registryDir = path3.join(cwd, "src/components/registry");
349
+ if (!fs3.existsSync(registryDir)) {
350
+ spinner.fail("Error: src/components/registry directory not found");
351
+ console.error(chalk3.red("Are you in the correct project directory?"));
352
+ process.exit(1);
353
+ }
354
+ const componentPascal = toPascalCase(name);
355
+ const componentFile = path3.join(registryDir, `${name}.tsx`);
356
+ const metadataFile = path3.join(registryDir, `${name}.metadata.ts`);
357
+ if (fs3.existsSync(componentFile) || fs3.existsSync(metadataFile)) {
358
+ spinner.warn(`${name} already exists`);
359
+ console.log(chalk3.yellow(`Component files already exist. Skipping generation.`));
360
+ process.exit(0);
361
+ }
362
+ const componentContent = generateComponentContent(name, componentPascal);
363
+ await fs3.writeFile(componentFile, componentContent, "utf-8");
364
+ spinner.succeed(`Created ${name}.tsx`);
365
+ const metadataContent = generateMetadataContent(name, componentPascal);
366
+ await fs3.writeFile(metadataFile, metadataContent, "utf-8");
367
+ spinner.succeed(`Created ${name}.metadata.ts`);
368
+ spinner.start("Updating metadata registry...");
369
+ try {
370
+ await updateMetadataRegistry(cwd, name, componentPascal);
371
+ spinner.succeed("Updated metadata registry");
372
+ } catch (error) {
373
+ spinner.warn("Could not automatically update metadata registry");
374
+ console.log(chalk3.yellow("\nPlease manually add the following to src/lib/metadata-registry.ts:"));
375
+ console.log(chalk3.cyan(`import { metadata as ${toCamelCase(name)}Metadata } from "@/components/registry/${name}.metadata"`));
376
+ console.log(chalk3.cyan(` "${name}": ${toCamelCase(name)}Metadata,`));
377
+ }
378
+ console.log();
379
+ console.log(chalk3.green("\u2713 Component generated successfully!"));
380
+ console.log();
381
+ console.log("Next steps:");
382
+ console.log(chalk3.cyan(` 1. Edit src/components/registry/${name}.tsx`));
383
+ console.log(chalk3.cyan(` 2. Update src/components/registry/${name}.metadata.ts with examples and description`));
384
+ console.log();
385
+ } catch (error) {
386
+ console.error(chalk3.red("Error:"), error instanceof Error ? error.message : error);
387
+ process.exit(1);
388
+ }
389
+ });
390
+
227
391
  // src/index.ts
228
- var program = new Command3();
392
+ var program = new Command4();
229
393
  program.name("homeontour-ui").description("Add HomeOnTour UI components to your project").version("0.1.0");
230
394
  program.addCommand(addCommand);
231
395
  program.addCommand(initCommand);
396
+ program.addCommand(generateCommand);
232
397
  program.parse();
233
398
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/commands/add.ts","../src/commands/init.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Command } from 'commander'\nimport { addCommand } from './commands/add.js'\nimport { initCommand } from './commands/init.js'\n\nconst program = new Command()\n\nprogram\n .name('homeontour-ui')\n .description('Add HomeOnTour UI components to your project')\n .version('0.1.0')\n\nprogram.addCommand(addCommand)\nprogram.addCommand(initCommand)\n\nprogram.parse()\n","import { Command } from 'commander'\nimport prompts from 'prompts'\nimport chalk from 'chalk'\nimport ora from 'ora'\nimport { execa } from 'execa'\nimport fs from 'fs-extra'\nimport path from 'path'\nimport fetch from 'node-fetch'\n\nconst REGISTRY_URL = 'https://ui.homeontour.com/api/registry'\nconst COMPONENTS_DIR = 'components/homeontour-ui'\n\nexport const addCommand = new Command()\n .name('add')\n .description('Add a component to your project')\n .argument('[components...]', 'The components to add')\n .option('-y, --yes', 'Skip confirmation prompt')\n .option('-o, --overwrite', 'Overwrite existing files')\n .action(async (components: string[], options) => {\n try {\n const cwd = process.cwd()\n \n // Check if we're in a valid project\n const packageJsonPath = path.join(cwd, 'package.json')\n if (!fs.existsSync(packageJsonPath)) {\n console.error(chalk.red('Error: No package.json found. Are you in a project directory?'))\n process.exit(1)\n }\n\n // If no components specified, show interactive selection\n if (!components || components.length === 0) {\n const spinner = ora('Fetching components...').start()\n \n try {\n const response = await fetch(REGISTRY_URL)\n if (!response.ok) {\n throw new Error('Failed to fetch components')\n }\n \n const allComponents = await response.json() as any[]\n spinner.succeed('Fetched available components')\n \n const { selectedComponents } = await prompts({\n type: 'multiselect',\n name: 'selectedComponents',\n message: 'Which components would you like to add?',\n choices: allComponents.map((c: any) => ({\n title: `${c.name} - ${c.description}`,\n value: c.name,\n })),\n min: 1,\n })\n \n if (!selectedComponents || selectedComponents.length === 0) {\n console.log(chalk.yellow('No components selected. Exiting.'))\n process.exit(0)\n }\n \n components = selectedComponents\n } catch (error) {\n spinner.fail('Failed to fetch components')\n console.error(chalk.red('Error: Could not connect to registry. Is the server running?'))\n process.exit(1)\n }\n }\n\n // Add each component\n for (const componentName of components) {\n await addComponent(componentName, { cwd, ...options })\n }\n\n console.log()\n console.log(chalk.green('✓ Done! Components added successfully.'))\n console.log()\n console.log('Import and use them in your project:')\n console.log(chalk.cyan(`import { LogoSvg } from '@/components/homeontour-ui/logo-svg'`))\n } catch (error) {\n console.error(chalk.red('Error:'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n\nasync function addComponent(\n componentName: string,\n options: { cwd: string; yes?: boolean; overwrite?: boolean }\n) {\n const spinner = ora(`Adding ${componentName}...`).start()\n\n try {\n // Fetch component from registry\n const response = await fetch(`${REGISTRY_URL}/${componentName}`)\n \n if (!response.ok) {\n throw new Error(`Component \"${componentName}\" not found in registry`)\n }\n \n const component = await response.json() as any\n\n // Check if component already exists\n const componentDir = path.join(options.cwd, COMPONENTS_DIR)\n const componentPath = path.join(componentDir, component.files[0].name)\n \n if (fs.existsSync(componentPath) && !options.overwrite) {\n spinner.warn(`${componentName} already exists`)\n \n if (!options.yes) {\n const { overwrite } = await prompts({\n type: 'confirm',\n name: 'overwrite',\n message: `Overwrite existing ${componentName}?`,\n initial: false,\n })\n \n if (!overwrite) {\n return\n }\n } else {\n return\n }\n }\n\n // Install npm dependencies\n if (component.dependencies && component.dependencies.length > 0) {\n spinner.text = `Installing dependencies for ${componentName}...`\n const deps = component.dependencies.map((d: any) => `${d.name}@${d.version}`).join(' ')\n \n try {\n await execa('pnpm', ['add', ...deps.split(' ')], {\n cwd: options.cwd,\n })\n } catch (error) {\n // Try npm as fallback\n try {\n await execa('npm', ['install', ...deps.split(' ')], {\n cwd: options.cwd,\n })\n } catch (npmError) {\n spinner.warn(`Could not install dependencies automatically`)\n console.log(chalk.yellow(`\\nPlease install manually: pnpm add ${deps}`))\n }\n }\n }\n\n // Install shadcn/ui dependencies\n if (component.registryDependencies && component.registryDependencies.length > 0) {\n spinner.text = `Installing shadcn/ui components...`\n const shadcnDeps = component.registryDependencies.join(' ')\n \n try {\n await execa('pnpm', ['dlx', 'shadcn@latest', 'add', ...shadcnDeps.split(' '), '-y'], {\n cwd: options.cwd,\n })\n } catch (error) {\n spinner.warn(`Could not install shadcn/ui components automatically`)\n console.log(chalk.yellow(`\\nPlease install manually: pnpm dlx shadcn@latest add ${shadcnDeps}`))\n }\n }\n\n // Create component files\n spinner.text = `Creating ${componentName} files...`\n await fs.ensureDir(componentDir)\n \n for (const file of component.files) {\n const filePath = path.join(componentDir, file.name)\n await fs.writeFile(filePath, file.content, 'utf-8')\n }\n\n spinner.succeed(`Added ${componentName}`)\n } catch (error) {\n spinner.fail(`Failed to add ${componentName}`)\n throw error\n }\n}\n","import { Command } from 'commander'\nimport prompts from 'prompts'\nimport chalk from 'chalk'\nimport ora from 'ora'\nimport { execa } from 'execa'\nimport fs from 'fs-extra'\nimport path from 'path'\n\nexport const initCommand = new Command()\n .name('init')\n .description('Initialize your project for HomeOnTour UI')\n .option('-y, --yes', 'Skip confirmation prompt')\n .action(async (options) => {\n try {\n const cwd = process.cwd()\n \n console.log()\n console.log(chalk.bold('Initializing HomeOnTour UI...'))\n console.log()\n\n // Check if package.json exists\n const packageJsonPath = path.join(cwd, 'package.json')\n if (!fs.existsSync(packageJsonPath)) {\n console.error(chalk.red('Error: No package.json found. Please run this in a project directory.'))\n process.exit(1)\n }\n\n // Check for required dependencies\n const requiredDeps = [\n 'class-variance-authority',\n 'clsx',\n 'tailwind-merge',\n 'lucide-react',\n ]\n\n const spinner = ora('Checking dependencies...').start()\n \n const packageJson = await fs.readJson(packageJsonPath)\n const installedDeps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n }\n\n const missingDeps = requiredDeps.filter((dep) => !installedDeps[dep])\n\n if (missingDeps.length > 0) {\n spinner.info('Installing required dependencies...')\n \n try {\n await execa('pnpm', ['add', ...missingDeps], { cwd })\n spinner.succeed('Dependencies installed')\n } catch (error) {\n spinner.fail('Failed to install dependencies')\n console.log(chalk.yellow(`\\nPlease install manually:`))\n console.log(chalk.cyan(`pnpm add ${missingDeps.join(' ')}`))\n }\n } else {\n spinner.succeed('All dependencies are installed')\n }\n\n // Check for utils file\n const utilsPath = path.join(cwd, 'lib', 'utils.ts')\n const srcUtilsPath = path.join(cwd, 'src', 'lib', 'utils.ts')\n const utilsExists = fs.existsSync(utilsPath) || fs.existsSync(srcUtilsPath)\n\n if (!utilsExists) {\n const { createUtils } = await prompts({\n type: 'confirm',\n name: 'createUtils',\n message: 'Create lib/utils.ts with cn helper?',\n initial: true,\n })\n\n if (createUtils) {\n const targetUtilsPath = fs.existsSync(path.join(cwd, 'src')) ? srcUtilsPath : utilsPath\n \n await fs.ensureDir(path.dirname(targetUtilsPath))\n await fs.writeFile(\n targetUtilsPath,\n `import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n`,\n 'utf-8'\n )\n console.log(chalk.green('✓ Created lib/utils.ts'))\n }\n }\n\n // Create components directory\n const componentsDir = path.join(cwd, 'components', 'homeontour-ui')\n await fs.ensureDir(componentsDir)\n console.log(chalk.green('✓ Created components/homeontour-ui directory'))\n\n console.log()\n console.log(chalk.green('✓ Initialization complete!'))\n console.log()\n console.log('You can now add components:')\n console.log(chalk.cyan(' pnpm dlx homeontour-ui@latest add logo-svg'))\n console.log()\n } catch (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Q,IAAIA,OAAM,MAAM,iCAA4B,CAAC;AACrD,YAAQ,IAAI;AACZ,YAAQ,IAAI,6BAA6B;AACzC,YAAQ,IAAIA,OAAM,KAAK,8CAA8C,CAAC;AACtE,YAAQ,IAAI;AAAA,EACd,SAAS,OAAO;AACd,YAAQ,MAAMA,OAAM,IAAI,QAAQ,GAAG,iBAAiB,QAAQ,MAAM,UAAU,KAAK;AACjF,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,CAAC;;;AFrGH,IAAM,UAAU,IAAIK,SAAQ;AAE5B,QACG,KAAK,eAAe,EACpB,YAAY,8CAA8C,EAC1D,QAAQ,OAAO;AAElB,QAAQ,WAAW,UAAU;AAC7B,QAAQ,WAAW,WAAW;AAE9B,QAAQ,MAAM;","names":["Command","Command","prompts","chalk","ora","execa","fs","path","Command"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/commands/add.ts","../src/commands/init.ts","../src/commands/generate.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Command } from 'commander'\nimport { addCommand } from './commands/add.js'\nimport { initCommand } from './commands/init.js'\nimport { generateCommand } from './commands/generate.js'\n\nconst program = new Command()\n\nprogram\n .name('homeontour-ui')\n .description('Add HomeOnTour UI components to your project')\n .version('0.1.0')\n\nprogram.addCommand(addCommand)\nprogram.addCommand(initCommand)\nprogram.addCommand(generateCommand)\n\nprogram.parse()\n","import { Command } from 'commander'\nimport prompts from 'prompts'\nimport chalk from 'chalk'\nimport ora from 'ora'\nimport { execa } from 'execa'\nimport fs from 'fs-extra'\nimport path from 'path'\nimport fetch from 'node-fetch'\n\nconst REGISTRY_URL = 'https://ui.homeontour.com/api/registry'\n\nfunction getComponentsDir(cwd: string): string {\n const srcDir = path.join(cwd, 'src')\n const baseDir = fs.existsSync(srcDir) ? 'src/components' : 'components'\n return path.join(baseDir, 'homeontour-ui')\n}\n\nexport const addCommand = new Command()\n .name('add')\n .description('Add a component to your project')\n .argument('[components...]', 'The components to add')\n .option('-y, --yes', 'Skip confirmation prompt')\n .option('-o, --overwrite', 'Overwrite existing files')\n .action(async (components: string[], options) => {\n try {\n const cwd = process.cwd()\n \n // Check if we're in a valid project\n const packageJsonPath = path.join(cwd, 'package.json')\n if (!fs.existsSync(packageJsonPath)) {\n console.error(chalk.red('Error: No package.json found. Are you in a project directory?'))\n process.exit(1)\n }\n\n // If no components specified, show interactive selection\n if (!components || components.length === 0) {\n const spinner = ora('Fetching components...').start()\n \n try {\n const response = await fetch(REGISTRY_URL)\n if (!response.ok) {\n throw new Error('Failed to fetch components')\n }\n \n const allComponents = await response.json() as any[]\n spinner.succeed('Fetched available components')\n \n const { selectedComponents } = await prompts({\n type: 'multiselect',\n name: 'selectedComponents',\n message: 'Which components would you like to add?',\n choices: allComponents.map((c: any) => ({\n title: `${c.name} - ${c.description}`,\n value: c.name,\n })),\n min: 1,\n })\n \n if (!selectedComponents || selectedComponents.length === 0) {\n console.log(chalk.yellow('No components selected. Exiting.'))\n process.exit(0)\n }\n \n components = selectedComponents\n } catch (error) {\n spinner.fail('Failed to fetch components')\n console.error(chalk.red('Error: Could not connect to registry. Is the server running?'))\n process.exit(1)\n }\n }\n\n // Add each component\n for (const componentName of components) {\n await addComponent(componentName, { cwd, ...options })\n }\n\n console.log()\n console.log(chalk.green('✓ Done! Components added successfully.'))\n console.log()\n console.log('Import and use them in your project:')\n const componentsDir = getComponentsDir(cwd)\n const importPath = componentsDir.replace(/\\\\/g, '/')\n console.log(chalk.cyan(`import { LogoSvg } from '@/${importPath}/logo-svg'`))\n } catch (error) {\n console.error(chalk.red('Error:'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n\nasync function addComponent(\n componentName: string,\n options: { cwd: string; yes?: boolean; overwrite?: boolean }\n) {\n const spinner = ora(`Adding ${componentName}...`).start()\n\n try {\n // Fetch component from registry\n const response = await fetch(`${REGISTRY_URL}/${componentName}`)\n \n if (!response.ok) {\n throw new Error(`Component \"${componentName}\" not found in registry`)\n }\n \n const component = await response.json() as any\n\n // Check if component already exists\n const componentDir = path.join(options.cwd, getComponentsDir(options.cwd))\n const componentPath = path.join(componentDir, component.files[0].name)\n \n if (fs.existsSync(componentPath) && !options.overwrite) {\n spinner.warn(`${componentName} already exists`)\n \n if (!options.yes) {\n const { overwrite } = await prompts({\n type: 'confirm',\n name: 'overwrite',\n message: `Overwrite existing ${componentName}?`,\n initial: false,\n })\n \n if (!overwrite) {\n return\n }\n } else {\n return\n }\n }\n\n // Install npm dependencies\n if (component.dependencies && component.dependencies.length > 0) {\n spinner.text = `Installing dependencies for ${componentName}...`\n const deps = component.dependencies.map((d: any) => `${d.name}@${d.version}`).join(' ')\n \n try {\n await execa('pnpm', ['add', ...deps.split(' ')], {\n cwd: options.cwd,\n })\n } catch (error) {\n // Try npm as fallback\n try {\n await execa('npm', ['install', ...deps.split(' ')], {\n cwd: options.cwd,\n })\n } catch (npmError) {\n spinner.warn(`Could not install dependencies automatically`)\n console.log(chalk.yellow(`\\nPlease install manually: pnpm add ${deps}`))\n }\n }\n }\n\n // Install shadcn/ui dependencies\n if (component.registryDependencies && component.registryDependencies.length > 0) {\n spinner.text = `Installing shadcn/ui components...`\n const shadcnDeps = component.registryDependencies.join(' ')\n \n try {\n await execa('pnpm', ['dlx', 'shadcn@latest', 'add', ...shadcnDeps.split(' '), '-y'], {\n cwd: options.cwd,\n })\n } catch (error) {\n spinner.warn(`Could not install shadcn/ui components automatically`)\n console.log(chalk.yellow(`\\nPlease install manually: pnpm dlx shadcn@latest add ${shadcnDeps}`))\n }\n }\n\n // Create component files\n spinner.text = `Creating ${componentName} files...`\n await fs.ensureDir(componentDir)\n \n for (const file of component.files) {\n const filePath = path.join(componentDir, file.name)\n await fs.writeFile(filePath, file.content, 'utf-8')\n }\n\n spinner.succeed(`Added ${componentName}`)\n } catch (error) {\n spinner.fail(`Failed to add ${componentName}`)\n throw error\n }\n}\n","import { Command } from 'commander'\nimport prompts from 'prompts'\nimport chalk from 'chalk'\nimport ora from 'ora'\nimport { execa } from 'execa'\nimport fs from 'fs-extra'\nimport path from 'path'\n\nexport const initCommand = new Command()\n .name('init')\n .description('Initialize your project for HomeOnTour UI')\n .option('-y, --yes', 'Skip confirmation prompt')\n .action(async (options) => {\n try {\n const cwd = process.cwd()\n \n console.log()\n console.log(chalk.bold('Initializing HomeOnTour UI...'))\n console.log()\n\n // Check if package.json exists\n const packageJsonPath = path.join(cwd, 'package.json')\n if (!fs.existsSync(packageJsonPath)) {\n console.error(chalk.red('Error: No package.json found. Please run this in a project directory.'))\n process.exit(1)\n }\n\n // Check for required dependencies\n const requiredDeps = [\n 'class-variance-authority',\n 'clsx',\n 'tailwind-merge',\n 'lucide-react',\n ]\n\n const spinner = ora('Checking dependencies...').start()\n \n const packageJson = await fs.readJson(packageJsonPath)\n const installedDeps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n }\n\n const missingDeps = requiredDeps.filter((dep) => !installedDeps[dep])\n\n if (missingDeps.length > 0) {\n spinner.info('Installing required dependencies...')\n \n try {\n await execa('pnpm', ['add', ...missingDeps], { cwd })\n spinner.succeed('Dependencies installed')\n } catch (error) {\n spinner.fail('Failed to install dependencies')\n console.log(chalk.yellow(`\\nPlease install manually:`))\n console.log(chalk.cyan(`pnpm add ${missingDeps.join(' ')}`))\n }\n } else {\n spinner.succeed('All dependencies are installed')\n }\n\n // Check for utils file\n const utilsPath = path.join(cwd, 'lib', 'utils.ts')\n const srcUtilsPath = path.join(cwd, 'src', 'lib', 'utils.ts')\n const utilsExists = fs.existsSync(utilsPath) || fs.existsSync(srcUtilsPath)\n\n if (!utilsExists) {\n const { createUtils } = await prompts({\n type: 'confirm',\n name: 'createUtils',\n message: 'Create lib/utils.ts with cn helper?',\n initial: true,\n })\n\n if (createUtils) {\n const targetUtilsPath = fs.existsSync(path.join(cwd, 'src')) ? srcUtilsPath : utilsPath\n \n await fs.ensureDir(path.dirname(targetUtilsPath))\n await fs.writeFile(\n targetUtilsPath,\n `import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n`,\n 'utf-8'\n )\n console.log(chalk.green('✓ Created lib/utils.ts'))\n }\n }\n\n // Create components directory\n const componentsDir = path.join(cwd, 'components', 'homeontour-ui')\n await fs.ensureDir(componentsDir)\n console.log(chalk.green('✓ Created components/homeontour-ui directory'))\n\n console.log()\n console.log(chalk.green('✓ Initialization complete!'))\n console.log()\n console.log('You can now add components:')\n console.log(chalk.cyan(' pnpm dlx homeontour-ui@latest add logo-svg'))\n console.log()\n } catch (error) {\n console.error(chalk.red('Error:'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n","import { Command } from 'commander'\nimport chalk from 'chalk'\nimport ora from 'ora'\nimport fs from 'fs-extra'\nimport path from 'path'\n\n// Convert kebab-case to PascalCase\nfunction toPascalCase(str: string): string {\n return str\n .split('-')\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join('')\n}\n\n// Convert kebab-case to camelCase\nfunction toCamelCase(str: string): string {\n const pascal = toPascalCase(str)\n return pascal.charAt(0).toLowerCase() + pascal.slice(1)\n}\n\n// Generate component TSX content\nfunction generateComponentContent(componentName: string, componentPascal: string): string {\n return `import * as React from \"react\"\nimport { cn } from \"@/lib/utils\"\n\nexport interface ${componentPascal}Props extends React.HTMLAttributes<HTMLDivElement> {\n // Add your custom props here\n}\n\nexport const ${componentPascal} = React.forwardRef<HTMLDivElement, ${componentPascal}Props>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"\", className)}\n {...props}\n />\n )\n }\n)\n${componentPascal}.displayName = \"${componentPascal}\"\n\nexport default ${componentPascal}\n`\n}\n\n// Generate metadata content\nfunction generateMetadataContent(componentName: string, componentPascal: string): string {\n return `import { ComponentMetadata } from \"@/lib/component-metadata\"\n\nexport const metadata: ComponentMetadata = {\n name: \"${componentName}\",\n type: \"components:ui\",\n description: \"${componentPascal} component.\",\n category: \"UI Components\",\n registryDependencies: [],\n examples: [\n {\n name: \"Default\",\n description: \"Default ${componentPascal} component\",\n code: \\`<${componentPascal} />\\`,\n previewProps: {},\n },\n ],\n}\n`\n}\n\n// Update metadata registry\nasync function updateMetadataRegistry(\n projectRoot: string,\n componentName: string,\n componentPascal: string\n) {\n const metadataRegistryPath = path.join(projectRoot, 'src/lib/metadata-registry.ts')\n \n if (!fs.existsSync(metadataRegistryPath)) {\n throw new Error('metadata-registry.ts not found')\n }\n\n let lines = (await fs.readFile(metadataRegistryPath, 'utf-8')).split('\\n')\n const importName = `${toCamelCase(componentName)}Metadata`\n const importStatement = `import { metadata as ${importName} } from \"@/components/registry/${componentName}.metadata\"`\n \n // Check if import already exists\n if (lines.some(line => line.includes(importStatement))) {\n throw new Error('Import already exists')\n }\n \n // Find the last import line and insert after it\n let lastImportIndex = -1\n for (let i = 0; i < lines.length; i++) {\n if (lines[i].trim().startsWith('import ') && lines[i].includes('from')) {\n lastImportIndex = i\n }\n }\n \n if (lastImportIndex >= 0) {\n lines.splice(lastImportIndex + 1, 0, importStatement)\n }\n \n // Add to registry object - find the registry object and insert before closing brace\n const registryEntry = ` \"${componentName}\": ${importName},`\n let inRegistryObject = false\n let lastRegistryEntryIndex = -1\n \n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]\n \n if (line.includes('export const metadataRegistry')) {\n inRegistryObject = true\n continue\n }\n \n if (inRegistryObject) {\n // Check if this is a registry entry (contains \": metadata\" or similar)\n if (line.trim().match(/^\"[^\"]+\":\\s+\\w+Metadata,?$/)) {\n lastRegistryEntryIndex = i\n }\n \n // Check if we've reached the closing brace\n if (line.trim() === '}') {\n // Insert before this closing brace\n if (lastRegistryEntryIndex >= 0) {\n lines.splice(lastRegistryEntryIndex + 1, 0, registryEntry)\n } else {\n // No entries found, insert right after opening brace\n // Find the opening brace line\n for (let j = i - 1; j >= 0; j--) {\n if (lines[j].includes('metadataRegistry') && lines[j].includes('{')) {\n lines.splice(j + 1, 0, registryEntry)\n break\n }\n }\n }\n break\n }\n }\n }\n \n await fs.writeFile(metadataRegistryPath, lines.join('\\n'), 'utf-8')\n}\n\nexport const generateCommand = new Command()\n .name('generate')\n .alias('gen')\n .description('Generate boilerplate for a new component')\n .argument('<name>', 'Component name in kebab-case (e.g., my-component)')\n .action(async (name: string) => {\n try {\n const cwd = process.cwd()\n \n // Validate component name (kebab-case)\n if (!/^[a-z][a-z0-9-]*$/.test(name)) {\n console.error(chalk.red('Error: Component name must be in kebab-case (e.g., my-component)'))\n process.exit(1)\n }\n\n const spinner = ora(`Generating ${name} component...`).start()\n\n // Check if we're in the project root (has src/components/registry directory)\n const registryDir = path.join(cwd, 'src/components/registry')\n if (!fs.existsSync(registryDir)) {\n spinner.fail('Error: src/components/registry directory not found')\n console.error(chalk.red('Are you in the correct project directory?'))\n process.exit(1)\n }\n\n const componentPascal = toPascalCase(name)\n const componentFile = path.join(registryDir, `${name}.tsx`)\n const metadataFile = path.join(registryDir, `${name}.metadata.ts`)\n\n // Check if component already exists\n if (fs.existsSync(componentFile) || fs.existsSync(metadataFile)) {\n spinner.warn(`${name} already exists`)\n console.log(chalk.yellow(`Component files already exist. Skipping generation.`))\n process.exit(0)\n }\n\n // Generate component file\n const componentContent = generateComponentContent(name, componentPascal)\n await fs.writeFile(componentFile, componentContent, 'utf-8')\n spinner.succeed(`Created ${name}.tsx`)\n\n // Generate metadata file\n const metadataContent = generateMetadataContent(name, componentPascal)\n await fs.writeFile(metadataFile, metadataContent, 'utf-8')\n spinner.succeed(`Created ${name}.metadata.ts`)\n\n // Update metadata registry\n spinner.start('Updating metadata registry...')\n try {\n await updateMetadataRegistry(cwd, name, componentPascal)\n spinner.succeed('Updated metadata registry')\n } catch (error) {\n spinner.warn('Could not automatically update metadata registry')\n console.log(chalk.yellow('\\nPlease manually add the following to src/lib/metadata-registry.ts:'))\n console.log(chalk.cyan(`import { metadata as ${toCamelCase(name)}Metadata } from \"@/components/registry/${name}.metadata\"`))\n console.log(chalk.cyan(` \"${name}\": ${toCamelCase(name)}Metadata,`))\n }\n\n console.log()\n console.log(chalk.green('✓ Component generated successfully!'))\n console.log()\n console.log('Next steps:')\n console.log(chalk.cyan(` 1. Edit src/components/registry/${name}.tsx`))\n console.log(chalk.cyan(` 2. Update src/components/registry/${name}.metadata.ts with examples and description`))\n console.log()\n } catch (error) {\n console.error(chalk.red('Error:'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n"],"mappings":";;;AAEA,SAAS,WAAAA,gBAAe;;;ACFxB,SAAS,eAAe;AACxB,OAAO,aAAa;AACpB,OAAO,WAAW;AAClB,OAAO,SAAS;AAChB,SAAS,aAAa;AACtB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,WAAW;AAElB,IAAM,eAAe;AAErB,SAAS,iBAAiB,KAAqB;AAC7C,QAAM,SAAS,KAAK,KAAK,KAAK,KAAK;AACnC,QAAM,UAAU,GAAG,WAAW,MAAM,IAAI,mBAAmB;AAC3D,SAAO,KAAK,KAAK,SAAS,eAAe;AAC3C;AAEO,IAAM,aAAa,IAAI,QAAQ,EACnC,KAAK,KAAK,EACV,YAAY,iCAAiC,EAC7C,SAAS,mBAAmB,uBAAuB,EACnD,OAAO,aAAa,0BAA0B,EAC9C,OAAO,mBAAmB,0BAA0B,EACpD,OAAO,OAAO,YAAsB,YAAY;AAC/C,MAAI;AACF,UAAM,MAAM,QAAQ,IAAI;AAGxB,UAAM,kBAAkB,KAAK,KAAK,KAAK,cAAc;AACrD,QAAI,CAAC,GAAG,WAAW,eAAe,GAAG;AACnC,cAAQ,MAAM,MAAM,IAAI,+DAA+D,CAAC;AACxF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAGA,QAAI,CAAC,cAAc,WAAW,WAAW,GAAG;AAC1C,YAAM,UAAU,IAAI,wBAAwB,EAAE,MAAM;AAEpD,UAAI;AACF,cAAM,WAAW,MAAM,MAAM,YAAY;AACzC,YAAI,CAAC,SAAS,IAAI;AAChB,gBAAM,IAAI,MAAM,4BAA4B;AAAA,QAC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AQ,IAAI;AAAA,EACd,SAAS,OAAO;AACd,YAAQ,MAAMA,OAAM,IAAI,QAAQ,GAAG,iBAAiB,QAAQ,MAAM,UAAU,KAAK;AACjF,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,CAAC;;;AH7MH,IAAM,UAAU,IAAII,SAAQ;AAE5B,QACG,KAAK,eAAe,EACpB,YAAY,8CAA8C,EAC1D,QAAQ,OAAO;AAElB,QAAQ,WAAW,UAAU;AAC7B,QAAQ,WAAW,WAAW;AAC9B,QAAQ,WAAW,eAAe;AAElC,QAAQ,MAAM;","names":["Command","Command","prompts","chalk","ora","execa","fs","path","Command","chalk","ora","fs","path","Command"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeontour-ui",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "CLI for adding HomeOnTour UI components to your project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -46,9 +46,5 @@
46
46
  ],
47
47
  "author": "HomeOnTour",
48
48
  "license": "MIT",
49
- "homepage": "https://ui.homeontour.com",
50
- "repository": {
51
- "type": "git",
52
- "url": "https://github.com/HomeOnTour/homeontour-ui"
53
- }
49
+ "homepage": "https://ui.homeontour.com"
54
50
  }