@moondreamsdev/dreamer-ui 1.5.4 → 1.5.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.
Files changed (2) hide show
  1. package/dist/init.js +21 -13
  2. package/package.json +1 -1
package/dist/init.js CHANGED
@@ -1,9 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- console.log("āœ… Running dreamer-ui-init from @moondreamsdev/dreamer-ui");
4
-
5
- // Your logic here
6
- // Add your setup logic here, e.g., copying files, initializing configs, etc.
7
3
  import { readFileSync, existsSync, mkdirSync, writeFileSync } from 'fs';
8
4
  import { join, dirname } from 'path';
9
5
  import { createInterface } from 'readline';
@@ -31,7 +27,7 @@ function extractColorsFromSource() {
31
27
  }
32
28
  }
33
29
 
34
- function createCSSFile(targetPath, cssContent) {
30
+ async function createCSSFile(targetPath, cssContent) {
35
31
  try {
36
32
  // Check if file already exists
37
33
  if (existsSync(targetPath)) {
@@ -46,25 +42,34 @@ function createCSSFile(targetPath, cssContent) {
46
42
  output: process.stdout
47
43
  });
48
44
 
45
+ // Handle Ctrl+C interruption
46
+ rl.on('SIGINT', () => {
47
+ console.log('\nšŸ›‘ Operation cancelled by user.');
48
+ rl.close();
49
+ process.exit(0);
50
+ });
51
+
49
52
  return new Promise((resolve) => {
50
53
  rl.question('Do you want to overwrite it? (y/N): ', (answer) => {
51
54
  rl.close();
52
55
  if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
53
56
  writeFile();
57
+ resolve(true); // Indicate file was written
54
58
  } else {
55
59
  console.log('ā­ļø Skipping CSS generation');
60
+ resolve(false); // Indicate file was not written
56
61
  }
57
- resolve();
58
62
  });
59
63
  });
60
64
  } else {
61
65
  // In CI, skip overwriting
62
66
  console.log('ā­ļø Skipping CSS generation (file exists)');
63
- return;
67
+ return false;
64
68
  }
65
69
  }
66
70
 
67
71
  writeFile();
72
+ return true; // Indicate file was written
68
73
 
69
74
  function writeFile() {
70
75
  // Ensure target directory exists
@@ -143,12 +148,15 @@ async function main() {
143
148
  const cssContent = extractColorsFromSource();
144
149
 
145
150
  // 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}';`);
151
+ const fileCreated = await createCSSFile(targetPath, cssContent);
152
+
153
+ // Only show usage instructions if file was actually created/overwritten
154
+ if (fileCreated) {
155
+ console.log('\nšŸ“– To use the colors, import the CSS file in your project:');
156
+ console.log(` @import '${targetPath}';`);
157
+ console.log(' or');
158
+ console.log(` import '${targetPath}';`);
159
+ }
152
160
  }
153
161
 
154
162
  // Run if called directly
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moondreamsdev/dreamer-ui",
3
- "version": "1.5.4",
3
+ "version": "1.5.6",
4
4
  "type": "module",
5
5
  "description": "A collection of Tailwind CSS components for React",
6
6
  "main": "dist/index.js",