uniqueui-cli 0.1.4 → 0.1.6
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/dist/commands/add.js +27 -2
- package/dist/debug.js +37 -0
- package/package.json +9 -8
package/dist/commands/add.js
CHANGED
|
@@ -32,7 +32,8 @@ async function add(componentName, options) {
|
|
|
32
32
|
return null;
|
|
33
33
|
return await res.json();
|
|
34
34
|
}
|
|
35
|
-
catch {
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.error(chalk_1.default.yellow(`\nWarning: Failed to fetch from ${baseUrl}:`), error);
|
|
36
37
|
return null;
|
|
37
38
|
}
|
|
38
39
|
}
|
|
@@ -104,13 +105,37 @@ async function add(componentName, options) {
|
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
107
|
async function updateTailwindConfig(configPath, newConfig) {
|
|
108
|
+
// Check for config file existence and handle fallback
|
|
109
|
+
let finalConfigPath = configPath;
|
|
110
|
+
if (!fs_extra_1.default.existsSync(finalConfigPath)) {
|
|
111
|
+
// Try alternatives
|
|
112
|
+
const ext = path_1.default.extname(configPath);
|
|
113
|
+
const base = configPath.slice(0, -ext.length);
|
|
114
|
+
const altExts = [".ts", ".js", ".mjs", ".cjs"];
|
|
115
|
+
const found = altExts.find(e => fs_extra_1.default.existsSync(base + e));
|
|
116
|
+
if (found) {
|
|
117
|
+
console.log(chalk_1.default.yellow(`Config ${configPath} not found, using ${base + found} instead.`));
|
|
118
|
+
finalConfigPath = base + found;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
console.warn(chalk_1.default.yellow(`Tailwind config not found at ${configPath}. Skipping update.`));
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
107
125
|
const project = new ts_morph_1.Project({
|
|
108
126
|
manipulationSettings: {
|
|
109
127
|
quoteKind: ts_morph_1.QuoteKind.Double,
|
|
110
128
|
}
|
|
111
129
|
});
|
|
112
130
|
// Attempt to add the file
|
|
113
|
-
|
|
131
|
+
let sourceFile;
|
|
132
|
+
try {
|
|
133
|
+
sourceFile = project.addSourceFileAtPath(finalConfigPath);
|
|
134
|
+
}
|
|
135
|
+
catch (e) {
|
|
136
|
+
console.error(chalk_1.default.yellow(`Failed to parse tailwind config at ${finalConfigPath}. Skipping update.`), e);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
114
139
|
// Simplistic handling: look for export default or module.exports
|
|
115
140
|
// We expect the config to be an object literal.
|
|
116
141
|
// We need to merge `newConfig.theme.extend` into the existing config.
|
package/dist/debug.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
7
|
+
async function run() {
|
|
8
|
+
console.log('Node:', process.version);
|
|
9
|
+
const urls = [
|
|
10
|
+
'https://uniqueui-platform.vercel.app/registry.json',
|
|
11
|
+
'https://uniqueui-platform.vercel.app/api/registry',
|
|
12
|
+
'https://raw.githubusercontent.com/pras75299/uniqueui/main/registry.json'
|
|
13
|
+
];
|
|
14
|
+
for (const url of urls) {
|
|
15
|
+
try {
|
|
16
|
+
console.log(`\nTesting ${url}...`);
|
|
17
|
+
const res = await (0, node_fetch_1.default)(url);
|
|
18
|
+
console.log('Status:', res.status);
|
|
19
|
+
if (!res.ok) {
|
|
20
|
+
try {
|
|
21
|
+
const body = await res.text();
|
|
22
|
+
console.log('Error Body:', body.slice(0, 200));
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
console.log('No body');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
console.log('Success. Body length:', (await res.text()).length);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
console.error('Fetch Error:', e);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
run();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uniqueui-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "CLI to add beautiful animated UI components from UniqueUI to your React project",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -43,19 +43,20 @@
|
|
|
43
43
|
"node": ">=18"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"
|
|
46
|
+
"@types/node-fetch": "^2.6.13",
|
|
47
47
|
"chalk": "^4.1.2",
|
|
48
|
+
"commander": "^11.1.0",
|
|
48
49
|
"fs-extra": "^11.2.0",
|
|
49
|
-
"
|
|
50
|
-
"zod": "^3.22.4",
|
|
51
|
-
"node-fetch": "^3.3.2",
|
|
50
|
+
"node-fetch": "^2.7.0",
|
|
52
51
|
"ora": "^5.4.1",
|
|
53
|
-
"prompts": "^2.4.2"
|
|
52
|
+
"prompts": "^2.4.2",
|
|
53
|
+
"ts-morph": "^21.0.1",
|
|
54
|
+
"zod": "^3.22.4"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
57
|
+
"@types/fs-extra": "^11.0.4",
|
|
56
58
|
"@types/node": "^20.10.0",
|
|
57
|
-
"typescript": "^5.3.3",
|
|
58
59
|
"@types/prompts": "^2.4.9",
|
|
59
|
-
"
|
|
60
|
+
"typescript": "^5.3.3"
|
|
60
61
|
}
|
|
61
62
|
}
|