@moondreamsdev/dreamer-ui 1.5.4 ā 1.5.5
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/init.js +21 -9
- package/package.json +1 -1
package/dist/init.js
CHANGED
@@ -31,7 +31,7 @@ function extractColorsFromSource() {
|
|
31
31
|
}
|
32
32
|
}
|
33
33
|
|
34
|
-
function createCSSFile(targetPath, cssContent) {
|
34
|
+
async function createCSSFile(targetPath, cssContent) {
|
35
35
|
try {
|
36
36
|
// Check if file already exists
|
37
37
|
if (existsSync(targetPath)) {
|
@@ -46,25 +46,34 @@ function createCSSFile(targetPath, cssContent) {
|
|
46
46
|
output: process.stdout
|
47
47
|
});
|
48
48
|
|
49
|
+
// Handle Ctrl+C interruption
|
50
|
+
rl.on('SIGINT', () => {
|
51
|
+
console.log('\nš Operation cancelled by user.');
|
52
|
+
rl.close();
|
53
|
+
process.exit(0);
|
54
|
+
});
|
55
|
+
|
49
56
|
return new Promise((resolve) => {
|
50
57
|
rl.question('Do you want to overwrite it? (y/N): ', (answer) => {
|
51
58
|
rl.close();
|
52
59
|
if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
|
53
60
|
writeFile();
|
61
|
+
resolve(true); // Indicate file was written
|
54
62
|
} else {
|
55
63
|
console.log('āļø Skipping CSS generation');
|
64
|
+
resolve(false); // Indicate file was not written
|
56
65
|
}
|
57
|
-
resolve();
|
58
66
|
});
|
59
67
|
});
|
60
68
|
} else {
|
61
69
|
// In CI, skip overwriting
|
62
70
|
console.log('āļø Skipping CSS generation (file exists)');
|
63
|
-
return;
|
71
|
+
return false;
|
64
72
|
}
|
65
73
|
}
|
66
74
|
|
67
75
|
writeFile();
|
76
|
+
return true; // Indicate file was written
|
68
77
|
|
69
78
|
function writeFile() {
|
70
79
|
// Ensure target directory exists
|
@@ -143,12 +152,15 @@ async function main() {
|
|
143
152
|
const cssContent = extractColorsFromSource();
|
144
153
|
|
145
154
|
// Create the file
|
146
|
-
createCSSFile(targetPath, cssContent);
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
155
|
+
const fileCreated = await createCSSFile(targetPath, cssContent);
|
156
|
+
|
157
|
+
// Only show usage instructions if file was actually created/overwritten
|
158
|
+
if (fileCreated) {
|
159
|
+
console.log('\nš To use the colors, import the CSS file in your project:');
|
160
|
+
console.log(` @import '${targetPath}';`);
|
161
|
+
console.log(' or');
|
162
|
+
console.log(` import '${targetPath}';`);
|
163
|
+
}
|
152
164
|
}
|
153
165
|
|
154
166
|
// Run if called directly
|