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.
Files changed (2) hide show
  1. package/bin/index.js +36 -31
  2. 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
- const spinner = ora("Installing Tailwind CSS...").start();
9
-
10
- try {
11
- execSync("npm install -D tailwindcss postcss autoprefixer", {
12
- stdio: "inherit",
13
- });
14
-
15
- execSync("npx tailwindcss init -p", {
16
- stdio: "inherit",
17
- });
18
-
19
- spinner.succeed("Tailwind Installed!");
20
-
21
- // Add Tailwind import in index.css
22
- const cssPath = "./src/index.css";
23
-
24
- if (fs.existsSync(cssPath)) {
25
- fs.appendFileSync(
26
- cssPath,
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
- console.log(chalk.green("Tailwind CSS imported successfully!"));
34
- } else {
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 🚀");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind-react-setup",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",