create-prisma-php-app 1.6.30 → 1.6.32
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 +1 -5
- package/dist/prisma-php.js +31 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -411,7 +411,7 @@ async function main() {
|
|
|
411
411
|
console.log("🚀 ~ main ~ projectName:", projectName);
|
|
412
412
|
let answer = null;
|
|
413
413
|
if (projectName) {
|
|
414
|
-
let useTailwind = args.includes("--
|
|
414
|
+
let useTailwind = args.includes("--tailwindcss");
|
|
415
415
|
let useWebsocket = args.includes("--websocket");
|
|
416
416
|
const predefinedAnswers = {
|
|
417
417
|
projectName,
|
|
@@ -493,16 +493,12 @@ async function main() {
|
|
|
493
493
|
PHP_ROOT_PATH_EXE: "D:\\\\xampp\\\\php\\\\php.exe",
|
|
494
494
|
PHP_GENERATE_CLASS_PATH: "src/lib/prisma/classes",
|
|
495
495
|
};`;
|
|
496
|
-
console.log("🚀 ~ main ~ settingsCode:", settingsCode);
|
|
497
496
|
fs.writeFileSync(settingsPath, settingsCode, { flag: "w" });
|
|
498
|
-
// Create public directory
|
|
499
497
|
const publicDirPath = path.join(projectPath, "public");
|
|
500
498
|
if (!fs.existsSync(publicDirPath)) {
|
|
501
499
|
fs.mkdirSync(publicDirPath);
|
|
502
500
|
}
|
|
503
|
-
// Update css if tailwindcss is not chosen by the user
|
|
504
501
|
if (!answer.tailwindcss) {
|
|
505
|
-
// delete specific files of tailwindcss if not chosen
|
|
506
502
|
const cssPath = path.join(projectPath, "src", "app", "css");
|
|
507
503
|
const tailwindFiles = ["tailwind.css", "styles.css"];
|
|
508
504
|
tailwindFiles.forEach((file) => {
|
package/dist/prisma-php.js
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import { spawn } from "child_process";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import prompts from "prompts";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
const args = process.argv.slice(2);
|
|
10
|
+
const readJsonFile = (filePath) => {
|
|
11
|
+
const jsonData = fs.readFileSync(filePath, "utf8");
|
|
12
|
+
return JSON.parse(jsonData);
|
|
13
|
+
};
|
|
14
|
+
const executeCommand = (command, args = [], options = {}) => {
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
const process = spawn(command, args, Object.assign({ stdio: "inherit", shell: true }, options));
|
|
17
|
+
process.on("error", (error) => {
|
|
18
|
+
console.error(`Execution error: ${error.message}`);
|
|
19
|
+
reject(error);
|
|
20
|
+
});
|
|
21
|
+
process.on("close", (code) => {
|
|
22
|
+
if (code === 0) {
|
|
23
|
+
resolve();
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
reject(new Error(`Process exited with code ${code}`));
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
};
|
|
3
31
|
const main = async () => {
|
|
4
32
|
if (args.length > 0 && args[0] === "update") {
|
|
5
33
|
try {
|
|
@@ -16,11 +44,13 @@ const main = async () => {
|
|
|
16
44
|
const currentDir = process.cwd();
|
|
17
45
|
const configPath = path.join(currentDir, "prisma-php.json");
|
|
18
46
|
const localSettings = readJsonFile(configPath);
|
|
47
|
+
console.log("🚀 ~ main ~ localSettings:", localSettings);
|
|
19
48
|
const commandArgs = [localSettings.projectName];
|
|
20
49
|
if (localSettings.tailwindcss)
|
|
21
50
|
commandArgs.push("--tailwindcss");
|
|
22
51
|
if (localSettings.websocket)
|
|
23
52
|
commandArgs.push("--websocket");
|
|
53
|
+
console.log("🚀 ~ main ~ commandArgs:", commandArgs);
|
|
24
54
|
console.log("Executing command...\n");
|
|
25
55
|
await executeCommand("npx", [
|
|
26
56
|
"create-prisma-php-app@alpha-update-command",
|