@moondreamsdev/dreamer-ui 1.3.7 → 1.3.9
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/postinstall.js +15 -15
- package/package.json +2 -2
package/dist/postinstall.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
import { readFileSync, existsSync, mkdirSync, writeFileSync } from 'fs';
|
2
|
+
import { join, dirname } from 'path';
|
3
|
+
import { createInterface } from 'readline';
|
4
4
|
|
5
5
|
function extractColorsFromSource() {
|
6
6
|
try {
|
7
|
-
const sourceFile =
|
8
|
-
const sourceContent =
|
7
|
+
const sourceFile = join(__dirname, '../src/styles.lib.css');
|
8
|
+
const sourceContent = readFileSync(sourceFile, 'utf8');
|
9
9
|
|
10
10
|
// Extract the @theme colors block
|
11
11
|
const themeMatch = sourceContent.match(/@theme colors \{([\s\S]*?)\}/);
|
@@ -25,14 +25,14 @@ function extractColorsFromSource() {
|
|
25
25
|
function createCSSFile(targetPath, cssContent) {
|
26
26
|
try {
|
27
27
|
// Check if file already exists
|
28
|
-
if (
|
28
|
+
if (existsSync(targetPath)) {
|
29
29
|
console.log(`📄 CSS file already exists at: ${targetPath}`);
|
30
30
|
|
31
31
|
// Ask user if they want to overwrite (only in interactive mode)
|
32
32
|
const isCI = process.env.CI || process.env.NODE_ENV === 'production' || !process.stdin.isTTY;
|
33
33
|
|
34
34
|
if (!isCI) {
|
35
|
-
const rl =
|
35
|
+
const rl = createInterface({
|
36
36
|
input: process.stdin,
|
37
37
|
output: process.stdout
|
38
38
|
});
|
@@ -59,13 +59,13 @@ function createCSSFile(targetPath, cssContent) {
|
|
59
59
|
|
60
60
|
function writeFile() {
|
61
61
|
// Ensure target directory exists
|
62
|
-
const targetDir =
|
63
|
-
if (!
|
64
|
-
|
62
|
+
const targetDir = dirname(targetPath);
|
63
|
+
if (!existsSync(targetDir)) {
|
64
|
+
mkdirSync(targetDir, { recursive: true });
|
65
65
|
}
|
66
66
|
|
67
67
|
// Write the CSS file
|
68
|
-
|
68
|
+
writeFileSync(targetPath, cssContent);
|
69
69
|
console.log(`✅ Generated dreamer-ui colors at: ${targetPath}`);
|
70
70
|
}
|
71
71
|
} catch (error) {
|
@@ -85,8 +85,8 @@ function getDefaultPath() {
|
|
85
85
|
];
|
86
86
|
|
87
87
|
for (const p of possiblePaths) {
|
88
|
-
const dir =
|
89
|
-
if (
|
88
|
+
const dir = dirname(p);
|
89
|
+
if (existsSync(dir)) {
|
90
90
|
return p;
|
91
91
|
}
|
92
92
|
}
|
@@ -95,7 +95,7 @@ function getDefaultPath() {
|
|
95
95
|
}
|
96
96
|
|
97
97
|
async function promptUserForPath() {
|
98
|
-
const rl =
|
98
|
+
const rl = createInterface({
|
99
99
|
input: process.stdin,
|
100
100
|
output: process.stdout
|
101
101
|
});
|
@@ -147,4 +147,4 @@ if (require.main === module) {
|
|
147
147
|
main().catch(console.error);
|
148
148
|
}
|
149
149
|
|
150
|
-
|
150
|
+
export default main;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@moondreamsdev/dreamer-ui",
|
3
|
-
"version": "1.3.
|
3
|
+
"version": "1.3.9",
|
4
4
|
"type": "module",
|
5
5
|
"description": "A collection of Tailwind CSS components for React",
|
6
6
|
"main": "dist/index.js",
|
@@ -44,7 +44,7 @@
|
|
44
44
|
"build:scripts": "cp scripts/* dist/",
|
45
45
|
"lint": "eslint .",
|
46
46
|
"preview": "vite preview",
|
47
|
-
"postinstall": "node postinstall.js",
|
47
|
+
"postinstall": "node dist/postinstall.js",
|
48
48
|
"prepublishOnly": "npm run build",
|
49
49
|
"publish": "npm publish --access public"
|
50
50
|
},
|