@elsapiens/cli 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 +283 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +565 -0
- package/dist/index.js.map +1 -0
- package/dist/templates/app/app.ejs +19 -0
- package/dist/templates/app/index-css.ejs +5 -0
- package/dist/templates/app/index-html.ejs +13 -0
- package/dist/templates/app/main.ejs +15 -0
- package/dist/templates/app/package.ejs +31 -0
- package/dist/templates/app/page-dashboard.ejs +108 -0
- package/dist/templates/app/page-settings.ejs +116 -0
- package/dist/templates/app/tsconfig.ejs +21 -0
- package/dist/templates/app/vite-config.ejs +9 -0
- package/dist/templates/components/simple.ejs +16 -0
- package/dist/templates/components/stateful.ejs +30 -0
- package/dist/templates/pages/dashboard.ejs +203 -0
- package/dist/templates/pages/list.ejs +191 -0
- package/dist/templates/pages/settings.ejs +163 -0
- package/package.json +62 -0
package/README.md
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
# @elsapiens/cli
|
|
2
|
+
|
|
3
|
+
CLI scaffolding tool for creating and managing elSapiens SDK projects.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Use directly with npx (recommended)
|
|
9
|
+
npx @elsapiens/cli init my-app
|
|
10
|
+
|
|
11
|
+
# Or install globally
|
|
12
|
+
npm install -g @elsapiens/cli
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- Create new projects with elSapiens SDK
|
|
18
|
+
- Add pages with correct structure and patterns
|
|
19
|
+
- Add components with TypeScript templates
|
|
20
|
+
- Interactive prompts for configuration
|
|
21
|
+
- Cross-platform support (macOS, Linux, Windows)
|
|
22
|
+
|
|
23
|
+
## Commands
|
|
24
|
+
|
|
25
|
+
### Create New Project
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Interactive mode
|
|
29
|
+
el init my-app
|
|
30
|
+
|
|
31
|
+
# With template selection
|
|
32
|
+
el init my-app --template minimal
|
|
33
|
+
el init my-app --template full
|
|
34
|
+
|
|
35
|
+
# Skip prompts
|
|
36
|
+
el init my-app --yes
|
|
37
|
+
|
|
38
|
+
# Skip git initialization
|
|
39
|
+
el init my-app --no-git
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Templates:**
|
|
43
|
+
|
|
44
|
+
| Template | Description |
|
|
45
|
+
|----------|-------------|
|
|
46
|
+
| `minimal` | Basic setup with single Dashboard page |
|
|
47
|
+
| `full` | Complete setup with Dashboard, Settings, and examples |
|
|
48
|
+
|
|
49
|
+
**Generated Structure (minimal):**
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
my-app/
|
|
53
|
+
├── package.json
|
|
54
|
+
├── vite.config.ts
|
|
55
|
+
├── tsconfig.json
|
|
56
|
+
├── index.html
|
|
57
|
+
├── .gitignore
|
|
58
|
+
└── src/
|
|
59
|
+
├── main.tsx
|
|
60
|
+
├── App.tsx
|
|
61
|
+
├── index.css
|
|
62
|
+
└── pages/
|
|
63
|
+
└── Dashboard.tsx
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Add Page
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Interactive mode
|
|
70
|
+
el add page
|
|
71
|
+
|
|
72
|
+
# With name
|
|
73
|
+
el add page Users
|
|
74
|
+
|
|
75
|
+
# With template
|
|
76
|
+
el add page Users --template list
|
|
77
|
+
el add page Dashboard --template dashboard
|
|
78
|
+
el add page Settings --template settings
|
|
79
|
+
|
|
80
|
+
# Custom path
|
|
81
|
+
el add page Users --path src/features/users/pages
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Page Templates:**
|
|
85
|
+
|
|
86
|
+
| Template | Description |
|
|
87
|
+
|----------|-------------|
|
|
88
|
+
| `dashboard` | Overview page with stats, charts, and activity table |
|
|
89
|
+
| `list` | Data listing with search, filters, and table |
|
|
90
|
+
| `settings` | Configuration page with form sections and toggles |
|
|
91
|
+
|
|
92
|
+
**Page Structure:**
|
|
93
|
+
|
|
94
|
+
All pages follow the established alignment pattern:
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
<div className="p-6">
|
|
98
|
+
{/* Page Header - pl-6 to align with table spacer */}
|
|
99
|
+
<div className="flex items-center justify-between mb-8 pl-6">
|
|
100
|
+
<div>
|
|
101
|
+
<h1 className="text-2xl font-bold text-foreground">Title</h1>
|
|
102
|
+
<p className="text-muted-foreground">Description</p>
|
|
103
|
+
</div>
|
|
104
|
+
{/* Actions */}
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
{/* Content with Cards */}
|
|
108
|
+
<Card padding="none">
|
|
109
|
+
<CardHeader className="p-6">
|
|
110
|
+
<CardTitle>Section</CardTitle>
|
|
111
|
+
</CardHeader>
|
|
112
|
+
<CardContent className="p-6 pt-0">
|
|
113
|
+
{/* Content */}
|
|
114
|
+
</CardContent>
|
|
115
|
+
</Card>
|
|
116
|
+
</div>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Add Component
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Interactive mode
|
|
123
|
+
el add component
|
|
124
|
+
|
|
125
|
+
# With name
|
|
126
|
+
el add component UserCard
|
|
127
|
+
|
|
128
|
+
# With template
|
|
129
|
+
el add component UserCard --template simple
|
|
130
|
+
el add component DataTable --template stateful
|
|
131
|
+
|
|
132
|
+
# Custom path
|
|
133
|
+
el add component UserCard --path src/features/users/components
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Component Templates:**
|
|
137
|
+
|
|
138
|
+
| Template | Description |
|
|
139
|
+
|----------|-------------|
|
|
140
|
+
| `simple` | Basic component with props and className |
|
|
141
|
+
| `stateful` | Component with useState and onChange callback |
|
|
142
|
+
|
|
143
|
+
## Usage Examples
|
|
144
|
+
|
|
145
|
+
### Creating a New Project
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
$ el init my-dashboard
|
|
149
|
+
|
|
150
|
+
elSapiens CLI v0.1.0
|
|
151
|
+
|
|
152
|
+
? Project name: my-dashboard
|
|
153
|
+
? Select template: Minimal
|
|
154
|
+
? Initialize git repository? Yes
|
|
155
|
+
|
|
156
|
+
Creating project...
|
|
157
|
+
✓ package.json
|
|
158
|
+
✓ vite.config.ts
|
|
159
|
+
✓ tsconfig.json
|
|
160
|
+
✓ src/main.tsx
|
|
161
|
+
✓ src/App.tsx
|
|
162
|
+
✓ src/pages/Dashboard.tsx
|
|
163
|
+
|
|
164
|
+
Done! Run:
|
|
165
|
+
cd my-dashboard
|
|
166
|
+
pnpm install
|
|
167
|
+
pnpm dev
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Adding a Page
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
$ el add page Users --template list
|
|
174
|
+
|
|
175
|
+
Add Page
|
|
176
|
+
|
|
177
|
+
? Page title: Users
|
|
178
|
+
? Description: Manage user accounts
|
|
179
|
+
|
|
180
|
+
✓ Created src/pages/Users.tsx
|
|
181
|
+
|
|
182
|
+
Add route to App.tsx:
|
|
183
|
+
import Users from './pages/Users';
|
|
184
|
+
<Route path="/users" element={<Users />} />
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Adding a Component
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
$ el add component UserCard --template stateful
|
|
191
|
+
|
|
192
|
+
Add Component
|
|
193
|
+
|
|
194
|
+
✓ Created src/components/UserCard.tsx
|
|
195
|
+
|
|
196
|
+
Import and use:
|
|
197
|
+
import { UserCard } from './components/UserCard';
|
|
198
|
+
<UserCard className="..." />
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## CLI Reference
|
|
202
|
+
|
|
203
|
+
### `el init [project-name]`
|
|
204
|
+
|
|
205
|
+
Create a new elSapiens project.
|
|
206
|
+
|
|
207
|
+
| Option | Description |
|
|
208
|
+
|--------|-------------|
|
|
209
|
+
| `-t, --template <type>` | Project template (minimal, full) |
|
|
210
|
+
| `--no-git` | Skip git initialization |
|
|
211
|
+
| `-y, --yes` | Skip prompts, use defaults |
|
|
212
|
+
|
|
213
|
+
### `el add page [name]`
|
|
214
|
+
|
|
215
|
+
Add a new page to the project.
|
|
216
|
+
|
|
217
|
+
| Option | Description |
|
|
218
|
+
|--------|-------------|
|
|
219
|
+
| `-t, --template <type>` | Page template (dashboard, list, settings) |
|
|
220
|
+
| `-p, --path <dir>` | Custom pages directory |
|
|
221
|
+
|
|
222
|
+
### `el add component [name]`
|
|
223
|
+
|
|
224
|
+
Add a new component to the project.
|
|
225
|
+
|
|
226
|
+
| Option | Description |
|
|
227
|
+
|--------|-------------|
|
|
228
|
+
| `-t, --template <type>` | Component template (simple, stateful) |
|
|
229
|
+
| `-p, --path <dir>` | Custom components directory |
|
|
230
|
+
|
|
231
|
+
## Aliases
|
|
232
|
+
|
|
233
|
+
The CLI supports multiple command aliases:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# These are equivalent
|
|
237
|
+
el init my-app
|
|
238
|
+
elsapiens init my-app
|
|
239
|
+
|
|
240
|
+
# Add command aliases
|
|
241
|
+
el add page Users
|
|
242
|
+
el generate page Users
|
|
243
|
+
el g page Users
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Requirements
|
|
247
|
+
|
|
248
|
+
- Node.js 18.0.0 or higher
|
|
249
|
+
- npm, pnpm, or yarn
|
|
250
|
+
|
|
251
|
+
## Development
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
# Clone the repository
|
|
255
|
+
git clone https://github.com/elsapiens/sdk.git
|
|
256
|
+
cd sdk/packages/cli
|
|
257
|
+
|
|
258
|
+
# Install dependencies
|
|
259
|
+
pnpm install
|
|
260
|
+
|
|
261
|
+
# Build
|
|
262
|
+
pnpm build
|
|
263
|
+
|
|
264
|
+
# Test locally
|
|
265
|
+
node dist/index.js --help
|
|
266
|
+
node dist/index.js init test-app
|
|
267
|
+
|
|
268
|
+
# Link globally for testing
|
|
269
|
+
pnpm link --global
|
|
270
|
+
el --version
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Publishing
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
# Build and publish
|
|
277
|
+
pnpm build
|
|
278
|
+
npm publish --access public
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## License
|
|
282
|
+
|
|
283
|
+
MIT
|
package/dist/index.d.ts
ADDED