@soadtech/cli 0.1.0 → 0.1.1

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 (2) hide show
  1. package/README.md +189 -0
  2. package/package.json +9 -6
package/README.md ADDED
@@ -0,0 +1,189 @@
1
+ # @soadtech/cli
2
+
3
+ CLI for adding soadtech-ui components to your project. Copy component source code directly into your codebase — own it, customize it, no dependency lock-in.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ # 1. Initialize your project
9
+ npx @soadtech/cli init
10
+
11
+ # 2. Add components
12
+ npx @soadtech/cli add Button Card Avatar
13
+ ```
14
+
15
+ ## Commands
16
+
17
+ ### `init`
18
+
19
+ Sets up your project to use soadtech-ui components.
20
+
21
+ ```bash
22
+ npx @soadtech/cli init
23
+ ```
24
+
25
+ **What it does:**
26
+
27
+ 1. Prompts for directory paths (or uses defaults with `-y`)
28
+ 2. Copies `tokens.css` (design tokens) to your theme directory
29
+ 3. Copies `cn.ts` (className utility) to your utils directory
30
+ 4. Copies `css-modules.d.ts` to your project root
31
+ 5. Installs `clsx` if not already present
32
+ 6. Creates `components.json` config file
33
+
34
+ **Options:**
35
+
36
+ | Flag | Description | Default |
37
+ |---|---|---|
38
+ | `-y, --yes` | Skip prompts, use defaults | `false` |
39
+ | `--cwd <path>` | Set working directory | `.` |
40
+
41
+ **Default paths:**
42
+
43
+ | Directory | Default |
44
+ |---|---|
45
+ | Components | `src/components/ui` |
46
+ | Utils | `src/lib` |
47
+ | Theme | `src/styles` |
48
+
49
+ **Generated `components.json`:**
50
+
51
+ ```json
52
+ {
53
+ "aliases": {
54
+ "components": "src/components/ui",
55
+ "utils": "src/lib",
56
+ "theme": "src/styles"
57
+ }
58
+ }
59
+ ```
60
+
61
+ ---
62
+
63
+ ### `add`
64
+
65
+ Adds one or more components to your project.
66
+
67
+ ```bash
68
+ npx @soadtech/cli add <components...>
69
+ ```
70
+
71
+ **Examples:**
72
+
73
+ ```bash
74
+ # Single component
75
+ npx @soadtech/cli add Button
76
+
77
+ # Multiple components
78
+ npx @soadtech/cli add Button Card Avatar Notification
79
+
80
+ # Skip confirmation
81
+ npx @soadtech/cli add Datepicker -y
82
+
83
+ # Overwrite existing
84
+ npx @soadtech/cli add Button --overwrite
85
+ ```
86
+
87
+ **Options:**
88
+
89
+ | Flag | Description | Default |
90
+ |---|---|---|
91
+ | `--overwrite` | Replace existing components | `false` |
92
+ | `-y, --yes` | Skip confirmation prompt | `false` |
93
+ | `--cwd <path>` | Set working directory | `.` |
94
+
95
+ **What it does:**
96
+
97
+ 1. Reads your `components.json` config
98
+ 2. Resolves transitive dependencies automatically
99
+ 3. Skips components already in your project (unless `--overwrite`)
100
+ 4. Copies component files to your components directory
101
+ 5. Rewrites import paths to match your project structure
102
+
103
+ ---
104
+
105
+ ## Dependency Resolution
106
+
107
+ Components that depend on other components are resolved automatically. For example:
108
+
109
+ ```bash
110
+ npx @soadtech/cli add Datepicker
111
+ ```
112
+
113
+ Installs **Datepicker + Calendar + Button** because:
114
+ - Datepicker depends on Calendar
115
+ - Calendar depends on Button
116
+
117
+ **Known component dependencies:**
118
+
119
+ | Component | Depends On |
120
+ |---|---|
121
+ | Calendar | Button |
122
+ | Card | Avatar, Button |
123
+ | Datepicker | Calendar |
124
+ | NavbarUser | Avatar |
125
+ | Notification | Avatar, Button |
126
+ | Pagination | Button |
127
+ | Persona | Avatar, Button |
128
+
129
+ ---
130
+
131
+ ## What Gets Copied
132
+
133
+ Each component is a self-contained directory:
134
+
135
+ ```
136
+ src/components/ui/
137
+ └── Button/
138
+ ├── Button.tsx # Component implementation
139
+ ├── Button.types.ts # TypeScript types
140
+ ├── Button.module.css # Scoped styles
141
+ └── index.ts # Barrel export
142
+ ```
143
+
144
+ **Import rewriting:** The CLI automatically adjusts internal imports. The `cn` utility import is rewritten to match your configured utils path:
145
+
146
+ ```diff
147
+ - import { cn } from '../../utils/cn';
148
+ + import { cn } from '../../../lib/cn';
149
+ ```
150
+
151
+ Cross-component imports (e.g., Card importing Button) need no rewriting since components remain siblings under the same directory.
152
+
153
+ ---
154
+
155
+ ## Available Components
156
+
157
+ Accordion, ActionBar, Alert, Avatar, Badge, Breadcrumbs, Button, ButtonLink, Calendar, Card, Chart, Checkbox, Chip, Datepicker, Dialog, Divider, DropdownMenu, FileUpload, InputCounter, InputMessage, InputSearch, InputText, InputTextArea, NavbarUser, Notification, Pagination, Persona, Progress, RadioButton, RangeSlider, Rating, SegmentedControl, SelectDropdown, Sidebar, Stepper, Switch, Tab, Table, Tag, Tooltip, TreeviewList, VerificationCode.
158
+
159
+ ---
160
+
161
+ ## Theming
162
+
163
+ Components use CSS custom properties with the `--st-*` prefix. The `init` command copies `tokens.css` with all default values. Override any token to customize:
164
+
165
+ ```css
166
+ /* src/styles/tokens.css (or your theme file) */
167
+ :root {
168
+ --st-color-primary: #e11d48;
169
+ --st-color-primary-hover: #be123c;
170
+ }
171
+ ```
172
+
173
+ Import the tokens in your app entry point:
174
+
175
+ ```tsx
176
+ import './styles/tokens.css';
177
+ ```
178
+
179
+ ---
180
+
181
+ ## Requirements
182
+
183
+ - **Node.js** 18+
184
+ - **React** 18 or 19
185
+ - A project with CSS Modules support (Vite, Next.js, CRA all support this)
186
+
187
+ ## License
188
+
189
+ MIT
package/package.json CHANGED
@@ -1,24 +1,27 @@
1
1
  {
2
2
  "name": "@soadtech/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "soadtech": "./dist/index.js"
7
7
  },
8
- "files": ["dist", "registry"],
8
+ "files": [
9
+ "dist",
10
+ "registry"
11
+ ],
9
12
  "scripts": {
10
13
  "prebuild": "tsx scripts/copy-source.ts",
11
14
  "build": "tsup"
12
15
  },
13
16
  "dependencies": {
14
- "commander": "^13.1.0",
17
+ "commander": "^14.0.3",
15
18
  "picocolors": "^1.1.1",
16
19
  "prompts": "^2.4.2"
17
20
  },
18
21
  "devDependencies": {
19
22
  "@types/prompts": "^2.4.9",
20
- "tsup": "^8.4.0",
21
- "tsx": "^4.19.0",
22
- "typescript": "^5.7.3"
23
+ "tsup": "^8.5.1",
24
+ "tsx": "^4.21.0",
25
+ "typescript": "^6.0.2"
23
26
  }
24
27
  }