thecore-auth 0.0.13 → 0.0.15
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 +2 -2
- package/postinstall.js +1 -1
- package/scripts/check-peer-dependencies.js +12 -22
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "thecore-auth",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.15",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/thecore-auth.cjs.js",
|
|
7
7
|
"module": "dist/thecore-auth.esm.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"build": "vite build",
|
|
17
17
|
"lint": "eslint .",
|
|
18
18
|
"preview": "vite preview",
|
|
19
|
-
"postinstall": "node postinstall.js"
|
|
19
|
+
"postinstall": "node postinstall.js --verbose"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"axios": "^1.7.9",
|
package/postinstall.js
CHANGED
|
@@ -10,7 +10,7 @@ const __dirname = path.dirname(__filename);
|
|
|
10
10
|
const scriptPath = path.join(__dirname, "scripts", "check-peer-dependencies.js");
|
|
11
11
|
|
|
12
12
|
try {
|
|
13
|
-
console.log("
|
|
13
|
+
console.log("Eseguendo check-peer-dependencies.js...");
|
|
14
14
|
execSync(`node ${scriptPath}`, { stdio: "inherit" });
|
|
15
15
|
console.log("check-peer-dependencies.js eseguito con successo!");
|
|
16
16
|
} catch (error) {
|
|
@@ -44,19 +44,13 @@ const installTailwind = () => {
|
|
|
44
44
|
console.log("Checking if Tailwind CSS is installed...");
|
|
45
45
|
|
|
46
46
|
try {
|
|
47
|
-
// Verifica se tailwindcss è già presente nelle dipendenze
|
|
48
47
|
const packageJsonPath = path.resolve("package.json");
|
|
49
48
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
50
49
|
|
|
51
50
|
if (!packageJson.devDependencies || !packageJson.devDependencies.tailwindcss) {
|
|
52
51
|
console.log("Tailwind CSS not found. Installing...");
|
|
53
|
-
|
|
54
|
-
// Esegui i comandi per installare tailwindcss
|
|
55
52
|
execSync("npm install -D tailwindcss@3", { stdio: "inherit" });
|
|
56
|
-
|
|
57
|
-
// Esegui npx per generare tailwind.config.js
|
|
58
53
|
execSync("npx tailwindcss init", { stdio: "inherit" });
|
|
59
|
-
|
|
60
54
|
console.log("Tailwind CSS installed successfully.");
|
|
61
55
|
} else {
|
|
62
56
|
console.log("Tailwind CSS is already installed.");
|
|
@@ -72,11 +66,9 @@ const modifyTailwindConfig = () => {
|
|
|
72
66
|
|
|
73
67
|
if (fs.existsSync(tailwindConfigPath)) {
|
|
74
68
|
console.log("Modifying tailwind.config.js...");
|
|
75
|
-
|
|
76
69
|
const configContent = fs.readFileSync(tailwindConfigPath, "utf8");
|
|
77
70
|
|
|
78
71
|
if (!configContent.includes("content:")) {
|
|
79
|
-
// Trova il punto giusto per inserire la configurazione content
|
|
80
72
|
const updatedConfigContent = configContent.replace(
|
|
81
73
|
/module\.exports\s*=\s*{/,
|
|
82
74
|
`module.exports = {
|
|
@@ -99,22 +91,21 @@ const modifyTailwindConfig = () => {
|
|
|
99
91
|
const modifyIndexCss = () => {
|
|
100
92
|
const cssPath = path.resolve("src/index.css");
|
|
101
93
|
|
|
102
|
-
if (fs.existsSync(cssPath)) {
|
|
103
|
-
console.log("
|
|
94
|
+
if (!fs.existsSync(cssPath)) {
|
|
95
|
+
console.log("index.css not found, creating it...");
|
|
96
|
+
fs.writeFileSync(cssPath, "\n");
|
|
97
|
+
}
|
|
104
98
|
|
|
105
|
-
|
|
106
|
-
|
|
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`;
|
|
107
102
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
console.log("Tailwind directives added to index.css.");
|
|
113
|
-
} else {
|
|
114
|
-
console.log("Tailwind directives already present in index.css.");
|
|
115
|
-
}
|
|
103
|
+
if (!cssContent.startsWith(tailwindDirectives)) {
|
|
104
|
+
const updatedCssContent = tailwindDirectives + cssContent;
|
|
105
|
+
fs.writeFileSync(cssPath, updatedCssContent);
|
|
106
|
+
console.log("Tailwind directives added to index.css.");
|
|
116
107
|
} else {
|
|
117
|
-
console.
|
|
108
|
+
console.log("Tailwind directives already present in index.css.");
|
|
118
109
|
}
|
|
119
110
|
};
|
|
120
111
|
|
|
@@ -125,5 +116,4 @@ const checkAndInstallDependencies = () => {
|
|
|
125
116
|
modifyIndexCss();
|
|
126
117
|
};
|
|
127
118
|
|
|
128
|
-
// Esegui tutto
|
|
129
119
|
checkAndInstallDependencies();
|