@gilav21/shadcn-angular 0.0.1 → 0.0.3

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.
@@ -9,7 +9,7 @@ import { registry } from '../registry/index.js';
9
9
  const __filename = fileURLToPath(import.meta.url);
10
10
  const __dirname = path.dirname(__filename);
11
11
  // Base URL for the component registry (GitHub raw content)
12
- const REGISTRY_BASE_URL = 'https://raw.githubusercontent.com/gilav21/shadcn-angular/main/packages/components/ui';
12
+ const REGISTRY_BASE_URL = 'https://raw.githubusercontent.com/gilav21/shadcn-angular/master/packages/components/ui';
13
13
  // Components source directory (relative to CLI dist folder) for local dev
14
14
  function getLocalComponentsDir() {
15
15
  // From dist/commands/add.js -> packages/components/ui
@@ -129,10 +129,12 @@ export async function add(components, options) {
129
129
  }
130
130
  }
131
131
  const spinner = ora('Installing components...').start();
132
+ let successCount = 0;
132
133
  try {
133
134
  await fs.ensureDir(targetDir);
134
135
  for (const name of allComponents) {
135
136
  const component = registry[name];
137
+ let componentSuccess = true;
136
138
  for (const file of component.files) {
137
139
  const targetPath = path.join(targetDir, file);
138
140
  try {
@@ -143,15 +145,23 @@ export async function add(components, options) {
143
145
  }
144
146
  catch (err) {
145
147
  spinner.warn(`Could not add ${file}: ${err.message}`);
148
+ componentSuccess = false;
146
149
  }
147
150
  }
151
+ if (componentSuccess)
152
+ successCount++;
153
+ }
154
+ if (successCount > 0) {
155
+ spinner.succeed(chalk.green(`Added ${successCount} component(s)`));
156
+ console.log('\n' + chalk.dim('Components added:'));
157
+ allComponents.forEach(name => {
158
+ console.log(chalk.dim(' - ') + chalk.cyan(name));
159
+ });
160
+ console.log('');
161
+ }
162
+ else {
163
+ spinner.fail(chalk.red('Failed to add any components.'));
148
164
  }
149
- spinner.succeed(chalk.green(`Added ${allComponents.size} component(s)`));
150
- console.log('\n' + chalk.dim('Components added:'));
151
- allComponents.forEach(name => {
152
- console.log(chalk.dim(' - ') + chalk.cyan(name));
153
- });
154
- console.log('');
155
165
  }
156
166
  catch (error) {
157
167
  spinner.fail('Failed to add components');
@@ -14,7 +14,6 @@ export const registry = {
14
14
  'alert-dialog': {
15
15
  name: 'alert-dialog',
16
16
  files: ['alert-dialog.component.ts'],
17
- dependencies: ['button'],
18
17
  },
19
18
  'aspect-ratio': {
20
19
  name: 'aspect-ratio',
@@ -39,12 +38,10 @@ export const registry = {
39
38
  'button-group': {
40
39
  name: 'button-group',
41
40
  files: ['button-group.component.ts'],
42
- dependencies: ['button', 'separator'],
43
41
  },
44
42
  calendar: {
45
43
  name: 'calendar',
46
44
  files: ['calendar.component.ts'],
47
- dependencies: ['button'],
48
45
  },
49
46
  card: {
50
47
  name: 'card',
@@ -53,7 +50,6 @@ export const registry = {
53
50
  carousel: {
54
51
  name: 'carousel',
55
52
  files: ['carousel.component.ts'],
56
- dependencies: ['button'],
57
53
  },
58
54
  checkbox: {
59
55
  name: 'checkbox',
@@ -66,7 +62,7 @@ export const registry = {
66
62
  command: {
67
63
  name: 'command',
68
64
  files: ['command.component.ts'],
69
- dependencies: ['dialog', 'separator'],
65
+ dependencies: ['dialog'],
70
66
  },
71
67
  'context-menu': {
72
68
  name: 'context-menu',
@@ -75,7 +71,7 @@ export const registry = {
75
71
  'date-picker': {
76
72
  name: 'date-picker',
77
73
  files: ['date-picker.component.ts'],
78
- dependencies: ['calendar', 'popover', 'button'],
74
+ dependencies: ['calendar'],
79
75
  },
80
76
  dialog: {
81
77
  name: 'dialog',
@@ -108,7 +104,6 @@ export const registry = {
108
104
  'input-group': {
109
105
  name: 'input-group',
110
106
  files: ['input-group.component.ts'],
111
- dependencies: ['input', 'button'],
112
107
  },
113
108
  'input-otp': {
114
109
  name: 'input-otp',
@@ -137,7 +132,6 @@ export const registry = {
137
132
  pagination: {
138
133
  name: 'pagination',
139
134
  files: ['pagination.component.ts'],
140
- dependencies: ['button'],
141
135
  },
142
136
  popover: {
143
137
  name: 'popover',
@@ -174,7 +168,6 @@ export const registry = {
174
168
  sidebar: {
175
169
  name: 'sidebar',
176
170
  files: ['sidebar.component.ts'],
177
- dependencies: ['button', 'sheet', 'separator', 'tooltip', 'input', 'skeleton'],
178
171
  },
179
172
  skeleton: {
180
173
  name: 'skeleton',
@@ -215,7 +208,6 @@ export const registry = {
215
208
  'toggle-group': {
216
209
  name: 'toggle-group',
217
210
  files: ['toggle-group.component.ts'],
218
- dependencies: ['toggle'],
219
211
  },
220
212
  tooltip: {
221
213
  name: 'tooltip',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gilav21/shadcn-angular",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "CLI for adding shadcn-angular components to your project",
5
5
  "bin": {
6
6
  "shadcn-angular": "./dist/index.js"
@@ -11,7 +11,7 @@ const __filename = fileURLToPath(import.meta.url);
11
11
  const __dirname = path.dirname(__filename);
12
12
 
13
13
  // Base URL for the component registry (GitHub raw content)
14
- const REGISTRY_BASE_URL = 'https://raw.githubusercontent.com/gilav21/shadcn-angular/main/packages/components/ui';
14
+ const REGISTRY_BASE_URL = 'https://raw.githubusercontent.com/gilav21/shadcn-angular/master/packages/components/ui';
15
15
 
16
16
  // Components source directory (relative to CLI dist folder) for local dev
17
17
  function getLocalComponentsDir(): string | null {
@@ -150,12 +150,14 @@ export async function add(components: string[], options: AddOptions) {
150
150
  }
151
151
 
152
152
  const spinner = ora('Installing components...').start();
153
+ let successCount = 0;
153
154
 
154
155
  try {
155
156
  await fs.ensureDir(targetDir);
156
157
 
157
158
  for (const name of allComponents) {
158
159
  const component = registry[name];
160
+ let componentSuccess = true;
159
161
 
160
162
  for (const file of component.files) {
161
163
  const targetPath = path.join(targetDir, file);
@@ -167,17 +169,23 @@ export async function add(components: string[], options: AddOptions) {
167
169
  spinner.text = `Added ${file}`;
168
170
  } catch (err: any) {
169
171
  spinner.warn(`Could not add ${file}: ${err.message}`);
172
+ componentSuccess = false;
170
173
  }
171
174
  }
175
+ if (componentSuccess) successCount++;
172
176
  }
173
177
 
174
- spinner.succeed(chalk.green(`Added ${allComponents.size} component(s)`));
178
+ if (successCount > 0) {
179
+ spinner.succeed(chalk.green(`Added ${successCount} component(s)`));
175
180
 
176
- console.log('\n' + chalk.dim('Components added:'));
177
- allComponents.forEach(name => {
178
- console.log(chalk.dim(' - ') + chalk.cyan(name));
179
- });
180
- console.log('');
181
+ console.log('\n' + chalk.dim('Components added:'));
182
+ allComponents.forEach(name => {
183
+ console.log(chalk.dim(' - ') + chalk.cyan(name));
184
+ });
185
+ console.log('');
186
+ } else {
187
+ spinner.fail(chalk.red('Failed to add any components.'));
188
+ }
181
189
 
182
190
  } catch (error) {
183
191
  spinner.fail('Failed to add components');
@@ -23,7 +23,6 @@ export const registry: Record<string, ComponentDefinition> = {
23
23
  'alert-dialog': {
24
24
  name: 'alert-dialog',
25
25
  files: ['alert-dialog.component.ts'],
26
- dependencies: ['button'],
27
26
  },
28
27
  'aspect-ratio': {
29
28
  name: 'aspect-ratio',
@@ -48,12 +47,10 @@ export const registry: Record<string, ComponentDefinition> = {
48
47
  'button-group': {
49
48
  name: 'button-group',
50
49
  files: ['button-group.component.ts'],
51
- dependencies: ['button', 'separator'],
52
50
  },
53
51
  calendar: {
54
52
  name: 'calendar',
55
53
  files: ['calendar.component.ts'],
56
- dependencies: ['button'],
57
54
  },
58
55
  card: {
59
56
  name: 'card',
@@ -62,7 +59,6 @@ export const registry: Record<string, ComponentDefinition> = {
62
59
  carousel: {
63
60
  name: 'carousel',
64
61
  files: ['carousel.component.ts'],
65
- dependencies: ['button'],
66
62
  },
67
63
  checkbox: {
68
64
  name: 'checkbox',
@@ -75,7 +71,7 @@ export const registry: Record<string, ComponentDefinition> = {
75
71
  command: {
76
72
  name: 'command',
77
73
  files: ['command.component.ts'],
78
- dependencies: ['dialog', 'separator'],
74
+ dependencies: ['dialog'],
79
75
  },
80
76
  'context-menu': {
81
77
  name: 'context-menu',
@@ -84,7 +80,7 @@ export const registry: Record<string, ComponentDefinition> = {
84
80
  'date-picker': {
85
81
  name: 'date-picker',
86
82
  files: ['date-picker.component.ts'],
87
- dependencies: ['calendar', 'popover', 'button'],
83
+ dependencies: ['calendar'],
88
84
  },
89
85
  dialog: {
90
86
  name: 'dialog',
@@ -117,7 +113,6 @@ export const registry: Record<string, ComponentDefinition> = {
117
113
  'input-group': {
118
114
  name: 'input-group',
119
115
  files: ['input-group.component.ts'],
120
- dependencies: ['input', 'button'],
121
116
  },
122
117
  'input-otp': {
123
118
  name: 'input-otp',
@@ -146,7 +141,6 @@ export const registry: Record<string, ComponentDefinition> = {
146
141
  pagination: {
147
142
  name: 'pagination',
148
143
  files: ['pagination.component.ts'],
149
- dependencies: ['button'],
150
144
  },
151
145
  popover: {
152
146
  name: 'popover',
@@ -183,7 +177,6 @@ export const registry: Record<string, ComponentDefinition> = {
183
177
  sidebar: {
184
178
  name: 'sidebar',
185
179
  files: ['sidebar.component.ts'],
186
- dependencies: ['button', 'sheet', 'separator', 'tooltip', 'input', 'skeleton'],
187
180
  },
188
181
  skeleton: {
189
182
  name: 'skeleton',
@@ -224,7 +217,6 @@ export const registry: Record<string, ComponentDefinition> = {
224
217
  'toggle-group': {
225
218
  name: 'toggle-group',
226
219
  files: ['toggle-group.component.ts'],
227
- dependencies: ['toggle'],
228
220
  },
229
221
  tooltip: {
230
222
  name: 'tooltip',