tailwind-react-setup 1.0.1 → 1.0.2
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/bin/index.js +36 -31
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -2,39 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
import { execSync } from "child_process";
|
|
4
4
|
import fs from "fs";
|
|
5
|
-
import ora from "ora";
|
|
6
|
-
import chalk from "chalk";
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
6
|
+
console.log("Installing Tailwind...");
|
|
7
|
+
|
|
8
|
+
// Step 1: Install
|
|
9
|
+
execSync("npm install -D tailwindcss postcss autoprefixer", {
|
|
10
|
+
stdio: "inherit",
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// Step 2: Init
|
|
14
|
+
execSync("npx tailwindcss init -p", {
|
|
15
|
+
stdio: "inherit",
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// Step 3: Modify tailwind.config.js
|
|
19
|
+
const configContent = `
|
|
20
|
+
/** @type {import('tailwindcss').Config} */
|
|
21
|
+
export default {
|
|
22
|
+
content: [
|
|
23
|
+
"./index.html",
|
|
24
|
+
"./src/**/*.{js,ts,jsx,tsx}",
|
|
25
|
+
],
|
|
26
|
+
theme: {
|
|
27
|
+
extend: {},
|
|
28
|
+
},
|
|
29
|
+
plugins: [],
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
fs.writeFileSync("tailwind.config.js", configContent);
|
|
34
|
+
|
|
35
|
+
// Step 4: Update CSS
|
|
36
|
+
fs.appendFileSync(
|
|
37
|
+
"./src/index.css",
|
|
38
|
+
`
|
|
28
39
|
@tailwind base;
|
|
29
40
|
@tailwind components;
|
|
30
41
|
@tailwind utilities;
|
|
31
42
|
`
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
console.log(chalk.red("index.css not found!"));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
} catch (err) {
|
|
39
|
-
spinner.fail("Error installing Tailwind");
|
|
40
|
-
}
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
console.log("Tailwind setup completed 🚀");
|