purvex-ui 1.0.1 → 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 +1 -1
- package/src/index.js +10 -27
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const { Command } = require('commander');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
|
-
|
|
5
|
+
// Import boxen yang benar
|
|
6
|
+
const boxen = require('boxen').default;
|
|
6
7
|
const { readFileSync } = require('fs');
|
|
7
8
|
const { join } = require('path');
|
|
8
9
|
|
|
@@ -12,8 +13,8 @@ const VERSION = packageJson.version;
|
|
|
12
13
|
|
|
13
14
|
// Banner
|
|
14
15
|
const banner = boxen(
|
|
15
|
-
chalk.green.bold(
|
|
16
|
-
chalk.white(' - React Component Generator
|
|
16
|
+
chalk.green.bold(`✨ Purvex UI v${VERSION}`) +
|
|
17
|
+
chalk.white(' - React Component Generator\n') +
|
|
17
18
|
chalk.gray('Fast, customizable UI components for React + Tailwind'),
|
|
18
19
|
{
|
|
19
20
|
padding: 1,
|
|
@@ -61,24 +62,11 @@ program
|
|
|
61
62
|
const path = require('path');
|
|
62
63
|
|
|
63
64
|
try {
|
|
64
|
-
|
|
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
|
-
];
|
|
65
|
+
const registryPath = path.join(__dirname, '..', 'registry', 'components.json');
|
|
70
66
|
|
|
71
|
-
|
|
72
|
-
for (const p of possiblePaths) {
|
|
73
|
-
if (fs.existsSync(p)) {
|
|
74
|
-
registryPath = p;
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (!registryPath) {
|
|
67
|
+
if (!fs.existsSync(registryPath)) {
|
|
80
68
|
console.log(chalk.red('❌ Registry tidak ditemukan'));
|
|
81
|
-
console.log(chalk.yellow('
|
|
69
|
+
console.log(chalk.yellow('\nKomponen yang tersedia:'));
|
|
82
70
|
console.log(chalk.cyan(' • button'));
|
|
83
71
|
console.log(chalk.cyan(' • card'));
|
|
84
72
|
console.log(chalk.cyan(' • avatar'));
|
|
@@ -88,19 +76,14 @@ program
|
|
|
88
76
|
const registryContent = fs.readFileSync(registryPath, 'utf-8');
|
|
89
77
|
const registry = JSON.parse(registryContent);
|
|
90
78
|
|
|
91
|
-
console.log(chalk.blue.bold('
|
|
79
|
+
console.log(chalk.blue.bold('\n📦 Komponen yang tersedia:\n'));
|
|
92
80
|
registry.components.forEach(comp => {
|
|
93
|
-
console.log(chalk.cyan(
|
|
81
|
+
console.log(chalk.cyan(` • ${comp.name}`));
|
|
94
82
|
});
|
|
95
|
-
console.log(chalk.gray(
|
|
83
|
+
console.log(chalk.gray(`\nTotal: ${registry.components.length} komponen`));
|
|
96
84
|
|
|
97
85
|
} catch (error) {
|
|
98
86
|
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'));
|
|
104
87
|
}
|
|
105
88
|
});
|
|
106
89
|
|