tailwind-react-setup 1.0.0

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 +40 -0
  2. package/package.json +21 -0
package/bin/index.js ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { execSync } from "child_process";
4
+ import fs from "fs";
5
+ import ora from "ora";
6
+ import chalk from "chalk";
7
+
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
+ `
28
+ @tailwind base;
29
+ @tailwind components;
30
+ @tailwind utilities;
31
+ `
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
+ }
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "tailwind-react-setup",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "keywords": [],
11
+ "author": "",
12
+ "license": "ISC",
13
+ "dependencies": {
14
+ "chalk": "^5.6.2",
15
+ "commander": "^14.0.3",
16
+ "ora": "^9.3.0"
17
+ },
18
+ "bin": {
19
+ "tailwind-react-setup": "./bin/index.js"
20
+ }
21
+ }