purvex-ui 1.0.0 → 1.0.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +36 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "purvex-ui",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "React component generator with Tailwind CSS v4 & Purple Elegant theme",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -3,10 +3,16 @@
3
3
  const { Command } = require('commander');
4
4
  const chalk = require('chalk');
5
5
  const boxen = require('boxen');
6
+ const { readFileSync } = require('fs');
7
+ const { join } = require('path');
8
+
9
+ // Baca versi dari package.json
10
+ const packageJson = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8'));
11
+ const VERSION = packageJson.version;
6
12
 
7
13
  // Banner
8
- const banner = boxen.default(
9
- chalk.green.bold('✨ Purvex UI') +
14
+ const banner = boxen(
15
+ chalk.green.bold(`✨ Purvex UI v${VERSION}`) +
10
16
  chalk.white(' - React Component Generator\n') +
11
17
  chalk.gray('Fast, customizable UI components for React + Tailwind'),
12
18
  {
@@ -25,7 +31,7 @@ const program = new Command();
25
31
  program
26
32
  .name('purvex-ui')
27
33
  .description('CLI untuk Purvex UI - Generator komponen React dengan Tailwind CSS')
28
- .version('0.1.0');
34
+ .version(VERSION);
29
35
 
30
36
  // Command: init
31
37
  program
@@ -55,10 +61,27 @@ program
55
61
  const path = require('path');
56
62
 
57
63
  try {
58
- const registryPath = path.join(__dirname, '..', '..', '..', 'registry', 'components.json');
64
+ // Coba beberapa path untuk registry
65
+ const possiblePaths = [
66
+ path.join(__dirname, '..', 'registry', 'components.json'),
67
+ path.join(__dirname, 'registry', 'components.json'),
68
+ path.join(process.cwd(), 'node_modules', 'purvex-ui', 'registry', 'components.json')
69
+ ];
70
+
71
+ let registryPath = null;
72
+ for (const p of possiblePaths) {
73
+ if (fs.existsSync(p)) {
74
+ registryPath = p;
75
+ break;
76
+ }
77
+ }
59
78
 
60
- if (!fs.existsSync(registryPath)) {
79
+ if (!registryPath) {
61
80
  console.log(chalk.red('❌ Registry tidak ditemukan'));
81
+ console.log(chalk.yellow('\nKomponen yang tersedia:'));
82
+ console.log(chalk.cyan(' • button'));
83
+ console.log(chalk.cyan(' • card'));
84
+ console.log(chalk.cyan(' • avatar'));
62
85
  return;
63
86
  }
64
87
 
@@ -73,10 +96,14 @@ program
73
96
 
74
97
  } catch (error) {
75
98
  console.error(chalk.red('❌ Error:'), error.message);
99
+ // Fallback
100
+ console.log(chalk.blue.bold('\n📦 Komponen (fallback):\n'));
101
+ console.log(chalk.cyan(' • button'));
102
+ console.log(chalk.cyan(' • card'));
103
+ console.log(chalk.cyan(' • avatar'));
76
104
  }
77
105
  });
78
106
 
79
-
80
107
  // Command: setup
81
108
  program
82
109
  .command('setup')
@@ -86,25 +113,7 @@ program
86
113
  await setupProject();
87
114
  });
88
115
 
89
- // Command: fix
90
- program
91
- .command('fix')
92
- .description('Fix Purvex UI configuration (path alias, colors, etc)')
93
- .action(async () => {
94
- const { fixProject } = require('./commands/fix');
95
- await fixProject();
96
- });
97
-
98
- // Command: update-colors
99
- // program
100
- // .command('update-colors')
101
- // .description('Update color palette to Purple Elegant theme')
102
- // .action(async () => {
103
- // const { updateColors } = require('./commands/update-colors');
104
- // await updateColors();
105
- // });
106
-
107
- // Command: install
116
+ // Command: install
108
117
  program
109
118
  .command('install')
110
119
  .description('Install all required dependencies automatically')
@@ -113,7 +122,7 @@ program
113
122
  await installDeps();
114
123
  });
115
124
 
116
- // Command: uninstall
125
+ // Command: uninstall
117
126
  program
118
127
  .command('uninstall')
119
128
  .description('Remove Purvex UI from your project')
@@ -123,4 +132,4 @@ program
123
132
  });
124
133
 
125
134
  // Parse arguments
126
- program.parse();
135
+ program.parse();