create-prisma-php-app 1.6.33 → 1.6.34
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/dist/index.js +9 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -187,7 +187,8 @@ async function executeCopy(baseDir, directoriesToCopy) {
|
|
|
187
187
|
copyRecursiveSync(sourcePath, destPath);
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
|
-
function
|
|
190
|
+
function createOrUpdateTailwindConfig(baseDir) {
|
|
191
|
+
console.log("🚀 ~ createOrUpdateTailwindConfig ~ baseDir:", baseDir);
|
|
191
192
|
const filePath = path.join(baseDir, "tailwind.config.js");
|
|
192
193
|
const newContent = [
|
|
193
194
|
"./src/app/**/*.{html,js,php}",
|
|
@@ -198,7 +199,7 @@ function modifyTailwindConfig(baseDir) {
|
|
|
198
199
|
.map((item) => ` "${item}"`)
|
|
199
200
|
.join(",\n");
|
|
200
201
|
configData = configData.replace(/content: \[\],/g, `content: [\n${contentArrayString}\n],`);
|
|
201
|
-
fs.writeFileSync(filePath, configData, "
|
|
202
|
+
fs.writeFileSync(filePath, configData, { flag: "w" });
|
|
202
203
|
console.log(chalk.green("Tailwind configuration updated successfully."));
|
|
203
204
|
}
|
|
204
205
|
function modifyPostcssConfig(baseDir) {
|
|
@@ -210,7 +211,7 @@ function modifyPostcssConfig(baseDir) {
|
|
|
210
211
|
cssnano: {},
|
|
211
212
|
},
|
|
212
213
|
};`;
|
|
213
|
-
fs.writeFileSync(filePath, newContent, "
|
|
214
|
+
fs.writeFileSync(filePath, newContent, { flag: "w" });
|
|
214
215
|
console.log(chalk.green("postcss.config.js updated successfully."));
|
|
215
216
|
}
|
|
216
217
|
function modifyIndexPHP(baseDir, useTailwind) {
|
|
@@ -224,7 +225,7 @@ function modifyIndexPHP(baseDir, useTailwind) {
|
|
|
224
225
|
: ` <script src="https://cdn.tailwindcss.com"></script> ${stylesAndLinks}`;
|
|
225
226
|
// Insert before the closing </head> tag
|
|
226
227
|
indexContent = indexContent.replace("</head>", `${tailwindLink}\n</head>`);
|
|
227
|
-
fs.writeFileSync(indexPath, indexContent, "
|
|
228
|
+
fs.writeFileSync(indexPath, indexContent, { flag: "w" });
|
|
228
229
|
console.log(chalk.green(`index.php modified successfully for ${useTailwind ? "local Tailwind CSS" : "Tailwind CSS CDN"}.`));
|
|
229
230
|
}
|
|
230
231
|
catch (error) {
|
|
@@ -232,13 +233,13 @@ function modifyIndexPHP(baseDir, useTailwind) {
|
|
|
232
233
|
}
|
|
233
234
|
}
|
|
234
235
|
// This function updates or creates the .env file
|
|
235
|
-
async function
|
|
236
|
+
async function createOrUpdateEnvFile(baseDir, content) {
|
|
236
237
|
const envPath = path.join(baseDir, ".env");
|
|
237
238
|
let envContent = fs.existsSync(envPath)
|
|
238
239
|
? fs.readFileSync(envPath, "utf8")
|
|
239
240
|
: "";
|
|
240
241
|
envContent += `${envContent !== "" ? "\n\n" : ""}${content}`;
|
|
241
|
-
fs.writeFileSync(envPath, envContent);
|
|
242
|
+
fs.writeFileSync(envPath, envContent, { flag: "w" });
|
|
242
243
|
}
|
|
243
244
|
async function createDirectoryStructure(baseDir, answer, projectSettings) {
|
|
244
245
|
console.log("🚀 ~ baseDir:", baseDir);
|
|
@@ -287,7 +288,7 @@ async function createDirectoryStructure(baseDir, answer, projectSettings) {
|
|
|
287
288
|
await updateComposerJson(baseDir, answer);
|
|
288
289
|
await updateIndexJsForWebSocket(baseDir, answer);
|
|
289
290
|
if (answer.tailwindcss) {
|
|
290
|
-
|
|
291
|
+
createOrUpdateTailwindConfig(baseDir);
|
|
291
292
|
modifyIndexPHP(baseDir, true);
|
|
292
293
|
modifyPostcssConfig(baseDir);
|
|
293
294
|
}
|
|
@@ -302,7 +303,7 @@ SMTP_PORT=
|
|
|
302
303
|
SMTP_ENCRYPTION=ssl
|
|
303
304
|
MAIL_FROM=
|
|
304
305
|
MAIL_FROM_NAME=""`;
|
|
305
|
-
await
|
|
306
|
+
await createOrUpdateEnvFile(baseDir, envContent);
|
|
306
307
|
// Add vendor to .gitignore
|
|
307
308
|
await createUpdateGitignoreFile(baseDir, ["vendor"]);
|
|
308
309
|
}
|