homeontour-ui 0.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.
- package/README.md +78 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +233 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# HomeOnTour UI CLI
|
|
2
|
+
|
|
3
|
+
Add components from HomeOnTour UI to your project via CLI.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
### Initialize your project
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm dlx homeontour-ui@latest init
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This will:
|
|
14
|
+
- Install required dependencies
|
|
15
|
+
- Create the `lib/utils.ts` file
|
|
16
|
+
- Set up the components directory
|
|
17
|
+
|
|
18
|
+
### Add components
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pnpm dlx homeontour-ui@latest add logo-svg
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Add multiple components:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pnpm dlx homeontour-ui@latest add logo-svg dev-mode-bar
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Interactive selection:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pnpm dlx homeontour-ui@latest add
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Options
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pnpm dlx homeontour-ui@latest add logo-svg --yes
|
|
40
|
+
pnpm dlx homeontour-ui@latest add logo-svg --overwrite
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## How it works
|
|
44
|
+
|
|
45
|
+
The CLI:
|
|
46
|
+
1. Fetches component code from the registry API
|
|
47
|
+
2. Installs required npm dependencies
|
|
48
|
+
3. Installs shadcn/ui dependencies (if needed)
|
|
49
|
+
4. Saves components to `components/homeontour-ui/`
|
|
50
|
+
|
|
51
|
+
## Development
|
|
52
|
+
|
|
53
|
+
Build the CLI:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
cd cli
|
|
57
|
+
pnpm install
|
|
58
|
+
pnpm build
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Test locally:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
node dist/index.js init
|
|
65
|
+
node dist/index.js add logo-svg
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Publishing
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
cd cli
|
|
72
|
+
pnpm build
|
|
73
|
+
npm publish
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { Command as Command3 } from "commander";
|
|
5
|
+
|
|
6
|
+
// src/commands/add.ts
|
|
7
|
+
import { Command } from "commander";
|
|
8
|
+
import prompts from "prompts";
|
|
9
|
+
import chalk from "chalk";
|
|
10
|
+
import ora from "ora";
|
|
11
|
+
import { execa } from "execa";
|
|
12
|
+
import fs from "fs-extra";
|
|
13
|
+
import path from "path";
|
|
14
|
+
import fetch from "node-fetch";
|
|
15
|
+
var REGISTRY_URL = process.env.REGISTRY_URL || "http://localhost:3000/api/registry";
|
|
16
|
+
var COMPONENTS_DIR = "components/homeontour-ui";
|
|
17
|
+
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
|
+
try {
|
|
19
|
+
const cwd = process.cwd();
|
|
20
|
+
const packageJsonPath = path.join(cwd, "package.json");
|
|
21
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
22
|
+
console.error(chalk.red("Error: No package.json found. Are you in a project directory?"));
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
if (!components || components.length === 0) {
|
|
26
|
+
const spinner = ora("Fetching components...").start();
|
|
27
|
+
try {
|
|
28
|
+
const response = await fetch(REGISTRY_URL);
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
throw new Error("Failed to fetch components");
|
|
31
|
+
}
|
|
32
|
+
const allComponents = await response.json();
|
|
33
|
+
spinner.succeed("Fetched available components");
|
|
34
|
+
const { selectedComponents } = await prompts({
|
|
35
|
+
type: "multiselect",
|
|
36
|
+
name: "selectedComponents",
|
|
37
|
+
message: "Which components would you like to add?",
|
|
38
|
+
choices: allComponents.map((c) => ({
|
|
39
|
+
title: `${c.name} - ${c.description}`,
|
|
40
|
+
value: c.name
|
|
41
|
+
})),
|
|
42
|
+
min: 1
|
|
43
|
+
});
|
|
44
|
+
if (!selectedComponents || selectedComponents.length === 0) {
|
|
45
|
+
console.log(chalk.yellow("No components selected. Exiting."));
|
|
46
|
+
process.exit(0);
|
|
47
|
+
}
|
|
48
|
+
components = selectedComponents;
|
|
49
|
+
} catch (error) {
|
|
50
|
+
spinner.fail("Failed to fetch components");
|
|
51
|
+
console.error(chalk.red("Error: Could not connect to registry. Is the server running?"));
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
for (const componentName of components) {
|
|
56
|
+
await addComponent(componentName, { cwd, ...options });
|
|
57
|
+
}
|
|
58
|
+
console.log();
|
|
59
|
+
console.log(chalk.green("\u2713 Done! Components added successfully."));
|
|
60
|
+
console.log();
|
|
61
|
+
console.log("Import and use them in your project:");
|
|
62
|
+
console.log(chalk.cyan(`import { LogoSvg } from '@/components/homeontour-ui/logo-svg'`));
|
|
63
|
+
} catch (error) {
|
|
64
|
+
console.error(chalk.red("Error:"), error instanceof Error ? error.message : error);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
async function addComponent(componentName, options) {
|
|
69
|
+
const spinner = ora(`Adding ${componentName}...`).start();
|
|
70
|
+
try {
|
|
71
|
+
const response = await fetch(`${REGISTRY_URL}/${componentName}`);
|
|
72
|
+
if (!response.ok) {
|
|
73
|
+
throw new Error(`Component "${componentName}" not found in registry`);
|
|
74
|
+
}
|
|
75
|
+
const component = await response.json();
|
|
76
|
+
const componentDir = path.join(options.cwd, COMPONENTS_DIR);
|
|
77
|
+
const componentPath = path.join(componentDir, component.files[0].name);
|
|
78
|
+
if (fs.existsSync(componentPath) && !options.overwrite) {
|
|
79
|
+
spinner.warn(`${componentName} already exists`);
|
|
80
|
+
if (!options.yes) {
|
|
81
|
+
const { overwrite } = await prompts({
|
|
82
|
+
type: "confirm",
|
|
83
|
+
name: "overwrite",
|
|
84
|
+
message: `Overwrite existing ${componentName}?`,
|
|
85
|
+
initial: false
|
|
86
|
+
});
|
|
87
|
+
if (!overwrite) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (component.dependencies && component.dependencies.length > 0) {
|
|
95
|
+
spinner.text = `Installing dependencies for ${componentName}...`;
|
|
96
|
+
const deps = component.dependencies.map((d) => `${d.name}@${d.version}`).join(" ");
|
|
97
|
+
try {
|
|
98
|
+
await execa("pnpm", ["add", ...deps.split(" ")], {
|
|
99
|
+
cwd: options.cwd
|
|
100
|
+
});
|
|
101
|
+
} catch (error) {
|
|
102
|
+
try {
|
|
103
|
+
await execa("npm", ["install", ...deps.split(" ")], {
|
|
104
|
+
cwd: options.cwd
|
|
105
|
+
});
|
|
106
|
+
} catch (npmError) {
|
|
107
|
+
spinner.warn(`Could not install dependencies automatically`);
|
|
108
|
+
console.log(chalk.yellow(`
|
|
109
|
+
Please install manually: pnpm add ${deps}`));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (component.registryDependencies && component.registryDependencies.length > 0) {
|
|
114
|
+
spinner.text = `Installing shadcn/ui components...`;
|
|
115
|
+
const shadcnDeps = component.registryDependencies.join(" ");
|
|
116
|
+
try {
|
|
117
|
+
await execa("pnpm", ["dlx", "shadcn@latest", "add", ...shadcnDeps.split(" "), "-y"], {
|
|
118
|
+
cwd: options.cwd
|
|
119
|
+
});
|
|
120
|
+
} catch (error) {
|
|
121
|
+
spinner.warn(`Could not install shadcn/ui components automatically`);
|
|
122
|
+
console.log(chalk.yellow(`
|
|
123
|
+
Please install manually: pnpm dlx shadcn@latest add ${shadcnDeps}`));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
spinner.text = `Creating ${componentName} files...`;
|
|
127
|
+
await fs.ensureDir(componentDir);
|
|
128
|
+
for (const file of component.files) {
|
|
129
|
+
const filePath = path.join(componentDir, file.name);
|
|
130
|
+
await fs.writeFile(filePath, file.content, "utf-8");
|
|
131
|
+
}
|
|
132
|
+
spinner.succeed(`Added ${componentName}`);
|
|
133
|
+
} catch (error) {
|
|
134
|
+
spinner.fail(`Failed to add ${componentName}`);
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// src/commands/init.ts
|
|
140
|
+
import { Command as Command2 } from "commander";
|
|
141
|
+
import prompts2 from "prompts";
|
|
142
|
+
import chalk2 from "chalk";
|
|
143
|
+
import ora2 from "ora";
|
|
144
|
+
import { execa as execa2 } from "execa";
|
|
145
|
+
import fs2 from "fs-extra";
|
|
146
|
+
import path2 from "path";
|
|
147
|
+
var initCommand = new Command2().name("init").description("Initialize your project for HomeOnTour UI").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
|
|
148
|
+
try {
|
|
149
|
+
const cwd = process.cwd();
|
|
150
|
+
console.log();
|
|
151
|
+
console.log(chalk2.bold("Initializing HomeOnTour UI..."));
|
|
152
|
+
console.log();
|
|
153
|
+
const packageJsonPath = path2.join(cwd, "package.json");
|
|
154
|
+
if (!fs2.existsSync(packageJsonPath)) {
|
|
155
|
+
console.error(chalk2.red("Error: No package.json found. Please run this in a project directory."));
|
|
156
|
+
process.exit(1);
|
|
157
|
+
}
|
|
158
|
+
const requiredDeps = [
|
|
159
|
+
"class-variance-authority",
|
|
160
|
+
"clsx",
|
|
161
|
+
"tailwind-merge",
|
|
162
|
+
"lucide-react"
|
|
163
|
+
];
|
|
164
|
+
const spinner = ora2("Checking dependencies...").start();
|
|
165
|
+
const packageJson = await fs2.readJson(packageJsonPath);
|
|
166
|
+
const installedDeps = {
|
|
167
|
+
...packageJson.dependencies,
|
|
168
|
+
...packageJson.devDependencies
|
|
169
|
+
};
|
|
170
|
+
const missingDeps = requiredDeps.filter((dep) => !installedDeps[dep]);
|
|
171
|
+
if (missingDeps.length > 0) {
|
|
172
|
+
spinner.info("Installing required dependencies...");
|
|
173
|
+
try {
|
|
174
|
+
await execa2("pnpm", ["add", ...missingDeps], { cwd });
|
|
175
|
+
spinner.succeed("Dependencies installed");
|
|
176
|
+
} catch (error) {
|
|
177
|
+
spinner.fail("Failed to install dependencies");
|
|
178
|
+
console.log(chalk2.yellow(`
|
|
179
|
+
Please install manually:`));
|
|
180
|
+
console.log(chalk2.cyan(`pnpm add ${missingDeps.join(" ")}`));
|
|
181
|
+
}
|
|
182
|
+
} else {
|
|
183
|
+
spinner.succeed("All dependencies are installed");
|
|
184
|
+
}
|
|
185
|
+
const utilsPath = path2.join(cwd, "lib", "utils.ts");
|
|
186
|
+
const srcUtilsPath = path2.join(cwd, "src", "lib", "utils.ts");
|
|
187
|
+
const utilsExists = fs2.existsSync(utilsPath) || fs2.existsSync(srcUtilsPath);
|
|
188
|
+
if (!utilsExists) {
|
|
189
|
+
const { createUtils } = await prompts2({
|
|
190
|
+
type: "confirm",
|
|
191
|
+
name: "createUtils",
|
|
192
|
+
message: "Create lib/utils.ts with cn helper?",
|
|
193
|
+
initial: true
|
|
194
|
+
});
|
|
195
|
+
if (createUtils) {
|
|
196
|
+
const targetUtilsPath = fs2.existsSync(path2.join(cwd, "src")) ? srcUtilsPath : utilsPath;
|
|
197
|
+
await fs2.ensureDir(path2.dirname(targetUtilsPath));
|
|
198
|
+
await fs2.writeFile(
|
|
199
|
+
targetUtilsPath,
|
|
200
|
+
`import { clsx, type ClassValue } from "clsx"
|
|
201
|
+
import { twMerge } from "tailwind-merge"
|
|
202
|
+
|
|
203
|
+
export function cn(...inputs: ClassValue[]) {
|
|
204
|
+
return twMerge(clsx(inputs))
|
|
205
|
+
}
|
|
206
|
+
`,
|
|
207
|
+
"utf-8"
|
|
208
|
+
);
|
|
209
|
+
console.log(chalk2.green("\u2713 Created lib/utils.ts"));
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
const componentsDir = path2.join(cwd, "components", "homeontour-ui");
|
|
213
|
+
await fs2.ensureDir(componentsDir);
|
|
214
|
+
console.log(chalk2.green("\u2713 Created components/homeontour-ui directory"));
|
|
215
|
+
console.log();
|
|
216
|
+
console.log(chalk2.green("\u2713 Initialization complete!"));
|
|
217
|
+
console.log();
|
|
218
|
+
console.log("You can now add components:");
|
|
219
|
+
console.log(chalk2.cyan(" pnpm dlx homeontour-ui@latest add logo-svg"));
|
|
220
|
+
console.log();
|
|
221
|
+
} catch (error) {
|
|
222
|
+
console.error(chalk2.red("Error:"), error instanceof Error ? error.message : error);
|
|
223
|
+
process.exit(1);
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
// src/index.ts
|
|
228
|
+
var program = new Command3();
|
|
229
|
+
program.name("homeontour-ui").description("Add HomeOnTour UI components to your project").version("0.1.0");
|
|
230
|
+
program.addCommand(addCommand);
|
|
231
|
+
program.addCommand(initCommand);
|
|
232
|
+
program.parse();
|
|
233
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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 = process.env.REGISTRY_URL || 'http://localhost:3000/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 (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,QAAQ,IAAI,gBAAgB;AACjD,IAAM,iBAAiB;AAEhB,IAAM,aAAa,IAAI,QAAQ,EACnC,KAAK,KAAK,EACV,YAAY,iCAAiC,EAC7C,SAAS,mB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CAA8C,EAC1D,QAAQ,OAAO;AAElB,QAAQ,WAAW,UAAU;AAC7B,QAAQ,WAAW,WAAW;AAE9B,QAAQ,MAAM;","names":["Command","Command","prompts","chalk","ora","execa","fs","path","Command"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "homeontour-ui",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CLI for adding HomeOnTour UI components to your project",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"homeontour-ui": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsup",
|
|
14
|
+
"dev": "tsup --watch",
|
|
15
|
+
"typecheck": "tsc --noEmit"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"commander": "^11.1.0",
|
|
19
|
+
"prompts": "^2.4.2",
|
|
20
|
+
"chalk": "^5.3.0",
|
|
21
|
+
"ora": "^8.0.1",
|
|
22
|
+
"execa": "^8.0.1",
|
|
23
|
+
"fs-extra": "^11.2.0",
|
|
24
|
+
"node-fetch": "^3.3.2"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/fs-extra": "^11.0.4",
|
|
28
|
+
"@types/node": "^20.11.0",
|
|
29
|
+
"@types/prompts": "^2.4.9",
|
|
30
|
+
"tsup": "^8.0.1",
|
|
31
|
+
"typescript": "^5.3.3"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"cli",
|
|
35
|
+
"components",
|
|
36
|
+
"ui",
|
|
37
|
+
"react",
|
|
38
|
+
"nextjs",
|
|
39
|
+
"tailwindcss"
|
|
40
|
+
],
|
|
41
|
+
"author": "HomeOnTour",
|
|
42
|
+
"license": "MIT"
|
|
43
|
+
}
|