@webmate-studio/builder 0.1.8 → 0.1.10
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/package.json +1 -2
- package/src/tailwind-generator.js +39 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webmate-studio/builder",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Webmate Studio Component Builder",
|
|
6
6
|
"keywords": [
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@tailwindcss/cli": "^4.1.0",
|
|
28
|
-
"@webmate-studio/builder": "^0.1.7",
|
|
29
28
|
"@webmate-studio/core": "^0.1.0",
|
|
30
29
|
"@webmate-studio/parser": "^0.1.0",
|
|
31
30
|
"alpinejs": "^3.15.0",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { exec } from 'child_process';
|
|
7
7
|
import { promisify } from 'util';
|
|
8
|
-
import { writeFileSync, unlinkSync, mkdtempSync } from 'fs';
|
|
8
|
+
import { writeFileSync, unlinkSync, mkdtempSync, existsSync } from 'fs';
|
|
9
9
|
import { join, dirname } from 'path';
|
|
10
10
|
import { tmpdir } from 'os';
|
|
11
11
|
import { fileURLToPath } from 'url';
|
|
@@ -25,22 +25,47 @@ const require = createRequire(import.meta.url);
|
|
|
25
25
|
* @returns {string} Path to tailwindcss CLI
|
|
26
26
|
*/
|
|
27
27
|
function getTailwindCommand() {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
//
|
|
28
|
+
// Try multiple strategies to find @tailwindcss/cli
|
|
29
|
+
const strategies = [
|
|
30
|
+
// Strategy 1: Direct resolve of main entry
|
|
31
|
+
() => require.resolve('@tailwindcss/cli'),
|
|
32
|
+
|
|
33
|
+
// Strategy 2: Resolve package.json and build path
|
|
34
|
+
() => {
|
|
35
|
+
const pkgPath = require.resolve('@tailwindcss/cli/package.json');
|
|
36
|
+
return join(dirname(pkgPath), 'dist', 'index.js');
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
// Strategy 3: From builder's node_modules
|
|
40
|
+
() => {
|
|
41
|
+
const builderDir = dirname(import.meta.url.replace('file://', ''));
|
|
42
|
+
return join(builderDir, '..', 'node_modules', '@tailwindcss', 'cli', 'dist', 'index.js');
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
// Strategy 4: Relative to tailwindcss package
|
|
46
|
+
() => {
|
|
47
|
+
const tailwindPkg = require.resolve('tailwindcss/package.json');
|
|
48
|
+
const tailwindDir = dirname(tailwindPkg);
|
|
49
|
+
return join(tailwindDir, '..', '@tailwindcss', 'cli', 'dist', 'index.js');
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
for (const strategy of strategies) {
|
|
34
54
|
try {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} catch (
|
|
41
|
-
|
|
55
|
+
const cliPath = strategy();
|
|
56
|
+
// Verify the file exists
|
|
57
|
+
if (existsSync(cliPath)) {
|
|
58
|
+
return cliPath;
|
|
59
|
+
}
|
|
60
|
+
} catch (e) {
|
|
61
|
+
// Try next strategy
|
|
62
|
+
continue;
|
|
42
63
|
}
|
|
43
64
|
}
|
|
65
|
+
|
|
66
|
+
throw new Error(
|
|
67
|
+
'Could not find @tailwindcss/cli. Please ensure @tailwindcss/cli is installed.'
|
|
68
|
+
);
|
|
44
69
|
}
|
|
45
70
|
|
|
46
71
|
/**
|