centoui-cli 1.0.0-alpha.29 → 1.0.0-alpha.30
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 +87 -16
- package/dist/index.mjs +1 -1
- package/package.json +8 -1
package/README.md
CHANGED
|
@@ -1,32 +1,91 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>centoui-cli</h1>
|
|
3
|
+
<p><strong>Manage CentoUI components from the terminal.</strong></p>
|
|
4
|
+
<p>
|
|
5
|
+
<a href="https://npmx.dev/package/centoui-cli"><img src="https://img.shields.io/npm/v/centoui-cli.svg?style=plastic&label=NPM Version&color=blue" alt="npm version"></a>
|
|
6
|
+
<a href="https://npmx.dev/package/centoui-cli"><img src="https://img.shields.io/npm/dw/centoui-cli.svg?style=plastic&label=NPM Downloads&color=blue" alt="npm downloads"></a>
|
|
7
|
+
<a href="https://npmx.dev/package/centoui-cli"><img src="https://img.shields.io/npm/unpacked-size/centoui-cli?style=plastic&label=NPM Unpacked Size&color=blue" alt="NPM Unpacked Size"></a>
|
|
8
|
+
</p>
|
|
9
|
+
</div>
|
|
2
10
|
|
|
3
|
-
|
|
4
|
-
[](https://npmx.dev/package/centoui-cli)
|
|
5
|
-
[](https://npmx.dev/package/centoui-cli)
|
|
11
|
+
<br>
|
|
6
12
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
`centoui-cli` is the official command-line interface for [CentoUI](../core). It allows you to initialize CentoUI in your project, add new components, and manage their versions directly from your terminal.
|
|
13
|
+
`centoui-cli` is the command-line interface for [CentoUI](../core). It initializes projects, pulls component source files from the registry into your codebase, resolves dependency trees automatically, and cleans up when you remove components.
|
|
10
14
|
|
|
11
15
|
## Commands
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
- **`add [component]`**: Add specific components to your project. Peer dependencies install automatically.
|
|
15
|
-
- **`remove [component]`**: Cleanly remove components and their dependencies.
|
|
17
|
+
### `centoui init`
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
Scaffolds a new CentoUI project in your current directory.
|
|
18
20
|
|
|
19
21
|
```bash
|
|
20
|
-
# Initialize CentoUI in your project
|
|
21
22
|
pnpm dlx centoui init
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**What it does:**
|
|
26
|
+
|
|
27
|
+
1. Prompts you for a component directory (default: `src/components/centoui`) and theme CSS path (default: `src/assets/css/centoui.css`).
|
|
28
|
+
2. Writes `centoui.config.ts` with your chosen paths and default icon mappings.
|
|
29
|
+
3. Fetches and writes the `centoui.css` theme file with all light/dark color tokens.
|
|
30
|
+
4. Creates the component directory.
|
|
31
|
+
5. Installs global peer dependencies (`vue`, `reka-ui`, `tailwindcss`, etc.).
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
### `centoui add <component> [component...]`
|
|
36
|
+
|
|
37
|
+
Adds one or more components to your project.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm dlx centoui add button accordion select
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**What it does:**
|
|
44
|
+
|
|
45
|
+
1. Fetches the component registry from GitHub.
|
|
46
|
+
2. Resolves the full dependency tree — if `select` depends on `popover`, both are installed.
|
|
47
|
+
3. Asks before overwriting any component that already exists.
|
|
48
|
+
4. Downloads `.vue` and `index.ts` files for each component into your configured directory.
|
|
49
|
+
5. Installs any npm packages required by the added components.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
### `centoui remove <component>`
|
|
54
|
+
|
|
55
|
+
Removes an installed component and cleans up orphaned packages.
|
|
22
56
|
|
|
23
|
-
|
|
24
|
-
pnpm dlx centoui
|
|
57
|
+
```bash
|
|
58
|
+
pnpm dlx centoui remove accordion
|
|
25
59
|
```
|
|
26
60
|
|
|
61
|
+
**What it does:**
|
|
62
|
+
|
|
63
|
+
1. Checks that the component is actually installed.
|
|
64
|
+
2. Blocks removal if other installed components depend on it (e.g., you can't remove `popover` while `select` is installed).
|
|
65
|
+
3. Deletes the component's directory.
|
|
66
|
+
4. Uninstalls npm packages that are no longer needed by any remaining component.
|
|
67
|
+
|
|
68
|
+
## Version-Locked Asset Fetching
|
|
69
|
+
|
|
70
|
+
Every network request the CLI makes — the registry index, individual component files, the theme CSS, and the default config — is resolved against the **exact git tag that matches the installed version of `centoui-cli`**.
|
|
71
|
+
|
|
72
|
+
The base URL for all assets is derived directly from the CLI's own `package.json` version at build time:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
https://raw.githubusercontent.com/favorodera/centoui/refs/tags/v<VERSION>/packages/core/src
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
This means:
|
|
79
|
+
|
|
80
|
+
- If you have `centoui-cli@1.2.3` installed, all fetched assets come from the `v1.2.3` tag of the `centoui` repository — never from `main` or any other release.
|
|
81
|
+
- The registry, component source files, CSS theme, and config defaults are always in sync with each other and with the CLI you are running.
|
|
82
|
+
- Upgrading the CLI upgrades the version tag automatically — no separate step needed.
|
|
83
|
+
|
|
84
|
+
This design eliminates an entire class of version mismatch bugs where the CLI and the component source could drift out of sync.
|
|
85
|
+
|
|
27
86
|
## Configuration
|
|
28
87
|
|
|
29
|
-
|
|
88
|
+
After running `centoui init`, your project root will contain a `centoui.config.ts`:
|
|
30
89
|
|
|
31
90
|
```ts
|
|
32
91
|
import { defineConfig } from "centoui"
|
|
@@ -37,7 +96,19 @@ export default defineConfig({
|
|
|
37
96
|
icons: {
|
|
38
97
|
check: "lucide:check",
|
|
39
98
|
close: "lucide:x",
|
|
40
|
-
|
|
99
|
+
chevronDown: "lucide:chevron-down",
|
|
100
|
+
chevronUp: "lucide:chevron-up",
|
|
101
|
+
chevronLeft: "lucide:chevron-left",
|
|
102
|
+
chevronRight: "lucide:chevron-right",
|
|
103
|
+
chevronDoubleLeft: "lucide:chevrons-left",
|
|
104
|
+
chevronDoubleRight: "lucide:chevrons-right",
|
|
105
|
+
ellipsis: "lucide:ellipsis",
|
|
41
106
|
},
|
|
42
107
|
})
|
|
43
108
|
```
|
|
109
|
+
|
|
110
|
+
The `icons` map lets you swap icon libraries without touching component code. Components reference icons by their slot name (e.g., `check`, `close`), and the config resolves them to [Iconify](https://iconify.design/) IDs.
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
[MIT](../../LICENSE) © [Favour Emeka](https://github.com/favorodera)
|
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { loadConfig } from "c12";
|
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/constants.ts
|
|
10
10
|
/** CentoUI current package version, sourced directly from package.json. */
|
|
11
|
-
const VERSION = "1.0.0-alpha.
|
|
11
|
+
const VERSION = "1.0.0-alpha.30";
|
|
12
12
|
/** File name for the user-side CentoUI config (created by `centoui init`). */
|
|
13
13
|
const CONFIG_FILE_NAME = "centoui.config.ts";
|
|
14
14
|
/**
|
package/package.json
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "centoui-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-alpha.
|
|
4
|
+
"version": "1.0.0-alpha.30",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Official CLI for CentoUI.",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"cli",
|
|
9
|
+
"vue",
|
|
10
|
+
"ui",
|
|
11
|
+
"components",
|
|
12
|
+
"tailwindcss"
|
|
13
|
+
],
|
|
7
14
|
"author": "Favour Emeka <favorodera@gmail.com>",
|
|
8
15
|
"license": "MIT",
|
|
9
16
|
"homepage": "https://centoui.vercel.app",
|