grg-kit-cli 0.1.2 ā 0.3.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 +82 -139
- package/bin/grg.js +19 -15
- package/commands/add.js +59 -101
- package/commands/init.js +55 -16
- package/commands/list.js +26 -58
- package/commands/llm-prompts.js +706 -0
- package/package.json +3 -2
- package/commands/metadata.js +0 -122
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# grg-kit-cli
|
|
2
2
|
|
|
3
|
-
CLI tool for
|
|
3
|
+
CLI tool for initializing Angular projects with GRG Kit and adding blocks.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -11,26 +11,28 @@ npm install -g grg-kit-cli
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
# Initialize GRG Kit
|
|
14
|
+
# Initialize GRG Kit (theme + all components + spartan-ng examples)
|
|
15
15
|
grg init
|
|
16
16
|
|
|
17
|
-
#
|
|
17
|
+
# Initialize with a specific theme
|
|
18
18
|
grg init --theme claude
|
|
19
19
|
|
|
20
|
+
# Add blocks
|
|
21
|
+
grg add block --auth
|
|
22
|
+
grg add block --shell
|
|
23
|
+
grg add block --all
|
|
24
|
+
|
|
20
25
|
# List available resources
|
|
21
26
|
grg list
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
grg add theme:claude
|
|
25
|
-
grg add component:stepper
|
|
26
|
-
grg add examples:all
|
|
27
|
+
grg list blocks
|
|
28
|
+
grg list themes
|
|
27
29
|
```
|
|
28
30
|
|
|
29
31
|
## Commands
|
|
30
32
|
|
|
31
33
|
### `grg init`
|
|
32
34
|
|
|
33
|
-
Initialize GRG Kit in your Angular project
|
|
35
|
+
Initialize GRG Kit in your Angular project. Downloads theme, all components, and all spartan-ng examples in one shot.
|
|
34
36
|
|
|
35
37
|
```bash
|
|
36
38
|
grg init [options]
|
|
@@ -45,8 +47,10 @@ Examples:
|
|
|
45
47
|
```
|
|
46
48
|
|
|
47
49
|
**What it does:**
|
|
48
|
-
- Creates `src/themes`
|
|
50
|
+
- Creates `src/themes`, `src/app/components`, `src/app/spartan-examples` directories
|
|
49
51
|
- Downloads the selected theme
|
|
52
|
+
- Downloads all GRG Kit components
|
|
53
|
+
- Downloads all spartan-ng examples (56+)
|
|
50
54
|
- Updates `src/styles.css` with theme import
|
|
51
55
|
|
|
52
56
|
**Available themes:**
|
|
@@ -57,187 +61,126 @@ Examples:
|
|
|
57
61
|
- `amber-minimal` - Warm amber accents
|
|
58
62
|
- `mocks` - Theme for mockups and prototypes
|
|
59
63
|
|
|
60
|
-
### `grg add
|
|
64
|
+
### `grg add block`
|
|
61
65
|
|
|
62
|
-
Add
|
|
66
|
+
Add blocks to your project.
|
|
63
67
|
|
|
64
68
|
```bash
|
|
65
|
-
grg add
|
|
69
|
+
grg add block [options]
|
|
66
70
|
|
|
67
71
|
Options:
|
|
72
|
+
--all Add all blocks
|
|
73
|
+
--auth Add authentication block (login, signup, forgot password)
|
|
74
|
+
--shell Add app shell block (sidebar, header, content area)
|
|
75
|
+
--settings Add settings block (settings page with sidebar navigation)
|
|
68
76
|
-o, --output <path> Custom output directory
|
|
69
77
|
|
|
70
78
|
Examples:
|
|
71
|
-
grg add
|
|
72
|
-
grg add
|
|
73
|
-
grg add
|
|
74
|
-
grg add examples:button
|
|
75
|
-
grg add examples:all
|
|
79
|
+
grg add block --auth
|
|
80
|
+
grg add block --shell --settings
|
|
81
|
+
grg add block --all
|
|
76
82
|
```
|
|
77
83
|
|
|
78
|
-
**Resource format:** `<category>:<name>`
|
|
79
|
-
|
|
80
|
-
**Categories:**
|
|
81
|
-
- `theme` - Pre-built theme files
|
|
82
|
-
- `component` - Reusable components
|
|
83
|
-
- `layout` - Page layouts
|
|
84
|
-
- `examples` - Spartan-NG component examples
|
|
85
|
-
|
|
86
84
|
### `grg list [category]`
|
|
87
85
|
|
|
88
|
-
List available
|
|
86
|
+
List available blocks and themes.
|
|
89
87
|
|
|
90
88
|
```bash
|
|
91
89
|
grg list [category]
|
|
92
90
|
|
|
93
91
|
Examples:
|
|
94
|
-
grg list # Show
|
|
92
|
+
grg list # Show overview
|
|
93
|
+
grg list blocks # List all blocks
|
|
95
94
|
grg list themes # List all themes
|
|
96
|
-
grg list components
|
|
97
|
-
grg list layouts
|
|
98
|
-
grg list examples
|
|
99
95
|
```
|
|
100
96
|
|
|
101
|
-
### `grg
|
|
97
|
+
### `grg llm-prompts`
|
|
102
98
|
|
|
103
|
-
|
|
99
|
+
Generate LLM-specific prompts and rules for AI assistants (Windsurf, Cursor, etc.).
|
|
104
100
|
|
|
105
101
|
```bash
|
|
106
|
-
grg
|
|
102
|
+
grg llm-prompts [options]
|
|
107
103
|
|
|
108
104
|
Options:
|
|
109
|
-
-
|
|
105
|
+
-o, --output <path> Output directory for rules (default: ".windsurf/rules")
|
|
110
106
|
|
|
111
107
|
Examples:
|
|
112
|
-
grg
|
|
113
|
-
grg
|
|
108
|
+
grg llm-prompts
|
|
109
|
+
grg llm-prompts --output .cursor/rules
|
|
114
110
|
```
|
|
115
111
|
|
|
116
|
-
**Purpose:**
|
|
117
|
-
This command outputs structured JSON/YAML metadata that can be consumed by:
|
|
118
|
-
- MCP (Model Context Protocol) servers
|
|
119
|
-
- LLMs for automated resource discovery
|
|
120
|
-
- CI/CD pipelines
|
|
121
|
-
- Documentation generators
|
|
122
|
-
|
|
123
112
|
## MCP Server Integration
|
|
124
113
|
|
|
125
|
-
|
|
114
|
+
For AI assistants to automatically discover and use GRG Kit resources:
|
|
126
115
|
|
|
127
|
-
1.
|
|
128
|
-
2. **Understand command usage** - Syntax, options, examples
|
|
129
|
-
3. **Execute commands automatically** - Based on user intent
|
|
130
|
-
4. **Provide contextual help** - Descriptions, tags, dependencies
|
|
116
|
+
### 1. Install the MCP Server
|
|
131
117
|
|
|
132
|
-
|
|
118
|
+
```bash
|
|
119
|
+
npm install -g @grg-kit/mcp-server
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 2. Configure Your AI Assistant
|
|
123
|
+
|
|
124
|
+
**Windsurf** (`~/.codeium/windsurf/mcp_config.json`):
|
|
133
125
|
|
|
134
126
|
```json
|
|
135
127
|
{
|
|
136
|
-
"
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
"commands": [
|
|
140
|
-
{
|
|
141
|
-
"name": "init",
|
|
142
|
-
"description": "Initialize GRG Kit in your Angular project",
|
|
143
|
-
"usage": "grg init [options]",
|
|
144
|
-
"options": [...],
|
|
145
|
-
"examples": [...],
|
|
146
|
-
"effects": [...]
|
|
128
|
+
"mcpServers": {
|
|
129
|
+
"grg-kit": {
|
|
130
|
+
"command": "grg-mcp-server"
|
|
147
131
|
}
|
|
148
|
-
],
|
|
149
|
-
"resources": {
|
|
150
|
-
"themes": [...],
|
|
151
|
-
"components": [...],
|
|
152
|
-
"layouts": [...],
|
|
153
|
-
"examples": {...}
|
|
154
132
|
}
|
|
155
133
|
}
|
|
156
134
|
```
|
|
157
135
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
### Initialize a new project
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
# Initialize with default theme
|
|
164
|
-
grg init
|
|
165
|
-
|
|
166
|
-
# Initialize with Claude theme
|
|
167
|
-
grg init --theme claude
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### Add resources
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
# Add a different theme
|
|
174
|
-
grg add theme:modern-minimal
|
|
175
|
-
|
|
176
|
-
# Add a component
|
|
177
|
-
grg add component:stepper
|
|
178
|
-
|
|
179
|
-
# Add a layout
|
|
180
|
-
grg add layout:dashboard
|
|
181
|
-
|
|
182
|
-
# Add all Spartan-NG examples
|
|
183
|
-
grg add examples:all
|
|
184
|
-
|
|
185
|
-
# Add specific component examples
|
|
186
|
-
grg add examples:button
|
|
187
|
-
grg add examples:dialog
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### Browse resources
|
|
191
|
-
|
|
192
|
-
```bash
|
|
193
|
-
# See all categories
|
|
194
|
-
grg list
|
|
195
|
-
|
|
196
|
-
# See all themes
|
|
197
|
-
grg list themes
|
|
198
|
-
|
|
199
|
-
# See all components
|
|
200
|
-
grg list components
|
|
136
|
+
**Cursor** (`~/.cursor/mcp_config.json`):
|
|
201
137
|
|
|
202
|
-
|
|
203
|
-
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"mcpServers": {
|
|
141
|
+
"grg-kit": {
|
|
142
|
+
"command": "grg-mcp-server"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
204
146
|
```
|
|
205
147
|
|
|
206
|
-
|
|
148
|
+
### 3. Generate AI Rules
|
|
207
149
|
|
|
208
|
-
### Before (with degit):
|
|
209
150
|
```bash
|
|
210
|
-
|
|
211
|
-
|
|
151
|
+
cd your-angular-project
|
|
152
|
+
grg llm-prompts
|
|
212
153
|
```
|
|
213
154
|
|
|
214
|
-
###
|
|
215
|
-
```bash
|
|
216
|
-
grg add theme:grg-theme
|
|
217
|
-
grg add examples:all
|
|
218
|
-
```
|
|
155
|
+
### 4. Restart Your IDE
|
|
219
156
|
|
|
220
|
-
**
|
|
221
|
-
- ā
|
|
222
|
-
- ā
|
|
223
|
-
- ā
|
|
224
|
-
- ā
|
|
225
|
-
- ā
MCP server integration
|
|
226
|
-
- ā
Structured metadata for LLMs
|
|
157
|
+
**What this enables:**
|
|
158
|
+
- ā
AI automatically searches GRG Kit before writing custom code
|
|
159
|
+
- ā
AI knows about themes, components, blocks, and examples
|
|
160
|
+
- ā
AI follows GRG Kit design system patterns
|
|
161
|
+
- ā
AI can install blocks directly via MCP tools
|
|
227
162
|
|
|
228
|
-
##
|
|
163
|
+
## Quick Reference
|
|
229
164
|
|
|
230
165
|
```bash
|
|
231
|
-
#
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
#
|
|
238
|
-
grg --
|
|
239
|
-
grg
|
|
240
|
-
grg
|
|
166
|
+
# Initialize project
|
|
167
|
+
grg init # Default theme
|
|
168
|
+
grg init --theme claude # Custom theme
|
|
169
|
+
|
|
170
|
+
# Add blocks
|
|
171
|
+
grg add block --auth # Auth pages
|
|
172
|
+
grg add block --shell # App shell
|
|
173
|
+
grg add block --settings # Settings page
|
|
174
|
+
grg add block --auth --shell # Multiple blocks
|
|
175
|
+
grg add block --all # All blocks
|
|
176
|
+
|
|
177
|
+
# List resources
|
|
178
|
+
grg list # Overview
|
|
179
|
+
grg list blocks # Available blocks
|
|
180
|
+
grg list themes # Available themes
|
|
181
|
+
|
|
182
|
+
# AI setup
|
|
183
|
+
grg llm-prompts # Generate AI rules
|
|
241
184
|
```
|
|
242
185
|
|
|
243
186
|
## License
|
package/bin/grg.js
CHANGED
|
@@ -4,40 +4,44 @@ const { Command } = require('commander');
|
|
|
4
4
|
const { add } = require('../commands/add');
|
|
5
5
|
const { list } = require('../commands/list');
|
|
6
6
|
const { init } = require('../commands/init');
|
|
7
|
-
const {
|
|
7
|
+
const { llmPrompts } = require('../commands/llm-prompts');
|
|
8
8
|
|
|
9
9
|
const program = new Command();
|
|
10
10
|
|
|
11
11
|
program
|
|
12
12
|
.name('grg')
|
|
13
|
-
.description('GRG Kit CLI -
|
|
14
|
-
.version('0.
|
|
13
|
+
.description('GRG Kit CLI - Initialize your Angular project with GRG Kit components and add blocks')
|
|
14
|
+
.version('0.3.0');
|
|
15
15
|
|
|
16
|
-
// Init command
|
|
16
|
+
// Init command - sets up everything in one shot
|
|
17
17
|
program
|
|
18
18
|
.command('init')
|
|
19
|
-
.description('Initialize GRG Kit
|
|
19
|
+
.description('Initialize GRG Kit: sets up styles.css with theme, adds all components and spartan-ng examples')
|
|
20
20
|
.option('-t, --theme <name>', 'Theme to install (grg-theme, claude, clean-slate, modern-minimal, amber-minimal, mocks)', 'grg-theme')
|
|
21
21
|
.action(init);
|
|
22
22
|
|
|
23
|
-
// Add command
|
|
23
|
+
// Add block command
|
|
24
24
|
program
|
|
25
|
-
.command('add
|
|
26
|
-
.description('Add
|
|
27
|
-
.option('
|
|
25
|
+
.command('add block')
|
|
26
|
+
.description('Add blocks to your project')
|
|
27
|
+
.option('--all', 'Add all blocks')
|
|
28
|
+
.option('--auth', 'Add authentication block (login, signup, forgot password)')
|
|
29
|
+
.option('--shell', 'Add app shell block (sidebar, header, content area)')
|
|
30
|
+
.option('--settings', 'Add settings block (settings page with sidebar navigation)')
|
|
31
|
+
.option('-o, --output <path>', 'Custom output directory')
|
|
28
32
|
.action(add);
|
|
29
33
|
|
|
30
34
|
// List command
|
|
31
35
|
program
|
|
32
36
|
.command('list [category]')
|
|
33
|
-
.description('List available
|
|
37
|
+
.description('List available blocks and components')
|
|
34
38
|
.action(list);
|
|
35
39
|
|
|
36
|
-
//
|
|
40
|
+
// LLM Prompts command
|
|
37
41
|
program
|
|
38
|
-
.command('
|
|
39
|
-
.description('
|
|
40
|
-
.option('-
|
|
41
|
-
.action(
|
|
42
|
+
.command('llm-prompts')
|
|
43
|
+
.description('Generate LLM-specific prompts and rules for AI assistants (Windsurf, Cursor, etc.)')
|
|
44
|
+
.option('-o, --output <path>', 'Output directory for rules', '.windsurf/rules')
|
|
45
|
+
.action(llmPrompts);
|
|
42
46
|
|
|
43
47
|
program.parse();
|
package/commands/add.js
CHANGED
|
@@ -4,122 +4,80 @@ const ora = require('ora');
|
|
|
4
4
|
const { RESOURCES, REPO } = require('../config/resources');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Add command - downloads
|
|
8
|
-
* Format: grg add
|
|
7
|
+
* Add command - downloads blocks
|
|
8
|
+
* Format: grg add block [options]
|
|
9
9
|
* Examples:
|
|
10
|
-
* grg add
|
|
11
|
-
* grg add
|
|
12
|
-
* grg add
|
|
13
|
-
* grg add examples:all
|
|
10
|
+
* grg add block --auth
|
|
11
|
+
* grg add block --shell --settings
|
|
12
|
+
* grg add block --all
|
|
14
13
|
*/
|
|
15
|
-
async function add(
|
|
16
|
-
|
|
14
|
+
async function add(options) {
|
|
15
|
+
// Determine which blocks to add
|
|
16
|
+
const blocksToAdd = [];
|
|
17
|
+
|
|
18
|
+
if (options.all) {
|
|
19
|
+
blocksToAdd.push(...RESOURCES.blocks);
|
|
20
|
+
} else {
|
|
21
|
+
if (options.auth) {
|
|
22
|
+
const block = RESOURCES.blocks.find(b => b.name === 'auth');
|
|
23
|
+
if (block) blocksToAdd.push(block);
|
|
24
|
+
}
|
|
25
|
+
if (options.shell) {
|
|
26
|
+
const block = RESOURCES.blocks.find(b => b.name === 'shell');
|
|
27
|
+
if (block) blocksToAdd.push(block);
|
|
28
|
+
}
|
|
29
|
+
if (options.settings) {
|
|
30
|
+
const block = RESOURCES.blocks.find(b => b.name === 'settings');
|
|
31
|
+
if (block) blocksToAdd.push(block);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
17
34
|
|
|
18
|
-
if (
|
|
19
|
-
console.
|
|
20
|
-
console.log(chalk.
|
|
21
|
-
console.log(' grg add
|
|
22
|
-
console.log(' grg add
|
|
23
|
-
console.log(' grg add
|
|
24
|
-
console.log('
|
|
35
|
+
if (blocksToAdd.length === 0) {
|
|
36
|
+
console.log(chalk.yellow('\nNo blocks specified. Use one of the following options:\n'));
|
|
37
|
+
console.log(chalk.cyan(' grg add block --all'), chalk.gray(' Add all blocks'));
|
|
38
|
+
console.log(chalk.cyan(' grg add block --auth'), chalk.gray(' Add authentication block'));
|
|
39
|
+
console.log(chalk.cyan(' grg add block --shell'), chalk.gray(' Add app shell block'));
|
|
40
|
+
console.log(chalk.cyan(' grg add block --settings'), chalk.gray(' Add settings block'));
|
|
41
|
+
console.log(chalk.gray('\nRun'), chalk.cyan('grg list blocks'), chalk.gray('for more details'));
|
|
25
42
|
process.exit(1);
|
|
26
43
|
}
|
|
27
44
|
|
|
28
|
-
|
|
29
|
-
let sourcePath;
|
|
30
|
-
let outputPath;
|
|
31
|
-
|
|
32
|
-
// Find the resource
|
|
33
|
-
switch (category) {
|
|
34
|
-
case 'theme':
|
|
35
|
-
resourceData = RESOURCES.themes.find(t => t.name === name);
|
|
36
|
-
if (resourceData) {
|
|
37
|
-
sourcePath = resourceData.path;
|
|
38
|
-
outputPath = options.output || resourceData.defaultOutput;
|
|
39
|
-
}
|
|
40
|
-
break;
|
|
41
|
-
|
|
42
|
-
case 'component':
|
|
43
|
-
resourceData = RESOURCES.components.find(c => c.name === name);
|
|
44
|
-
if (resourceData) {
|
|
45
|
-
sourcePath = resourceData.path;
|
|
46
|
-
outputPath = options.output || resourceData.defaultOutput;
|
|
47
|
-
}
|
|
48
|
-
break;
|
|
49
|
-
|
|
50
|
-
case 'layout':
|
|
51
|
-
resourceData = RESOURCES.layouts.find(l => l.name === name);
|
|
52
|
-
if (resourceData) {
|
|
53
|
-
sourcePath = resourceData.path;
|
|
54
|
-
outputPath = options.output || resourceData.defaultOutput;
|
|
55
|
-
}
|
|
56
|
-
break;
|
|
57
|
-
|
|
58
|
-
case 'examples':
|
|
59
|
-
if (name === 'all') {
|
|
60
|
-
resourceData = RESOURCES.examples.all;
|
|
61
|
-
sourcePath = resourceData.path;
|
|
62
|
-
outputPath = options.output || resourceData.defaultOutput;
|
|
63
|
-
} else {
|
|
64
|
-
resourceData = RESOURCES.examples.components.find(e => e.name === name);
|
|
65
|
-
if (resourceData) {
|
|
66
|
-
sourcePath = resourceData.path;
|
|
67
|
-
outputPath = options.output || resourceData.defaultOutput;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
break;
|
|
71
|
-
|
|
72
|
-
default:
|
|
73
|
-
console.error(chalk.red(`Error: Unknown category "${category}"`));
|
|
74
|
-
console.log(chalk.yellow('Valid categories: theme, component, layout, examples'));
|
|
75
|
-
process.exit(1);
|
|
76
|
-
}
|
|
45
|
+
console.log(chalk.bold.cyan(`\nš¦ Adding ${blocksToAdd.length} block(s)\n`));
|
|
77
46
|
|
|
78
|
-
|
|
79
|
-
console.error(chalk.red(`Error: Resource "${name}" not found in category "${category}"`));
|
|
80
|
-
console.log(chalk.yellow(`\nRun ${chalk.cyan('grg list ' + category + 's')} to see available resources`));
|
|
81
|
-
process.exit(1);
|
|
82
|
-
}
|
|
47
|
+
const spinner = ora();
|
|
83
48
|
|
|
84
|
-
|
|
85
|
-
|
|
49
|
+
for (const block of blocksToAdd) {
|
|
50
|
+
const outputPath = options.output
|
|
51
|
+
? `${options.output}/${block.name}`
|
|
52
|
+
: block.defaultOutput;
|
|
86
53
|
|
|
87
|
-
|
|
88
|
-
const emitter = degit(`${REPO}/${sourcePath}`, {
|
|
89
|
-
cache: false,
|
|
90
|
-
force: true,
|
|
91
|
-
verbose: false,
|
|
92
|
-
});
|
|
54
|
+
spinner.start(`Downloading ${block.title}...`);
|
|
93
55
|
|
|
94
|
-
|
|
56
|
+
try {
|
|
57
|
+
const emitter = degit(`${REPO}/${block.path}`, {
|
|
58
|
+
cache: false,
|
|
59
|
+
force: true,
|
|
60
|
+
verbose: false,
|
|
61
|
+
});
|
|
95
62
|
|
|
96
|
-
|
|
97
|
-
console.log(chalk.gray(` Location: ${outputPath}`));
|
|
98
|
-
|
|
99
|
-
if (resourceData.description) {
|
|
100
|
-
console.log(chalk.gray(` ${resourceData.description}`));
|
|
101
|
-
}
|
|
63
|
+
await emitter.clone(outputPath);
|
|
102
64
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
65
|
+
spinner.succeed(chalk.green(`ā ${block.title} added`));
|
|
66
|
+
console.log(chalk.gray(` Location: ${outputPath}`));
|
|
67
|
+
|
|
68
|
+
// Show dependencies if any
|
|
69
|
+
if (block.dependencies && block.dependencies.length > 0) {
|
|
70
|
+
console.log(chalk.gray(` Dependencies: ${block.dependencies.join(', ')}`));
|
|
71
|
+
}
|
|
72
|
+
console.log();
|
|
109
73
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
console.
|
|
113
|
-
resourceData.dependencies.forEach(dep => {
|
|
114
|
-
console.log(chalk.gray(` - ${dep}`));
|
|
115
|
-
});
|
|
74
|
+
} catch (error) {
|
|
75
|
+
spinner.fail(chalk.red(`Failed to download ${block.title}`));
|
|
76
|
+
console.error(chalk.red(error.message));
|
|
116
77
|
}
|
|
117
|
-
|
|
118
|
-
} catch (error) {
|
|
119
|
-
spinner.fail(chalk.red('Failed to download resource'));
|
|
120
|
-
console.error(chalk.red(error.message));
|
|
121
|
-
process.exit(1);
|
|
122
78
|
}
|
|
79
|
+
|
|
80
|
+
console.log(chalk.bold.green('⨠Done!'));
|
|
123
81
|
}
|
|
124
82
|
|
|
125
83
|
module.exports = { add };
|
package/commands/init.js
CHANGED
|
@@ -7,7 +7,7 @@ const { RESOURCES, REPO } = require('../config/resources');
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Init command - initializes GRG Kit in the project
|
|
10
|
-
*
|
|
10
|
+
* Downloads theme, all components, and all spartan-ng examples in one shot
|
|
11
11
|
*/
|
|
12
12
|
async function init(options) {
|
|
13
13
|
const themeName = options.theme || 'grg-theme';
|
|
@@ -22,36 +22,74 @@ async function init(options) {
|
|
|
22
22
|
|
|
23
23
|
console.log(chalk.bold.cyan('\nš Initializing GRG Kit\n'));
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const spinner = ora();
|
|
26
|
+
|
|
27
|
+
// Step 1: Create directories
|
|
28
|
+
spinner.start('Creating directories...');
|
|
27
29
|
try {
|
|
28
30
|
await fs.mkdir('src/themes', { recursive: true });
|
|
29
|
-
|
|
31
|
+
await fs.mkdir('src/app/components', { recursive: true });
|
|
32
|
+
await fs.mkdir('src/app/spartan-examples', { recursive: true });
|
|
33
|
+
spinner.succeed(chalk.green('ā Created directories'));
|
|
30
34
|
} catch (error) {
|
|
31
|
-
spinner.fail(chalk.red('Failed to create
|
|
35
|
+
spinner.fail(chalk.red('Failed to create directories'));
|
|
32
36
|
console.error(chalk.red(error.message));
|
|
33
37
|
process.exit(1);
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
// Step 2: Download theme
|
|
37
|
-
spinner.start(`Downloading ${theme.title}...`);
|
|
41
|
+
spinner.start(`Downloading ${theme.title} theme...`);
|
|
38
42
|
try {
|
|
39
43
|
const emitter = degit(`${REPO}/${theme.path}`, {
|
|
40
44
|
cache: false,
|
|
41
45
|
force: true,
|
|
42
46
|
verbose: false,
|
|
43
47
|
});
|
|
44
|
-
|
|
45
48
|
await emitter.clone(theme.defaultOutput);
|
|
46
|
-
spinner.succeed(chalk.green(`ā Downloaded ${theme.title}`));
|
|
49
|
+
spinner.succeed(chalk.green(`ā Downloaded ${theme.title} theme`));
|
|
47
50
|
} catch (error) {
|
|
48
51
|
spinner.fail(chalk.red('Failed to download theme'));
|
|
49
52
|
console.error(chalk.red(error.message));
|
|
50
53
|
process.exit(1);
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
// Step 3:
|
|
54
|
-
spinner.start(
|
|
56
|
+
// Step 3: Download all components
|
|
57
|
+
spinner.start(`Downloading ${RESOURCES.components.length} components...`);
|
|
58
|
+
try {
|
|
59
|
+
for (const component of RESOURCES.components) {
|
|
60
|
+
const emitter = degit(`${REPO}/${component.path}`, {
|
|
61
|
+
cache: false,
|
|
62
|
+
force: true,
|
|
63
|
+
verbose: false,
|
|
64
|
+
});
|
|
65
|
+
await emitter.clone(component.defaultOutput);
|
|
66
|
+
}
|
|
67
|
+
spinner.succeed(chalk.green(`ā Downloaded ${RESOURCES.components.length} components`));
|
|
68
|
+
} catch (error) {
|
|
69
|
+
spinner.fail(chalk.red('Failed to download components'));
|
|
70
|
+
console.error(chalk.red(error.message));
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Step 4: Download all spartan-ng examples
|
|
75
|
+
const examplesAll = RESOURCES.examples.all;
|
|
76
|
+
spinner.start(`Downloading spartan-ng examples (${examplesAll.count})...`);
|
|
77
|
+
try {
|
|
78
|
+
const emitter = degit(`${REPO}/${examplesAll.path}`, {
|
|
79
|
+
cache: false,
|
|
80
|
+
force: true,
|
|
81
|
+
verbose: false,
|
|
82
|
+
});
|
|
83
|
+
await emitter.clone(examplesAll.defaultOutput);
|
|
84
|
+
spinner.succeed(chalk.green(`ā Downloaded spartan-ng examples (${examplesAll.count})`));
|
|
85
|
+
} catch (error) {
|
|
86
|
+
spinner.fail(chalk.red('Failed to download spartan-ng examples'));
|
|
87
|
+
console.error(chalk.red(error.message));
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Step 5: Update styles.css
|
|
92
|
+
spinner.start('Updating src/styles.css...');
|
|
55
93
|
try {
|
|
56
94
|
const stylesPath = 'src/styles.css';
|
|
57
95
|
let stylesContent = '';
|
|
@@ -66,7 +104,6 @@ async function init(options) {
|
|
|
66
104
|
const themeImport = `@import './themes/${theme.file}';`;
|
|
67
105
|
|
|
68
106
|
if (!stylesContent.includes(themeImport)) {
|
|
69
|
-
// Add required imports if not present
|
|
70
107
|
const requiredImports = [
|
|
71
108
|
'@import "@angular/cdk/overlay-prebuilt.css";',
|
|
72
109
|
'@import "tailwindcss";',
|
|
@@ -89,13 +126,15 @@ async function init(options) {
|
|
|
89
126
|
|
|
90
127
|
// Success message
|
|
91
128
|
console.log(chalk.bold.green('\n⨠GRG Kit initialized successfully!\n'));
|
|
92
|
-
|
|
93
|
-
console.log(chalk.
|
|
129
|
+
|
|
130
|
+
console.log(chalk.bold('Installed:'));
|
|
131
|
+
console.log(chalk.gray(' Theme:'), chalk.cyan(theme.title));
|
|
132
|
+
console.log(chalk.gray(' Components:'), chalk.cyan(`${RESOURCES.components.length} components`));
|
|
133
|
+
console.log(chalk.gray(' Examples:'), chalk.cyan(`${examplesAll.count} spartan-ng examples`));
|
|
94
134
|
|
|
95
135
|
console.log(chalk.yellow('\nNext steps:'));
|
|
96
|
-
console.log(chalk.gray(' 1. Run'), chalk.cyan('grg list'), chalk.gray('to see available
|
|
97
|
-
console.log(chalk.gray(' 2. Add
|
|
98
|
-
console.log(chalk.gray(' 3. Add examples with'), chalk.cyan('grg add examples:all'));
|
|
136
|
+
console.log(chalk.gray(' 1. Run'), chalk.cyan('grg list'), chalk.gray('to see available blocks'));
|
|
137
|
+
console.log(chalk.gray(' 2. Add blocks with'), chalk.cyan('grg add <block-name>'));
|
|
99
138
|
console.log();
|
|
100
139
|
}
|
|
101
140
|
|