@webmate-studio/builder 0.1.5 → 0.1.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.
- package/package.json +3 -2
- package/src/tailwind-generator-v4.js +17 -19
- package/src/tailwind-generator.js +17 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webmate-studio/builder",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Webmate Studio Component Builder",
|
|
6
6
|
"keywords": [
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
+
"@tailwindcss/cli": "^4.1.0",
|
|
28
|
+
"@webmate-studio/builder": "^0.1.5",
|
|
27
29
|
"@webmate-studio/core": "^0.1.0",
|
|
28
30
|
"@webmate-studio/parser": "^0.1.0",
|
|
29
31
|
"alpinejs": "^3.15.0",
|
|
@@ -38,7 +40,6 @@
|
|
|
38
40
|
"react-dom": "^19.2.0",
|
|
39
41
|
"svelte": "^5.41.2",
|
|
40
42
|
"tailwindcss": "^4.1.0",
|
|
41
|
-
"@tailwindcss/cli": "^4.1.0",
|
|
42
43
|
"vue": "^3.5.22"
|
|
43
44
|
}
|
|
44
45
|
}
|
|
@@ -21,27 +21,25 @@ import { createRequire } from 'module';
|
|
|
21
21
|
const require = createRequire(import.meta.url);
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* Get tailwindcss
|
|
25
|
-
* @returns {string}
|
|
24
|
+
* Get tailwindcss CLI path for execution
|
|
25
|
+
* @returns {string} Path to tailwindcss CLI
|
|
26
26
|
*/
|
|
27
27
|
function getTailwindCommand() {
|
|
28
28
|
try {
|
|
29
|
-
// Try to resolve tailwindcss package
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// Check if we're on Windows
|
|
34
|
-
const isWindows = process.platform === 'win32';
|
|
35
|
-
const binName = isWindows ? 'tailwindcss.cmd' : 'tailwindcss';
|
|
36
|
-
|
|
37
|
-
// Build path to bin
|
|
38
|
-
const binPath = join(tailwindDir, '..', '.bin', binName);
|
|
39
|
-
|
|
40
|
-
// Return just npx command - will be resolved at runtime
|
|
41
|
-
return 'npx tailwindcss';
|
|
29
|
+
// Try to resolve @tailwindcss/cli package which contains the actual binary
|
|
30
|
+
const cliPath = require.resolve('@tailwindcss/cli');
|
|
31
|
+
return cliPath;
|
|
42
32
|
} catch (e) {
|
|
43
|
-
// Fallback to
|
|
44
|
-
|
|
33
|
+
// Fallback: try to find tailwindcss package and use its CLI
|
|
34
|
+
try {
|
|
35
|
+
const tailwindPackagePath = require.resolve('tailwindcss/package.json');
|
|
36
|
+
const tailwindDir = dirname(tailwindPackagePath);
|
|
37
|
+
// Tailwind v4 uses @tailwindcss/cli
|
|
38
|
+
const cliPath = join(tailwindDir, '..', '@tailwindcss', 'cli', 'dist', 'index.js');
|
|
39
|
+
return cliPath;
|
|
40
|
+
} catch (e2) {
|
|
41
|
+
throw new Error('Could not find @tailwindcss/cli. Please install it: npm install @tailwindcss/cli');
|
|
42
|
+
}
|
|
45
43
|
}
|
|
46
44
|
}
|
|
47
45
|
|
|
@@ -285,8 +283,8 @@ ${themeCSS}
|
|
|
285
283
|
|
|
286
284
|
// Run Tailwind v4 CLI
|
|
287
285
|
// Tailwind v4 auto-detects HTML files in the same directory
|
|
288
|
-
const
|
|
289
|
-
const command =
|
|
286
|
+
const tailwindCliPath = getTailwindCommand();
|
|
287
|
+
const command = `node "${tailwindCliPath}" -i "${inputPath}" ${minify ? '--minify' : ''}`;
|
|
290
288
|
|
|
291
289
|
// Set NODE_PATH so tailwindcss module can be resolved
|
|
292
290
|
const builderNodeModules = join(__dirname, "..", "node_modules");
|
|
@@ -21,27 +21,25 @@ import { createRequire } from 'module';
|
|
|
21
21
|
const require = createRequire(import.meta.url);
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* Get tailwindcss
|
|
25
|
-
* @returns {string}
|
|
24
|
+
* Get tailwindcss CLI path for execution
|
|
25
|
+
* @returns {string} Path to tailwindcss CLI
|
|
26
26
|
*/
|
|
27
27
|
function getTailwindCommand() {
|
|
28
28
|
try {
|
|
29
|
-
// Try to resolve tailwindcss package
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// Check if we're on Windows
|
|
34
|
-
const isWindows = process.platform === 'win32';
|
|
35
|
-
const binName = isWindows ? 'tailwindcss.cmd' : 'tailwindcss';
|
|
36
|
-
|
|
37
|
-
// Build path to bin
|
|
38
|
-
const binPath = join(tailwindDir, '..', '.bin', binName);
|
|
39
|
-
|
|
40
|
-
// Return just npx command - will be resolved at runtime
|
|
41
|
-
return 'npx tailwindcss';
|
|
29
|
+
// Try to resolve @tailwindcss/cli package which contains the actual binary
|
|
30
|
+
const cliPath = require.resolve('@tailwindcss/cli');
|
|
31
|
+
return cliPath;
|
|
42
32
|
} catch (e) {
|
|
43
|
-
// Fallback to
|
|
44
|
-
|
|
33
|
+
// Fallback: try to find tailwindcss package and use its CLI
|
|
34
|
+
try {
|
|
35
|
+
const tailwindPackagePath = require.resolve('tailwindcss/package.json');
|
|
36
|
+
const tailwindDir = dirname(tailwindPackagePath);
|
|
37
|
+
// Tailwind v4 uses @tailwindcss/cli
|
|
38
|
+
const cliPath = join(tailwindDir, '..', '@tailwindcss', 'cli', 'dist', 'index.js');
|
|
39
|
+
return cliPath;
|
|
40
|
+
} catch (e2) {
|
|
41
|
+
throw new Error('Could not find @tailwindcss/cli. Please install it: npm install @tailwindcss/cli');
|
|
42
|
+
}
|
|
45
43
|
}
|
|
46
44
|
}
|
|
47
45
|
|
|
@@ -264,8 +262,8 @@ export async function generateTailwindCSS(classes, options = {}) {
|
|
|
264
262
|
writeFileSync(htmlPath, dummyHTML);
|
|
265
263
|
|
|
266
264
|
// Run Tailwind CLI
|
|
267
|
-
const
|
|
268
|
-
const command =
|
|
265
|
+
const tailwindCliPath = getTailwindCommand();
|
|
266
|
+
const command = `node "${tailwindCliPath}" -c "${configPath}" -i "${inputPath}" ${minify ? '--minify' : ''}`;
|
|
269
267
|
|
|
270
268
|
const { stdout } = await execAsync(command, {
|
|
271
269
|
maxBuffer: 10 * 1024 * 1024 // 10MB buffer
|