@mohammad-irfan/create-dashboard-kit 1.0.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/LICENSE +21 -0
- package/README.md +153 -0
- package/bin/create-dashboard.js +12 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.js +223 -0
- package/dist/configBuilder.d.ts +8 -0
- package/dist/configBuilder.js +573 -0
- package/dist/generator.d.ts +9 -0
- package/dist/generator.js +223 -0
- package/dist/presets.d.ts +8 -0
- package/dist/presets.js +72 -0
- package/dist/prompts.d.ts +2 -0
- package/dist/prompts.js +121 -0
- package/dist/templateEngine.d.ts +3 -0
- package/dist/templateEngine.js +31 -0
- package/dist/types.d.ts +54 -0
- package/dist/types.js +1 -0
- package/dist/validation.d.ts +16 -0
- package/dist/validation.js +73 -0
- package/package.json +56 -0
- package/templates/source/components/controls/Button.tsx +69 -0
- package/templates/source/components/controls/Input.tsx +59 -0
- package/templates/source/components/controls/SearchBar.tsx +44 -0
- package/templates/source/components/controls/Select.tsx +61 -0
- package/templates/source/components/controls/ThemeToggle.tsx +23 -0
- package/templates/source/components/feedback/NotificationCenter.tsx +151 -0
- package/templates/source/components/feedback/Skeleton.tsx +22 -0
- package/templates/source/components/feedback/StatusBadge.tsx +35 -0
- package/templates/source/components/feedback/statusBadgeStyles.ts +28 -0
- package/templates/source/components/icons/IconSet.tsx +235 -0
- package/templates/source/components/layout/AppShell.tsx +70 -0
- package/templates/source/components/layout/Header.tsx +90 -0
- package/templates/source/components/layout/PageHeader.tsx +27 -0
- package/templates/source/components/layout/Sidebar.tsx +202 -0
- package/templates/source/components/metrics/MetricRow.tsx +61 -0
- package/templates/source/components/metrics/StatCard.tsx +49 -0
- package/templates/source/components/navigation/NavItem.tsx +75 -0
- package/templates/source/components/navigation/ShortcutPill.tsx +39 -0
- package/templates/source/components/surfaces/EmptyState.tsx +36 -0
- package/templates/source/components/surfaces/HeroSurface.tsx +64 -0
- package/templates/source/components/surfaces/Panel.tsx +43 -0
- package/templates/source/components/surfaces/PriorityCard.tsx +75 -0
- package/templates/source/components/surfaces/QuietListCard.tsx +146 -0
- package/templates/source/design-system/animations.css +25 -0
- package/templates/source/design-system/tokens.css +74 -0
- package/templates/source/design-system/typography.css +34 -0
- package/templates/source/theme/ThemeContext.tsx +82 -0
- package/templates/source/theme/useTheme.ts +10 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mohammad Irfan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# @mohammad-irfan/create-dashboard-kit
|
|
2
|
+
|
|
3
|
+
A zero-dependency CLI and project generator for scaffolding standalone, production-ready dashboard applications extracted from JobTrack's signature visual system.
|
|
4
|
+
|
|
5
|
+
- **Package**: `@mohammad-irfan/create-dashboard-kit`
|
|
6
|
+
- **CLI Command**: `create-dashboard-kit`
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 1. Overview
|
|
11
|
+
|
|
12
|
+
The `create-dashboard-kit` CLI allows you to instantly generate self-contained, domain-agnostic dashboards with:
|
|
13
|
+
- **Curved Canvas Shell** (`sm:rounded-tl-[36px] lg:rounded-tl-[48px]`).
|
|
14
|
+
- **Collapsible Desktop Sidebar Rail & Mobile Drawer**.
|
|
15
|
+
- **Light / Dark Theme System** with anti-flash script and CSS variable tokens.
|
|
16
|
+
- **Centralized Dashboard Configuration** (`src/config/dashboard.config.ts`).
|
|
17
|
+
- **Prebuilt Generic UI Primitives**: AppShell, Header, Sidebar, HeroSurface, PriorityCard, Panel, QuietListCard, EmptyState, StatCard, MetricRow, StatusBadge, Button, Input, Select, SearchBar, ThemeToggle, and scalable SVG icons.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 2. Usage
|
|
22
|
+
|
|
23
|
+
### Quick Start
|
|
24
|
+
Generate a new dashboard application with zero setup via `npx`:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx @mohammad-irfan/create-dashboard-kit my-dashboard
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
### Interactive Mode
|
|
33
|
+
Run the generator and follow the guided prompts:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Guided interactive questionnaire
|
|
37
|
+
npx @mohammad-irfan/create-dashboard-kit cafe-os
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
You will be prompted for:
|
|
41
|
+
1. Display / Brand name
|
|
42
|
+
2. Theme preset (`JobTrack Blue`, `Cafe OS Amber`, or `Custom`)
|
|
43
|
+
3. Primary and accent colors (hex)
|
|
44
|
+
4. Default color mode (`system`, `dark`, or `light`)
|
|
45
|
+
5. Button shape (`pill`, `rounded`, `square`)
|
|
46
|
+
6. Card border radius (`large`, `medium`, `small`)
|
|
47
|
+
7. Default sidebar state (`expanded`, `collapsed`)
|
|
48
|
+
8. Include demo data (`yes`, `no`)
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
### Non-Interactive & Preset Examples
|
|
53
|
+
Pass configuration flags to scaffold instantly without prompts:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# 1. Preset: Cafe OS Amber (F&B / Kitchen operations)
|
|
57
|
+
npx @mohammad-irfan/create-dashboard-kit cafe-os --preset cafe
|
|
58
|
+
|
|
59
|
+
# 2. Preset: JobTrack Blue (Modern SaaS Command Center)
|
|
60
|
+
npx @mohammad-irfan/create-dashboard-kit my-saas --preset jobtrack --mode dark
|
|
61
|
+
|
|
62
|
+
# 3. Custom theme with tailored brand & accent colors
|
|
63
|
+
npx @mohammad-irfan/create-dashboard-kit crm-dashboard --preset custom \
|
|
64
|
+
--brand "Apex CRM" \
|
|
65
|
+
--primary "#7c3aed" \
|
|
66
|
+
--accent "#06b6d4" \
|
|
67
|
+
--shape pill \
|
|
68
|
+
--radius large
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### Global Installation (Optional)
|
|
74
|
+
Install globally to use the `create-dashboard-kit` command directly anywhere:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm install -g @mohammad-irfan/create-dashboard-kit
|
|
78
|
+
create-dashboard-kit my-dashboard
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 3. CLI Command Options
|
|
84
|
+
|
|
85
|
+
| Flag | Description | Values / Examples | Default |
|
|
86
|
+
| :--- | :--- | :--- | :--- |
|
|
87
|
+
| `<project-name>` | Target directory and package name | `my-dashboard`, `cafe-os` | Required |
|
|
88
|
+
| `--brand` | Display / brand title | `"Acme Ops"`, `"Cafe OS"` | Derived from name |
|
|
89
|
+
| `--preset` | Theme preset | `jobtrack`, `cafe`, `custom` | `jobtrack` |
|
|
90
|
+
| `--primary` | Primary brand color (hex) | `#2563eb`, `#d97706`, `#7c3aed` | `#2563eb` |
|
|
91
|
+
| `--accent` | Accent feedback color (hex) | `#059669`, `#15803d`, `#06b6d4` | `#059669` |
|
|
92
|
+
| `--mode` | Default color mode | `system`, `light`, `dark` | `system` |
|
|
93
|
+
| `--shape` | Button border radius shape | `pill`, `rounded`, `square` | `pill` |
|
|
94
|
+
| `--radius` | Card border radius | `large` (2xl), `medium` (xl), `small` (lg) | `large` |
|
|
95
|
+
| `--sidebar` | Default desktop sidebar state | `expanded`, `collapsed` | `expanded` |
|
|
96
|
+
| `--demo` / `--no-demo` | Include mock panels and metrics | `true`, `false` | `true` |
|
|
97
|
+
| `--force`, `-f` | Overwrite existing directory | Flag | `false` |
|
|
98
|
+
| `--help`, `-h` | Display usage instructions | Flag | |
|
|
99
|
+
| `--version`, `-v`| Print CLI version | Flag | |
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 4. Generated Project Structure
|
|
104
|
+
|
|
105
|
+
Every generated project is completely self-contained and independent:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
my-dashboard/
|
|
109
|
+
āāā index.html
|
|
110
|
+
āāā package.json
|
|
111
|
+
āāā tsconfig.json
|
|
112
|
+
āāā tsconfig.app.json
|
|
113
|
+
āāā tsconfig.node.json
|
|
114
|
+
āāā vite.config.ts
|
|
115
|
+
āāā README.md
|
|
116
|
+
āāā public/
|
|
117
|
+
ā āāā assets/
|
|
118
|
+
ā āāā logo.svg
|
|
119
|
+
āāā src/
|
|
120
|
+
ā āāā main.tsx
|
|
121
|
+
ā āāā App.tsx
|
|
122
|
+
ā āāā index.css
|
|
123
|
+
ā āāā index.ts
|
|
124
|
+
ā āāā config/
|
|
125
|
+
ā ā āāā dashboard.config.ts # Central configuration file
|
|
126
|
+
ā āāā design-system/
|
|
127
|
+
ā ā āāā tokens.css # Theme colors & CSS variables
|
|
128
|
+
ā ā āāā typography.css # Tabular figures & typography tokens
|
|
129
|
+
ā ā āāā animations.css # Transitions
|
|
130
|
+
ā āāā theme/
|
|
131
|
+
ā ā āāā ThemeContext.tsx # Light / Dark / System theme provider
|
|
132
|
+
ā ā āāā useTheme.ts
|
|
133
|
+
ā āāā components/
|
|
134
|
+
ā āāā controls/ # Button, Input, Select, SearchBar, ThemeToggle
|
|
135
|
+
ā āāā feedback/ # StatusBadge, NotificationCenter, Skeleton
|
|
136
|
+
ā āāā icons/ # Scalable SVG IconSet
|
|
137
|
+
ā āāā layout/ # AppShell, Sidebar, Header, PageHeader
|
|
138
|
+
ā āāā metrics/ # StatCard, MetricRow
|
|
139
|
+
ā āāā navigation/ # NavItem, ShortcutPill
|
|
140
|
+
ā āāā surfaces/ # HeroSurface, Panel, PriorityCard, QuietListCard, EmptyState
|
|
141
|
+
āāā tests/
|
|
142
|
+
āāā dashboard.test.ts
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## 5. Security & Safety Principles
|
|
148
|
+
|
|
149
|
+
- **No Remote Dependencies**: The CLI runs entirely on native Node.js built-ins (`node:readline/promises`, `node:fs`, `node:path`).
|
|
150
|
+
- **Path Traversal Guards**: Project paths are sanitized and validated to prevent writing outside the target working directory.
|
|
151
|
+
- **Overwrite Protection**: Will never overwrite an existing non-empty directory unless `--force` is explicitly specified.
|
|
152
|
+
- **Zero Telemetry**: Never sends network requests, collects metrics, or prompts for credentials.
|
|
153
|
+
- **Zero Business Coupling**: Completely free of Supabase, JobTrack schemas, and backend dependencies.
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { validateHexColor } from './validation.js';
|
|
3
|
+
import { promptInteractive } from './prompts.js';
|
|
4
|
+
import { generateProject } from './generator.js';
|
|
5
|
+
export function parseArgs(args) {
|
|
6
|
+
const flags = {};
|
|
7
|
+
let projectName;
|
|
8
|
+
for (let i = 0; i < args.length; i++) {
|
|
9
|
+
const arg = args[i];
|
|
10
|
+
if (arg === '--help' || arg === '-h') {
|
|
11
|
+
flags.help = true;
|
|
12
|
+
}
|
|
13
|
+
else if (arg === '--version' || arg === '-v') {
|
|
14
|
+
flags.version = true;
|
|
15
|
+
}
|
|
16
|
+
else if (arg === '--force' || arg === '-f') {
|
|
17
|
+
flags.force = true;
|
|
18
|
+
}
|
|
19
|
+
else if (arg === '--demo') {
|
|
20
|
+
flags.demo = true;
|
|
21
|
+
}
|
|
22
|
+
else if (arg === '--no-demo') {
|
|
23
|
+
flags.demo = false;
|
|
24
|
+
}
|
|
25
|
+
else if (arg === '--brand' && i + 1 < args.length) {
|
|
26
|
+
flags.brand = args[++i];
|
|
27
|
+
}
|
|
28
|
+
else if (arg.startsWith('--brand=')) {
|
|
29
|
+
flags.brand = arg.slice(8);
|
|
30
|
+
}
|
|
31
|
+
else if (arg === '--preset' && i + 1 < args.length) {
|
|
32
|
+
flags.preset = args[++i];
|
|
33
|
+
}
|
|
34
|
+
else if (arg.startsWith('--preset=')) {
|
|
35
|
+
flags.preset = arg.slice(9);
|
|
36
|
+
}
|
|
37
|
+
else if (arg === '--primary' && i + 1 < args.length) {
|
|
38
|
+
flags.primary = args[++i];
|
|
39
|
+
}
|
|
40
|
+
else if (arg.startsWith('--primary=')) {
|
|
41
|
+
flags.primary = arg.slice(10);
|
|
42
|
+
}
|
|
43
|
+
else if (arg === '--accent' && i + 1 < args.length) {
|
|
44
|
+
flags.accent = args[++i];
|
|
45
|
+
}
|
|
46
|
+
else if (arg.startsWith('--accent=')) {
|
|
47
|
+
flags.accent = arg.slice(9);
|
|
48
|
+
}
|
|
49
|
+
else if (arg === '--mode' && i + 1 < args.length) {
|
|
50
|
+
flags.mode = args[++i];
|
|
51
|
+
}
|
|
52
|
+
else if (arg.startsWith('--mode=')) {
|
|
53
|
+
flags.mode = arg.slice(7);
|
|
54
|
+
}
|
|
55
|
+
else if (arg === '--shape' && i + 1 < args.length) {
|
|
56
|
+
flags.shape = args[++i];
|
|
57
|
+
}
|
|
58
|
+
else if (arg.startsWith('--shape=')) {
|
|
59
|
+
flags.shape = arg.slice(8);
|
|
60
|
+
}
|
|
61
|
+
else if (arg === '--radius' && i + 1 < args.length) {
|
|
62
|
+
flags.radius = args[++i];
|
|
63
|
+
}
|
|
64
|
+
else if (arg.startsWith('--radius=')) {
|
|
65
|
+
flags.radius = arg.slice(9);
|
|
66
|
+
}
|
|
67
|
+
else if (arg === '--sidebar' && i + 1 < args.length) {
|
|
68
|
+
flags.sidebar = args[++i];
|
|
69
|
+
}
|
|
70
|
+
else if (arg.startsWith('--sidebar=')) {
|
|
71
|
+
flags.sidebar = arg.slice(10);
|
|
72
|
+
}
|
|
73
|
+
else if (!arg.startsWith('-') && !projectName) {
|
|
74
|
+
projectName = arg;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return { projectName, flags };
|
|
78
|
+
}
|
|
79
|
+
export function printHelp() {
|
|
80
|
+
console.log(`
|
|
81
|
+
create-dashboard-kit ā Scaffold customized dashboard applications
|
|
82
|
+
|
|
83
|
+
USAGE:
|
|
84
|
+
create-dashboard-kit <project-name> [options]
|
|
85
|
+
|
|
86
|
+
OPTIONS:
|
|
87
|
+
--brand <name> Display/brand name
|
|
88
|
+
--preset <preset> Theme preset: 'jobtrack' | 'cafe' | 'custom'
|
|
89
|
+
--primary <hex> Primary brand color in hex (e.g. #2563eb)
|
|
90
|
+
--accent <hex> Accent brand color in hex (e.g. #059669)
|
|
91
|
+
--mode <mode> Default color mode: 'system' | 'light' | 'dark'
|
|
92
|
+
--shape <shape> Button shape: 'pill' | 'rounded' | 'square'
|
|
93
|
+
--radius <radius> Card radius: 'small' | 'medium' | 'large'
|
|
94
|
+
--sidebar <state> Sidebar desktop state: 'expanded' | 'collapsed'
|
|
95
|
+
--demo / --no-demo Include demo panels & mock metrics (default: true)
|
|
96
|
+
--force, -f Overwrite target directory if it already exists
|
|
97
|
+
--help, -h Show this help message
|
|
98
|
+
--version, -v Show version
|
|
99
|
+
|
|
100
|
+
EXAMPLES:
|
|
101
|
+
# Interactive mode
|
|
102
|
+
create-dashboard-kit my-dashboard
|
|
103
|
+
|
|
104
|
+
# Non-interactive Cafe OS setup
|
|
105
|
+
create-dashboard-kit cafe-os \
|
|
106
|
+
--brand "Cafe OS" \
|
|
107
|
+
--preset cafe \
|
|
108
|
+
--primary "#d97706" \
|
|
109
|
+
--accent "#15803d" \
|
|
110
|
+
--mode dark
|
|
111
|
+
|
|
112
|
+
# Non-interactive Custom SaaS setup
|
|
113
|
+
create-dashboard-kit my-saas \
|
|
114
|
+
--brand "My SaaS" \
|
|
115
|
+
--preset custom \
|
|
116
|
+
--primary "#7c3aed" \
|
|
117
|
+
--accent "#06b6d4" \
|
|
118
|
+
--shape pill \
|
|
119
|
+
--radius large
|
|
120
|
+
`);
|
|
121
|
+
}
|
|
122
|
+
export async function runCli(argv = process.argv.slice(2)) {
|
|
123
|
+
const { projectName: cliProjectName, flags } = parseArgs(argv);
|
|
124
|
+
if (flags.help) {
|
|
125
|
+
printHelp();
|
|
126
|
+
return 0;
|
|
127
|
+
}
|
|
128
|
+
if (flags.version) {
|
|
129
|
+
console.log('create-dashboard-kit v1.0.0');
|
|
130
|
+
return 0;
|
|
131
|
+
}
|
|
132
|
+
let options;
|
|
133
|
+
// Determine if all required options are provided non-interactively
|
|
134
|
+
const isNonInteractive = Boolean(cliProjectName) &&
|
|
135
|
+
(Boolean(flags.preset) || Boolean(flags.primary) || Boolean(flags.brand));
|
|
136
|
+
if (isNonInteractive && cliProjectName) {
|
|
137
|
+
const rawPreset = flags.preset?.toLowerCase();
|
|
138
|
+
const preset = rawPreset === 'cafe' ? 'cafe' : rawPreset === 'custom' ? 'custom' : 'jobtrack';
|
|
139
|
+
let primary = flags.primary || (preset === 'cafe' ? '#d97706' : '#2563eb');
|
|
140
|
+
let accent = flags.accent || (preset === 'cafe' ? '#15803d' : '#059669');
|
|
141
|
+
if (flags.primary && !validateHexColor(flags.primary)) {
|
|
142
|
+
console.error(`ā Invalid primary color: "${flags.primary}". Must be a valid hex color (e.g. #2563eb).`);
|
|
143
|
+
return 1;
|
|
144
|
+
}
|
|
145
|
+
if (flags.accent && !validateHexColor(flags.accent)) {
|
|
146
|
+
console.error(`ā Invalid accent color: "${flags.accent}". Must be a valid hex color (e.g. #059669).`);
|
|
147
|
+
return 1;
|
|
148
|
+
}
|
|
149
|
+
const rawMode = flags.mode?.toLowerCase();
|
|
150
|
+
const defaultMode = rawMode === 'light' ? 'light' : rawMode === 'dark' ? 'dark' : 'system';
|
|
151
|
+
const rawShape = flags.shape?.toLowerCase();
|
|
152
|
+
const buttonShape = rawShape === 'rounded' ? 'rounded' : rawShape === 'square' ? 'square' : 'pill';
|
|
153
|
+
const rawRadius = flags.radius?.toLowerCase();
|
|
154
|
+
const cardRadius = rawRadius === 'small' ? 'small' : rawRadius === 'medium' ? 'medium' : 'large';
|
|
155
|
+
const rawSidebar = flags.sidebar?.toLowerCase();
|
|
156
|
+
const sidebarState = rawSidebar === 'collapsed' ? 'collapsed' : 'expanded';
|
|
157
|
+
const derivedName = path.basename(cliProjectName.replace(/[\\/]+$/, ''));
|
|
158
|
+
const defaultBrand = derivedName
|
|
159
|
+
.split(/[-_]/)
|
|
160
|
+
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
161
|
+
.join(' ');
|
|
162
|
+
const targetDir = cliProjectName.startsWith('.') || cliProjectName.startsWith('/')
|
|
163
|
+
? cliProjectName
|
|
164
|
+
: `./${cliProjectName}`;
|
|
165
|
+
options = {
|
|
166
|
+
projectName: derivedName,
|
|
167
|
+
targetDir,
|
|
168
|
+
brandName: flags.brand || defaultBrand,
|
|
169
|
+
preset,
|
|
170
|
+
primaryColor: primary,
|
|
171
|
+
accentColor: accent,
|
|
172
|
+
defaultMode,
|
|
173
|
+
buttonShape,
|
|
174
|
+
cardRadius,
|
|
175
|
+
sidebarState,
|
|
176
|
+
includeDemo: flags.demo !== false,
|
|
177
|
+
framework: 'react-vite',
|
|
178
|
+
force: flags.force,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
// Interactive prompt mode
|
|
183
|
+
try {
|
|
184
|
+
options = await promptInteractive(cliProjectName);
|
|
185
|
+
options.force = flags.force;
|
|
186
|
+
}
|
|
187
|
+
catch (err) {
|
|
188
|
+
if (err?.message?.includes('closed') || err?.name === 'AbortError') {
|
|
189
|
+
console.log('\nOperation cancelled.');
|
|
190
|
+
return 130;
|
|
191
|
+
}
|
|
192
|
+
throw err;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// Execute Project Generator
|
|
196
|
+
try {
|
|
197
|
+
console.log(`\nš¦ Scaffolding dashboard in ${options.targetDir}...`);
|
|
198
|
+
const result = generateProject(options);
|
|
199
|
+
const presetName = options.preset === 'cafe'
|
|
200
|
+
? 'Cafe OS Amber'
|
|
201
|
+
: options.preset === 'custom'
|
|
202
|
+
? 'Custom Theme'
|
|
203
|
+
: 'JobTrack Blue';
|
|
204
|
+
console.log('\n' + '='.repeat(50));
|
|
205
|
+
console.log('ā
Created project:');
|
|
206
|
+
console.log(` ${options.brandName}`);
|
|
207
|
+
console.log('\nš Location:');
|
|
208
|
+
console.log(` ${path.resolve(result.targetDir)}`);
|
|
209
|
+
console.log('\nšØ Theme:');
|
|
210
|
+
console.log(` ${presetName} (${options.primaryColor})`);
|
|
211
|
+
console.log(` Mode: ${options.defaultMode} | Shape: ${options.buttonShape} | Radius: ${options.cardRadius}`);
|
|
212
|
+
console.log('\nš Next steps:');
|
|
213
|
+
console.log(` cd ${options.projectName}`);
|
|
214
|
+
console.log(' npm install');
|
|
215
|
+
console.log(' npm run dev');
|
|
216
|
+
console.log('='.repeat(50) + '\n');
|
|
217
|
+
return 0;
|
|
218
|
+
}
|
|
219
|
+
catch (err) {
|
|
220
|
+
console.error(`\nā Error: ${err?.message || String(err)}\n`);
|
|
221
|
+
return 1;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { GeneratorOptions } from './types.js';
|
|
2
|
+
export declare function buildDashboardConfigFile(options: GeneratorOptions): string;
|
|
3
|
+
export declare function buildTokensCssFile(options: GeneratorOptions): string;
|
|
4
|
+
export declare function buildIndexHtml(options: GeneratorOptions): string;
|
|
5
|
+
export declare function buildLogoSvg(options: GeneratorOptions): string;
|
|
6
|
+
export declare function buildAppTsx(options: GeneratorOptions): string;
|
|
7
|
+
export declare function buildPackageJson(options: GeneratorOptions): string;
|
|
8
|
+
export declare function buildProjectReadme(options: GeneratorOptions): string;
|