-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@angular-devkit/build-angular): update list of known tailwind con…
…figuration files With this change we added `tailwind.config.mjs` and `tailwind.config.ts` to known tailwind config files. Closes #24943 (cherry picked from commit 758b069)
- Loading branch information
1 parent
98cc191
commit 0b45057
Showing
3 changed files
with
49 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
packages/angular_devkit/build_angular/src/utils/tailwind.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import { readdir } from 'node:fs/promises'; | ||
import { join } from 'node:path'; | ||
|
||
const tailwindConfigFiles: string[] = [ | ||
'tailwind.config.js', | ||
'tailwind.config.cjs', | ||
'tailwind.config.mjs', | ||
'tailwind.config.ts', | ||
]; | ||
|
||
export async function findTailwindConfigurationFile( | ||
workspaceRoot: string, | ||
projectRoot: string, | ||
): Promise<string | undefined> { | ||
const dirEntries = [projectRoot, workspaceRoot].map((root) => | ||
readdir(root, { withFileTypes: false }).then((entries) => ({ | ||
root, | ||
files: new Set(entries), | ||
})), | ||
); | ||
|
||
// A configuration file can exist in the project or workspace root | ||
for await (const { root, files } of dirEntries) { | ||
for (const potentialConfig of tailwindConfigFiles) { | ||
if (files.has(potentialConfig)) { | ||
return join(root, potentialConfig); | ||
} | ||
} | ||
} | ||
|
||
return undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters