thecore-auth 0.0.15 → 0.0.17

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "thecore-auth",
3
3
  "private": false,
4
- "version": "0.0.15",
4
+ "version": "0.0.17",
5
5
  "type": "module",
6
6
  "main": "dist/thecore-auth.cjs.js",
7
7
  "module": "dist/thecore-auth.esm.js",
@@ -13,7 +13,7 @@ const installPeerDependencies = () => {
13
13
  "jwt-decode": "^3.1.2"
14
14
  };
15
15
 
16
- const packageJsonPath = path.resolve("package.json");
16
+ const packageJsonPath = path.resolve(__dirname, "../../package.json");
17
17
 
18
18
  if (!fs.existsSync(packageJsonPath)) {
19
19
  console.error("Error: package.json not found");
@@ -33,7 +33,7 @@ const installPeerDependencies = () => {
33
33
 
34
34
  if (!installedVersion) {
35
35
  console.log(`Peer dependency "${pkg}" is missing. Installing...`);
36
- execSync(`npm install ${pkg}@${requiredVersion}`, { stdio: "inherit" });
36
+ execSync(`npm install ${pkg}@${requiredVersion}`, { stdio: "inherit", cwd: path.resolve(__dirname, "../../") });
37
37
  } else {
38
38
  console.log(`Peer dependency "${pkg}" is already installed (version: ${installedVersion}).`);
39
39
  }
@@ -44,13 +44,13 @@ const installTailwind = () => {
44
44
  console.log("Checking if Tailwind CSS is installed...");
45
45
 
46
46
  try {
47
- const packageJsonPath = path.resolve("package.json");
47
+ const packageJsonPath = path.resolve(__dirname, "../../package.json");
48
48
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
49
49
 
50
50
  if (!packageJson.devDependencies || !packageJson.devDependencies.tailwindcss) {
51
51
  console.log("Tailwind CSS not found. Installing...");
52
- execSync("npm install -D tailwindcss@3", { stdio: "inherit" });
53
- execSync("npx tailwindcss init", { stdio: "inherit" });
52
+ execSync("npm install -D tailwindcss@3", { stdio: "inherit", cwd: path.resolve(__dirname, "../../") });
53
+ execSync("npx tailwindcss init", { stdio: "inherit", cwd: path.resolve(__dirname, "../../") });
54
54
  console.log("Tailwind CSS installed successfully.");
55
55
  } else {
56
56
  console.log("Tailwind CSS is already installed.");
@@ -62,7 +62,7 @@ const installTailwind = () => {
62
62
  };
63
63
 
64
64
  const modifyTailwindConfig = () => {
65
- const tailwindConfigPath = path.resolve("tailwind.config.js");
65
+ const tailwindConfigPath = path.resolve(__dirname, "../../tailwind.config.js");
66
66
 
67
67
  if (fs.existsSync(tailwindConfigPath)) {
68
68
  console.log("Modifying tailwind.config.js...");
@@ -89,23 +89,27 @@ const modifyTailwindConfig = () => {
89
89
  };
90
90
 
91
91
  const modifyIndexCss = () => {
92
- const cssPath = path.resolve("src/index.css");
92
+ const cssPath = path.resolve(__dirname, "../../src/index.css");
93
93
 
94
94
  if (!fs.existsSync(cssPath)) {
95
95
  console.log("index.css not found, creating it...");
96
- fs.writeFileSync(cssPath, "\n");
96
+ fs.writeFileSync(cssPath, "");
97
97
  }
98
98
 
99
- console.log("Adding Tailwind directives to the beginning of index.css...");
100
- const cssContent = fs.readFileSync(cssPath, "utf8");
101
- const tailwindDirectives = `@tailwind base;\n@tailwind components;\n@tailwind utilities;\n`;
99
+ if (fs.existsSync(cssPath)) {
100
+ console.log("Adding Tailwind directives to the beginning of index.css...");
101
+ const cssContent = fs.readFileSync(cssPath, "utf8");
102
+ const tailwindDirectives = `@tailwind base;\n@tailwind components;\n@tailwind utilities;\n`;
102
103
 
103
- if (!cssContent.startsWith(tailwindDirectives)) {
104
- const updatedCssContent = tailwindDirectives + cssContent;
105
- fs.writeFileSync(cssPath, updatedCssContent);
106
- console.log("Tailwind directives added to index.css.");
104
+ if (!cssContent.startsWith(tailwindDirectives)) {
105
+ const updatedCssContent = tailwindDirectives + cssContent;
106
+ fs.writeFileSync(cssPath, updatedCssContent);
107
+ console.log("Tailwind directives added to index.css.");
108
+ } else {
109
+ console.log("Tailwind directives already present in index.css.");
110
+ }
107
111
  } else {
108
- console.log("Tailwind directives already present in index.css.");
112
+ console.error("index.css not found");
109
113
  }
110
114
  };
111
115