@gilav21/shadcn-angular 0.0.3 → 0.0.4

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.
@@ -120,7 +120,55 @@ export async function init(options) {
120
120
  spinner.text = 'Created components directory';
121
121
  // Install dependencies
122
122
  spinner.text = 'Installing dependencies...';
123
- await execa('npm', ['install', 'clsx', 'tailwind-merge', 'class-variance-authority', '@angular/cdk', 'lucide-angular'], { cwd });
123
+ const dependencies = [
124
+ 'clsx',
125
+ 'tailwind-merge',
126
+ 'class-variance-authority',
127
+ '@angular/cdk',
128
+ 'lucide-angular',
129
+ 'tailwindcss',
130
+ 'postcss',
131
+ '@tailwindcss/postcss'
132
+ ];
133
+ await execa('npm', ['install', ...dependencies], { cwd });
134
+ // Setup PostCSS
135
+ spinner.text = 'Configuring PostCSS...';
136
+ const postcssConfigPath = path.join(cwd, 'postcss.config.js');
137
+ const postcssConfigMjsPath = path.join(cwd, 'postcss.config.mjs');
138
+ if (await fs.pathExists(postcssConfigMjsPath)) {
139
+ // Check mjs config
140
+ const content = await fs.readFile(postcssConfigMjsPath, 'utf-8');
141
+ if (!content.includes('@tailwindcss/postcss')) {
142
+ // Very basic append attempt for mjs, safest is to warn or skip complex types
143
+ // But user asked to try.
144
+ // If it's a simple export default { plugins: {} }, we can try to inject.
145
+ // For now, let's just log a warning if we can't safely inject
146
+ console.log(chalk.yellow('\nComputed postcss.config.mjs found. Please manually add "@tailwindcss/postcss" to your plugins.'));
147
+ }
148
+ }
149
+ else if (await fs.pathExists(postcssConfigPath)) {
150
+ let content = await fs.readFile(postcssConfigPath, 'utf-8');
151
+ if (!content.includes('@tailwindcss/postcss')) {
152
+ // Try to inject into plugins object
153
+ if (content.includes('plugins: {')) {
154
+ content = content.replace('plugins: {', 'plugins: {\n \'@tailwindcss/postcss\': {},');
155
+ await fs.writeFile(postcssConfigPath, content);
156
+ }
157
+ else {
158
+ console.log(chalk.yellow('\nExisting postcss.config.js found but structure not recognized. Please manually add "@tailwindcss/postcss" to your plugins.'));
159
+ }
160
+ }
161
+ }
162
+ else {
163
+ // Create new config
164
+ const configContent = `module.exports = {
165
+ plugins: {
166
+ '@tailwindcss/postcss': {},
167
+ },
168
+ }
169
+ `;
170
+ await fs.writeFile(postcssConfigPath, configContent);
171
+ }
124
172
  spinner.succeed(chalk.green('Project initialized successfully!'));
125
173
  console.log('\n' + chalk.bold('Next steps:'));
126
174
  console.log(chalk.dim(' 1. Add components: ') + chalk.cyan('npx shadcn-angular add button'));
@@ -207,7 +207,7 @@ export const registry = {
207
207
  },
208
208
  'toggle-group': {
209
209
  name: 'toggle-group',
210
- files: ['toggle-group.component.ts'],
210
+ files: ['toggle-group.component.ts']
211
211
  },
212
212
  tooltip: {
213
213
  name: 'tooltip',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gilav21/shadcn-angular",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "CLI for adding shadcn-angular components to your project",
5
5
  "bin": {
6
6
  "shadcn-angular": "./dist/index.js"
@@ -138,7 +138,54 @@ export async function init(options: InitOptions) {
138
138
 
139
139
  // Install dependencies
140
140
  spinner.text = 'Installing dependencies...';
141
- await execa('npm', ['install', 'clsx', 'tailwind-merge', 'class-variance-authority', '@angular/cdk', 'lucide-angular'], { cwd });
141
+ const dependencies = [
142
+ 'clsx',
143
+ 'tailwind-merge',
144
+ 'class-variance-authority',
145
+ '@angular/cdk',
146
+ 'lucide-angular',
147
+ 'tailwindcss',
148
+ 'postcss',
149
+ '@tailwindcss/postcss'
150
+ ];
151
+ await execa('npm', ['install', ...dependencies], { cwd });
152
+
153
+ // Setup PostCSS
154
+ spinner.text = 'Configuring PostCSS...';
155
+ const postcssConfigPath = path.join(cwd, 'postcss.config.js');
156
+ const postcssConfigMjsPath = path.join(cwd, 'postcss.config.mjs');
157
+
158
+ if (await fs.pathExists(postcssConfigMjsPath)) {
159
+ // Check mjs config
160
+ const content = await fs.readFile(postcssConfigMjsPath, 'utf-8');
161
+ if (!content.includes('@tailwindcss/postcss')) {
162
+ // Very basic append attempt for mjs, safest is to warn or skip complex types
163
+ // But user asked to try.
164
+ // If it's a simple export default { plugins: {} }, we can try to inject.
165
+ // For now, let's just log a warning if we can't safely inject
166
+ console.log(chalk.yellow('\nComputed postcss.config.mjs found. Please manually add "@tailwindcss/postcss" to your plugins.'));
167
+ }
168
+ } else if (await fs.pathExists(postcssConfigPath)) {
169
+ let content = await fs.readFile(postcssConfigPath, 'utf-8');
170
+ if (!content.includes('@tailwindcss/postcss')) {
171
+ // Try to inject into plugins object
172
+ if (content.includes('plugins: {')) {
173
+ content = content.replace('plugins: {', 'plugins: {\n \'@tailwindcss/postcss\': {},');
174
+ await fs.writeFile(postcssConfigPath, content);
175
+ } else {
176
+ console.log(chalk.yellow('\nExisting postcss.config.js found but structure not recognized. Please manually add "@tailwindcss/postcss" to your plugins.'));
177
+ }
178
+ }
179
+ } else {
180
+ // Create new config
181
+ const configContent = `module.exports = {
182
+ plugins: {
183
+ '@tailwindcss/postcss': {},
184
+ },
185
+ }
186
+ `;
187
+ await fs.writeFile(postcssConfigPath, configContent);
188
+ }
142
189
 
143
190
  spinner.succeed(chalk.green('Project initialized successfully!'));
144
191
 
@@ -216,7 +216,7 @@ export const registry: Record<string, ComponentDefinition> = {
216
216
  },
217
217
  'toggle-group': {
218
218
  name: 'toggle-group',
219
- files: ['toggle-group.component.ts'],
219
+ files: ['toggle-group.component.ts']
220
220
  },
221
221
  tooltip: {
222
222
  name: 'tooltip',