Skip to content

Commit d481aef

Browse files
author
phernandez
committed
chore: update docs for installing, using cli
1 parent a1632d8 commit d481aef

File tree

3 files changed

+66
-21
lines changed

3 files changed

+66
-21
lines changed

docs/content/docs/cli.md

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,9 @@ description: Adding components to your project
77

88
Be sure you have read the [installation](/docs/installation) docs and set up your project first.
99

10-
## Copy/Paste
11-
12-
Code for components can be copy/pasted directly from the example pages via the `Code` tabs. You can install components
13-
anywhere in you project. The rest of the information in these docs assume they are located in the `components/ui` dir in
14-
your project. See the [JinjaX](/docs/utilities#jinjax) docs for more info.
15-
1610
## Vendoring Components
1711

18-
The components in this project can also be copied (vendored) directly into your project using the `components` tool
12+
The components in this project can be copied (vendored) directly into your project using the `components` tool
1913
in the `basic-components` package via `uv`. You can then customize them as needed. This is the recommendedd way to
2014
install components because it will also include any dependencies (other referenced components) required.
2115

@@ -82,4 +76,38 @@ uvx --from basic-components add button --repo-url https://github.com/basicmachin
8276
The `repo-url` arg can also point to a local directory if you have the project checked out. You can also pass the components
8377
destination directory via the `components-dir` arg.
8478

79+
## Copy/Paste
80+
81+
Code for components can also be copy/pasted directly from the example pages via the `Code` tabs. You can install components
82+
anywhere in you project. The rest of the information in these docs assume they are located in the `components/ui` dir in
83+
your project. See the [JinjaX](/docs/utilities#jinjax) docs for more info on how to set up components in your project.
84+
85+
## Other tools
86+
87+
If you don't want to use `uv`, then you can also use the `components` cli by installing it using `pip` or `poetry`. This
88+
will only install the libs needed for the cli, not the components.
89+
90+
### Pip
91+
```bash
92+
pip install "basic-components[cli]"
93+
```
94+
95+
To use the `components` tool, you can run
96+
97+
```bash
98+
pipx run components add <component>
99+
```
100+
101+
### Poetry
102+
```bash
103+
poetry add "basic-components[cli]"
104+
```
105+
106+
To use the `components` tool, you can run
107+
108+
```bash
109+
poetry run components add <component>
110+
```
111+
112+
85113
</Prose>

docs/content/docs/installation.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,39 @@ You can install `basic-components` utilities into your project using your packag
2121
Installing the basic-components package is **optional**.
2222

2323
```bash
24-
uv add basic-components[utils]
24+
uv add "basic-components[utils]"
2525
```
2626
This will only add the python functions in the [utils](https://github.com/basicmachines-co/basic-components/tree/main/basic_components)
2727
directory of the project. Components should be added via the [cli](/docs/cli).
2828

29+
<Card>
30+
<CardTitle className="mt-4 ml-6 text-sm">
31+
Note
32+
</CardTitle>
33+
<CardDescription className="my-2 ml-6">
34+
Using `uv` is optional
35+
</CardDescription>
36+
<CardContent className="text-sm">
37+
You can use `pip` or `poetry`. [UV](https://docs.astral.sh/uv/) is
38+
used in these examples because it enables components to be vendored directly into your project via the [components](/docs/cli) cli.</CardContent>
39+
</Card>
2940

30-
**Note**:
31-
32-
Using `uv` is also optional. You can also use install via `pip` or `poetry`. [UV](https://docs.astral.sh/uv/) is
33-
used in these examples because it enables componets to be vendored directly into your project via the [components](/docs/cli) cli.
3441

3542
You can also add the code for the [helper functions](/docs/utilities) directly to your codebase if you don't want to add an
3643
extra dependency.
3744

38-
**Be sure to**:
45+
<Alert variant="destructive">
46+
<CircleAlertIcon className="mr-2 h-4 w-4"/>
47+
<AlertTitle>You must</AlertTitle>
48+
<AlertDescription>
49+
50+
- You must configure the `jinjax.Catalog` to load components from the directories under your `components` dir.
3951

40-
- add the `cn` global function so it is available to all Jinja templates
41-
- configure the `jinjax.Catalog` to load components from the directories under your `components` dir.
52+
- Add the `cn` global function so it is available to all Jinja templates.
53+
</AlertDescription>
54+
</Alert>
4255

43-
You can also refer to the examples for [FastAPI](/docs/fastapi), [Django](/docs/django), or [Flask](/docs/flask).
56+
You can refer to the examples for [FastAPI](/docs/fastapi), [Django](/docs/django), or [Flask](/docs/flask).
4457

4558
## Tailwind CSS
4659

pyproject.toml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,18 @@ classifiers = [
4444
"Typing :: Typed",
4545
]
4646

47-
# Core dependencies needed for CLI
48-
dependencies = [
47+
# Empty base dependencies since everything is optional
48+
dependencies = []
49+
50+
[project.optional-dependencies]
51+
52+
# CLI tool dependencies
53+
cli = [
4954
"copier>=9.4.1",
5055
"typer>=0.9.0",
5156
"rich>=13.7.0",
5257
]
5358

54-
[project.optional-dependencies]
55-
5659
# For using the utility functions in basic_components/utils
5760
utils = [
5861
"jinjax>=0.47",
@@ -96,6 +99,7 @@ dev = [
9699

97100
# Full install with all features
98101
full = [
102+
"basic-components[cli]",
99103
"basic-components[utils]",
100104
"basic-components[docs]",
101105
"basic-components[dev]",
@@ -133,4 +137,4 @@ style = "default"
133137
[tool.pytest.ini_options]
134138
testpaths = ["tests"]
135139
python_files = ["test_*.py"]
136-
addopts = "-ra -q"
140+
addopts = "-ra -q"

0 commit comments

Comments
 (0)