-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Expand file tree
/
Copy pathadd-tailwindcss.ts
More file actions
28 lines (25 loc) · 1.12 KB
/
add-tailwindcss.ts
File metadata and controls
28 lines (25 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { expectFileToExist, expectFileToMatch, rimraf } from '../../../utils/fs';
import { getActivePackageManager, uninstallPackage } from '../../../utils/packages';
import { ng } from '../../../utils/process';
export default async function () {
// In case a previous test installed tailwindcss, clear it.
// (we don't clear node module directories between tests)
// npm does not appear to fully uninstall sometimes
if (getActivePackageManager() === 'npm') {
await rimraf('node_modules/tailwindcss');
}
try {
await ng('add', 'tailwindcss', '--skip-confirmation');
await expectFileToExist('.postcssrc.json');
await expectFileToMatch('src/styles.css', /@import 'tailwindcss';/);
await expectFileToMatch('package.json', /"tailwindcss":/);
await expectFileToMatch('package.json', /"@tailwindcss\/postcss":/);
await expectFileToMatch('package.json', /"postcss":/);
// Ensure the project builds
await ng('build', '--configuration=development');
} finally {
await uninstallPackage('tailwindcss');
await uninstallPackage('@tailwindcss/postcss');
await uninstallPackage('postcss');
}
}