MCPcopy Create free account
hub / github.com/CedarCopilot/cedar-OS / detectTailwindCSS

Function detectTailwindCSS

packages/cli/src/utils/tailwindSetup.ts:21–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19
20// Check if Tailwind CSS is installed in the project
21export async function detectTailwindCSS(): Promise<TailwindConfig> {
22 try {
23 // Check package.json for tailwindcss dependency
24 const packageJsonPath = path.join(process.cwd(), 'package.json');
25 const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'));
26
27 const deps = {
28 ...packageJson.dependencies,
29 ...packageJson.devDependencies,
30 };
31
32 const hasTailwind = 'tailwindcss' in deps;
33
34 // Check for Tailwind config file
35 const possibleConfigs = [
36 'tailwind.config.js',
37 'tailwind.config.ts',
38 'tailwind.config.mjs',
39 'tailwind.config.cjs',
40 ];
41
42 let configPath: string | undefined;
43 for (const configName of possibleConfigs) {
44 const fullPath = path.join(process.cwd(), configName);
45 try {
46 await fs.access(fullPath);
47 configPath = configName;
48 break;
49 } catch {
50 // File doesn't exist, continue checking
51 }
52 }
53
54 return {
55 hasTailwind,
56 hasConfig: !!configPath,
57 configPath,
58 };
59 } catch {
60 // If we can't read package.json, assume no Tailwind
61 return {
62 hasTailwind: false,
63 hasConfig: false,
64 };
65 }
66}
67
68// Install Tailwind CSS and its peer dependencies
69export async function installTailwindCSS(): Promise<boolean> {

Callers 2

updateTailwindConfigFunction · 0.85
ensureTailwindSetupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected