@the-grove/cli 0.1.5 → 0.1.7

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 +21 -0
  2. package/dist/index.js +12 -19
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -19,6 +19,27 @@ npx the-grove list
19
19
  npx the-grove contribute ./components/my-component.tsx
20
20
  ```
21
21
 
22
+ ## Shadcn Compatibility
23
+
24
+ the-grove registry is fully compatible with shadcn's CLI! You can use either:
25
+
26
+ **the-grove CLI** (recommended for ease of use):
27
+ ```bash
28
+ npx the-grove add async-button
29
+ ```
30
+
31
+ **shadcn CLI** (if you prefer):
32
+ ```bash
33
+ npx shadcn@latest add https://raw.githubusercontent.com/matthewnaples/the-grove/main/packages/registry/registry/core/async-button.json
34
+ ```
35
+
36
+ ### Why Use the-grove CLI?
37
+
38
+ - Automatic component discovery (no need to know category)
39
+ - Stack detection (warns about missing Convex/Clerk dependencies)
40
+ - Browse components with `the-grove list`
41
+ - Same reliable installation (uses shadcn under the hood)
42
+
22
43
  ## Commands
23
44
 
24
45
  ### add
package/dist/index.js CHANGED
@@ -9,7 +9,6 @@ import ora from "ora";
9
9
  import chalk from "chalk";
10
10
  import prompts from "prompts";
11
11
  import fs from "fs-extra";
12
- import path from "path";
13
12
  var REGISTRY_BASE_URL = "https://raw.githubusercontent.com/matthewnaples/the-grove/main/packages/registry/registry";
14
13
  async function add(components, options) {
15
14
  if (!components || components.length === 0) {
@@ -44,7 +43,15 @@ async function add(components, options) {
44
43
  }
45
44
  spinner.start(`Adding ${componentName}...`);
46
45
  }
47
- await installComponent(registryEntry, options.path || "components/ui");
46
+ spinner.text = `Installing ${componentName} via shadcn...`;
47
+ const args = ["shadcn@latest", "add", registryUrl];
48
+ if (options.yes) {
49
+ args.push("--yes");
50
+ }
51
+ if (options.path) {
52
+ args.push("--path", options.path);
53
+ }
54
+ await execa("npx", args, { stdio: "inherit" });
48
55
  spinner.succeed(`Added ${componentName}`);
49
56
  }
50
57
  console.log(chalk.green("\n\u2705 All components added successfully!"));
@@ -109,25 +116,11 @@ async function checkDependencies(registryEntry, stack) {
109
116
  }
110
117
  return missing;
111
118
  }
112
- async function installComponent(registryEntry, targetPath) {
113
- const cwd = process.cwd();
114
- if (registryEntry.dependencies && registryEntry.dependencies.length > 0) {
115
- console.log(chalk.gray(`Installing dependencies: ${registryEntry.dependencies.join(", ")}`));
116
- await execa("npm", ["install", ...registryEntry.dependencies], { cwd, stdio: "inherit" });
117
- }
118
- for (const file of registryEntry.files) {
119
- const filePath = path.join(cwd, file.path);
120
- const dir = path.dirname(filePath);
121
- await fs.ensureDir(dir);
122
- await fs.writeFile(filePath, file.content, "utf-8");
123
- console.log(chalk.gray(` Created ${path.relative(cwd, filePath)}`));
124
- }
125
- }
126
119
 
127
120
  // src/commands/contribute.ts
128
121
  import { Octokit } from "@octokit/rest";
129
122
  import fs2 from "fs-extra";
130
- import path2 from "path";
123
+ import path from "path";
131
124
  import prompts2 from "prompts";
132
125
  import ora2 from "ora";
133
126
  import chalk2 from "chalk";
@@ -147,7 +140,7 @@ async function contribute(filePaths) {
147
140
  files.push({
148
141
  localPath: fp,
149
142
  content: await fs2.readFile(fp, "utf-8"),
150
- componentName: path2.basename(fp, path2.extname(fp))
143
+ componentName: path.basename(fp, path.extname(fp))
151
144
  });
152
145
  }
153
146
  const answers = await prompts2([
@@ -232,7 +225,7 @@ async function contribute(filePaths) {
232
225
  }
233
226
  function mapLocalPathToTemplate(localPath) {
234
227
  const normalized = localPath.replace(/^\.\//, "").replace(/components\/ui\//, "components/").replace(/components\//, "");
235
- const name = path2.basename(normalized, path2.extname(normalized));
228
+ const name = path.basename(normalized, path.extname(normalized));
236
229
  return `packages/components/src/core/${name}/index.tsx`;
237
230
  }
238
231
  async function promptForToken() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-grove/cli",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "description": "CLI for the-grove component library",
6
6
  "bin": {