@moondreamsdev/dreamer-ui 1.5.3 → 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.
Files changed (2) hide show
  1. package/dist/init.js +22 -10
  2. package/package.json +1 -1
package/dist/init.js CHANGED
@@ -21,7 +21,7 @@ function extractColorsFromSource() {
21
21
 
22
22
  if (themeMatch) {
23
23
  const themeContent = themeMatch[1].trim();
24
- return `:root {\n${themeContent}\n}`;
24
+ return `@theme {\n${themeContent}\n}`;
25
25
  } else {
26
26
  throw new Error('Could not find @theme colors block in source file');
27
27
  }
@@ -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
- console.log('\nšŸ“– To use the colors, import the CSS file in your project:');
149
- console.log(` @import '${targetPath}';`);
150
- console.log(' or');
151
- console.log(` import '${targetPath}';`);
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moondreamsdev/dreamer-ui",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
4
4
  "type": "module",
5
5
  "description": "A collection of Tailwind CSS components for React",
6
6
  "main": "dist/index.js",