weloop-kosign 1.0.2 → 1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weloop-kosign",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "CLI tool for installing Weloop UI components",
5
5
  "keywords": [
6
6
  "weloop",
@@ -164,13 +164,48 @@ async function installPackages(packages) {
164
164
  // FILE OPERATIONS
165
165
  // ============================================================================
166
166
 
167
+ function createDefaultComponentsConfig() {
168
+ const configPath = path.join(process.cwd(), 'components.json');
169
+
170
+ // Detect if it's a Next.js app (app directory) or pages directory
171
+ const hasAppDir = fs.existsSync(path.join(process.cwd(), 'app'));
172
+ const cssPath = hasAppDir ? 'app/globals.css' : 'styles/globals.css';
173
+
174
+ const defaultConfig = {
175
+ style: 'blue',
176
+ rsc: true,
177
+ tsx: true,
178
+ tailwind: {
179
+ config: 'tailwind.config.ts',
180
+ css: cssPath,
181
+ baseColor: 'neutral',
182
+ cssVariables: true,
183
+ prefix: ''
184
+ },
185
+ iconLibrary: 'lucide',
186
+ aliases: {
187
+ components: '@/components',
188
+ utils: '@/lib/utils',
189
+ ui: '@/components/ui',
190
+ lib: '@/lib',
191
+ hooks: '@/hooks'
192
+ },
193
+ registry: 'https://gitlab.com/Sophanithchrek/weloop-shadcn-next-app/-/raw/main/registry/index.json'
194
+ };
195
+
196
+ fs.writeFileSync(configPath, JSON.stringify(defaultConfig, null, 2));
197
+ success(`Created components.json`);
198
+ info(` You can customize this file to match your project setup`);
199
+
200
+ return defaultConfig;
201
+ }
202
+
167
203
  function loadComponentsConfig() {
168
204
  const configPath = path.join(process.cwd(), 'components.json');
169
205
 
170
206
  if (!fs.existsSync(configPath)) {
171
- error('components.json not found. Please initialize your project first.');
172
- info('Create a components.json file with your project configuration.');
173
- process.exit(1);
207
+ info('components.json not found. Creating default configuration...');
208
+ return createDefaultComponentsConfig();
174
209
  }
175
210
 
176
211
  const content = fs.readFileSync(configPath, 'utf-8');
@@ -592,6 +627,12 @@ async function installComponent(componentName, options = {}) {
592
627
  const { overwrite = false, registryUrl = DEFAULT_REGISTRY_URL } = options;
593
628
  const config = loadComponentsConfig();
594
629
 
630
+ // Install tw-animate-css automatically (required for animations)
631
+ if (!checkPackageInstalled('tw-animate-css')) {
632
+ info('Installing tw-animate-css for animations...');
633
+ await installPackages(['tw-animate-css']);
634
+ }
635
+
595
636
  // Install CSS styles early (before component installation)
596
637
  await installCSSStyles(config, registryUrl);
597
638