create-prisma-php-app 1.20.510 → 1.20.512
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 +11 -21
- package/dist/settings/start-dev.js +63 -122
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -142,27 +142,19 @@ async function updatePackageJson(baseDir, answer) {
|
|
|
142
142
|
Object.assign({}, packageJson.scripts),
|
|
143
143
|
{ "create-swagger-docs": "node settings/swagger-setup.js" }
|
|
144
144
|
);
|
|
145
|
-
answersToInclude.push("swaggerDocs");
|
|
146
|
-
}
|
|
147
|
-
if (answer.swaggerDocs) {
|
|
148
|
-
packageJson.scripts = Object.assign(
|
|
149
|
-
Object.assign({}, packageJson.scripts),
|
|
150
|
-
{ dev: "node settings/start-dev.js" }
|
|
151
|
-
);
|
|
152
145
|
}
|
|
153
146
|
// Initialize with existing scripts
|
|
154
|
-
|
|
147
|
+
let updatedScripts = Object.assign({}, packageJson.scripts);
|
|
155
148
|
// Conditionally add "browser-sync" command
|
|
156
|
-
updatedScripts
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
149
|
+
updatedScripts.browserSync = browserSyncCommand;
|
|
150
|
+
updatedScripts._dev =
|
|
151
|
+
answersToInclude.length > 0
|
|
152
|
+
? `npm-run-all --parallel projectName browserSync ${answersToInclude.join(
|
|
153
|
+
" "
|
|
154
|
+
)}`
|
|
155
|
+
: `npm-run-all --parallel projectName browserSync`;
|
|
156
|
+
updatedScripts.startDev = `node settings/start-dev.js`;
|
|
157
|
+
updatedScripts.dev = `npm run startDev`;
|
|
166
158
|
// Finally, assign the updated scripts back to packageJson
|
|
167
159
|
packageJson.scripts = updatedScripts;
|
|
168
160
|
packageJson.type = "module";
|
|
@@ -933,13 +925,11 @@ async function main() {
|
|
|
933
925
|
"ts-node",
|
|
934
926
|
"http-proxy-middleware@^3.0.0",
|
|
935
927
|
"chalk",
|
|
928
|
+
"npm-run-all",
|
|
936
929
|
];
|
|
937
930
|
if (answer.swaggerDocs) {
|
|
938
931
|
dependencies.push("swagger-jsdoc");
|
|
939
932
|
}
|
|
940
|
-
if (!answer.backendOnly && !answer.swaggerDocs) {
|
|
941
|
-
dependencies.push("npm-run-all");
|
|
942
|
-
}
|
|
943
933
|
if (answer.tailwindcss) {
|
|
944
934
|
dependencies.push(
|
|
945
935
|
"tailwindcss",
|
|
@@ -1,132 +1,73 @@
|
|
|
1
|
-
import { exec
|
|
1
|
+
import { exec } from "child_process";
|
|
2
2
|
import chalk from "chalk";
|
|
3
3
|
import { writeFileSync } from "fs";
|
|
4
4
|
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
try {
|
|
8
|
-
execSync(`command -v ${command}`, { stdio: "ignore" }); // Works for Linux/macOS
|
|
9
|
-
return true;
|
|
10
|
-
} catch {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function startDev() {
|
|
16
|
-
// Start projectName first, since it's always required
|
|
17
|
-
console.log("Starting projectName...");
|
|
18
|
-
const projectName = exec("npm run projectName");
|
|
19
|
-
|
|
20
|
-
projectName.stdout.on("data", (data) => {
|
|
21
|
-
console.log(`projectName: ${data}`);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
projectName.stderr.on("data", (data) => {
|
|
25
|
-
console.error(`projectName error: ${data}`);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
projectName.on("close", (code) => {
|
|
29
|
-
// console.log(`projectName process exited with code ${code}`);
|
|
30
|
-
|
|
31
|
-
// Start browser-sync after projectName completes
|
|
32
|
-
console.log("Starting browser-sync...");
|
|
33
|
-
const browserSync = exec("npm run browser-sync");
|
|
34
|
-
let formattedLog = {
|
|
35
|
-
local: "",
|
|
36
|
-
external: "",
|
|
37
|
-
ui: "",
|
|
38
|
-
uiExternal: "",
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
browserSync.stdout.on("data", (data) => {
|
|
42
|
-
const lines = data.split("\n");
|
|
5
|
+
// Run the original dev command and capture the output
|
|
6
|
+
const devProcess = exec("npm run _dev");
|
|
43
7
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
console.log(chalk.blue("[Browsersync]") + ` ${line.trim()}`);
|
|
47
|
-
} else if (/Access URLs:/.test(line)) {
|
|
48
|
-
console.log(chalk.green("[Browsersync] Access URLs:"));
|
|
49
|
-
} else if (/Local:/.test(line)) {
|
|
50
|
-
const localUrl = line.match(/Local:\s*(http:\/\/.+)/)[1];
|
|
51
|
-
formattedLog.local = localUrl;
|
|
52
|
-
console.log(chalk.white("Local: ") + chalk.cyanBright(localUrl));
|
|
53
|
-
} else if (/^ {4}External:/.test(line)) {
|
|
54
|
-
const externalUrl = line.match(/External:\s*(http:\/\/\S+)/)[1];
|
|
55
|
-
formattedLog.external = externalUrl;
|
|
56
|
-
console.log(
|
|
57
|
-
chalk.white("External: ") + chalk.magentaBright(externalUrl)
|
|
58
|
-
);
|
|
59
|
-
} else if (/UI:/.test(line)) {
|
|
60
|
-
const uiUrl = line.match(/UI:\s*(http:\/\/.+)/)[1];
|
|
61
|
-
formattedLog.ui = uiUrl;
|
|
62
|
-
console.log(chalk.yellow("UI: ") + chalk.cyanBright(uiUrl));
|
|
63
|
-
} else if (/UI External:/.test(line)) {
|
|
64
|
-
const uiExternalUrl = line.match(/UI External:\s*(http:\/\/.+)/)[1];
|
|
65
|
-
formattedLog.uiExternal = uiExternalUrl;
|
|
66
|
-
console.log(
|
|
67
|
-
chalk.yellow("UI External: ") + chalk.magentaBright(uiExternalUrl)
|
|
68
|
-
);
|
|
69
|
-
} else if (/Watching files/.test(line)) {
|
|
70
|
-
console.log(chalk.blue("[Browsersync] Watching files..."));
|
|
71
|
-
const outputPath = "./settings/bs-output.json";
|
|
72
|
-
writeFileSync(
|
|
73
|
-
outputPath,
|
|
74
|
-
JSON.stringify(formattedLog, null, 2),
|
|
75
|
-
"utf-8"
|
|
76
|
-
);
|
|
77
|
-
console.log(`Browser-sync output saved to ${outputPath}`);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
});
|
|
8
|
+
// Use a Set to track logged lines to avoid duplicate logging
|
|
9
|
+
const loggedLines = new Set();
|
|
81
10
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
11
|
+
// Log the output from stdout (standard output)
|
|
12
|
+
devProcess.stdout.on("data", (data) => {
|
|
13
|
+
const dataString = data.toString(); // Ensure data is a string
|
|
85
14
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
tailwind.stderr.on("data", (data) => {
|
|
96
|
-
console.error(chalk.red("tailwind error: ") + data);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
tailwind.on("close", (code) => {
|
|
100
|
-
console.log(`tailwind process exited with code ${code}`);
|
|
101
|
-
});
|
|
102
|
-
} else {
|
|
103
|
-
// console.log(
|
|
104
|
-
// chalk.red("tailwindcss is not installed, skipping tailwind task.")
|
|
105
|
-
// );
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Check if websocket exists, and if so, execute it
|
|
109
|
-
if (commandExists("node")) {
|
|
110
|
-
console.log("Starting websocket...");
|
|
111
|
-
const websocket = exec("npm run websocket");
|
|
112
|
-
|
|
113
|
-
websocket.stdout.on("data", (data) => {
|
|
114
|
-
console.log(chalk.blue("websocket: ") + data);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
websocket.stderr.on("data", (data) => {
|
|
118
|
-
console.error(chalk.red("websocket error: ") + data);
|
|
119
|
-
});
|
|
15
|
+
// Only log if neither "Proxying" nor "Access URLs" have been logged before
|
|
16
|
+
if (
|
|
17
|
+
!dataString.includes("[Browsersync] Proxying:") &&
|
|
18
|
+
!dataString.includes("[Browsersync] Access URLs:") &&
|
|
19
|
+
!loggedLines.has(dataString)
|
|
20
|
+
) {
|
|
21
|
+
console.log(dataString);
|
|
22
|
+
loggedLines.add(dataString); // Add to set to avoid future duplicates
|
|
23
|
+
}
|
|
120
24
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
25
|
+
let formattedLog = {
|
|
26
|
+
local: "",
|
|
27
|
+
external: "",
|
|
28
|
+
ui: "",
|
|
29
|
+
uiExternal: "",
|
|
30
|
+
};
|
|
31
|
+
const lines = dataString.split("\n");
|
|
32
|
+
|
|
33
|
+
lines.forEach((line) => {
|
|
34
|
+
if (/Proxying/.test(line)) {
|
|
35
|
+
console.log(line.trim());
|
|
36
|
+
} else if (/Access URLs:/.test(line)) {
|
|
37
|
+
console.log(chalk.green("[Browsersync] Access URLs:"));
|
|
38
|
+
} else if (/Local:/.test(line)) {
|
|
39
|
+
const localUrl = line.match(/Local:\s*(http:\/\/.+)/)[1];
|
|
40
|
+
formattedLog.local = localUrl;
|
|
41
|
+
console.log(chalk.white("Local: ") + chalk.cyanBright(localUrl));
|
|
42
|
+
} else if (/^ {4}External:/.test(line)) {
|
|
43
|
+
const externalUrl = line.match(/External:\s*(http:\/\/\S+)/)[1];
|
|
44
|
+
formattedLog.external = externalUrl;
|
|
45
|
+
console.log(chalk.white("External: ") + chalk.magentaBright(externalUrl));
|
|
46
|
+
} else if (/UI:/.test(line)) {
|
|
47
|
+
const uiUrl = line.match(/UI:\s*(http:\/\/.+)/)[1];
|
|
48
|
+
formattedLog.ui = uiUrl;
|
|
49
|
+
console.log(chalk.yellow("UI: ") + chalk.cyanBright(uiUrl));
|
|
50
|
+
} else if (/UI External:/.test(line)) {
|
|
51
|
+
const uiExternalUrl = line.match(/UI External:\s*(http:\/\/.+)/)[1];
|
|
52
|
+
formattedLog.uiExternal = uiExternalUrl;
|
|
53
|
+
console.log(
|
|
54
|
+
chalk.yellow("UI External: ") + chalk.magentaBright(uiExternalUrl)
|
|
55
|
+
);
|
|
56
|
+
} else if (/Watching files/.test(line)) {
|
|
57
|
+
console.log(chalk.blue("[Browsersync] Watching files..."));
|
|
58
|
+
const outputPath = "./settings/bs-output.json";
|
|
59
|
+
writeFileSync(outputPath, JSON.stringify(formattedLog, null, 2), "utf-8");
|
|
60
|
+
console.log(`Browser-sync output saved to ${outputPath}`);
|
|
128
61
|
}
|
|
129
62
|
});
|
|
130
|
-
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Log the output from stderr (error output)
|
|
66
|
+
devProcess.stderr.on("data", (data) => {
|
|
67
|
+
console.error(data.toString()); // Convert data to string
|
|
68
|
+
});
|
|
131
69
|
|
|
132
|
-
|
|
70
|
+
// Handle process exit
|
|
71
|
+
devProcess.on("exit", (code) => {
|
|
72
|
+
console.log(`Dev process exited with code ${code}`);
|
|
73
|
+
});
|