create-prisma-php-app 1.18.4 → 1.18.500
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 +954 -1
- package/dist/prisma-client-php/index.enc +1 -1
- package/dist/prisma-php.js +64 -2
- package/dist/src/app/route.php +11 -0
- package/package.json +1 -1
package/dist/prisma-php.js
CHANGED
|
@@ -1,5 +1,66 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import chalk from
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { spawn } from "child_process";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import prompts from "prompts";
|
|
7
|
+
import { fileURLToPath } from "url";
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = path.dirname(__filename);
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
const readJsonFile = (filePath) => {
|
|
12
|
+
const jsonData = fs.readFileSync(filePath, "utf8");
|
|
13
|
+
return JSON.parse(jsonData);
|
|
14
|
+
};
|
|
15
|
+
const executeCommand = (command, args = [], options = {}) => {
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
const process = spawn(
|
|
18
|
+
command,
|
|
19
|
+
args,
|
|
20
|
+
Object.assign({ stdio: "inherit", shell: true }, options)
|
|
21
|
+
);
|
|
22
|
+
process.on("error", (error) => {
|
|
23
|
+
console.error(`Execution error: ${error.message}`);
|
|
24
|
+
reject(error);
|
|
25
|
+
});
|
|
26
|
+
process.on("close", (code) => {
|
|
27
|
+
if (code === 0) {
|
|
28
|
+
resolve();
|
|
29
|
+
} else {
|
|
30
|
+
reject(new Error(`Process exited with code ${code}`));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
async function getAnswer() {
|
|
36
|
+
const questions = [
|
|
37
|
+
{
|
|
38
|
+
type: "toggle",
|
|
39
|
+
name: "shouldProceed",
|
|
40
|
+
message: `This command will update the ${chalk.blue(
|
|
41
|
+
"create-prisma-php-app"
|
|
42
|
+
)} package and overwrite all default files. ${chalk.blue(
|
|
43
|
+
"Do you want to proceed"
|
|
44
|
+
)}?`,
|
|
45
|
+
initial: false,
|
|
46
|
+
active: "Yes",
|
|
47
|
+
inactive: "No",
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
const onCancel = () => {
|
|
51
|
+
console.log(chalk.red("Operation cancelled by the user."));
|
|
52
|
+
process.exit(0);
|
|
53
|
+
};
|
|
54
|
+
const response = await prompts(questions, { onCancel });
|
|
55
|
+
if (Object.keys(response).length === 0) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
return response;
|
|
59
|
+
}
|
|
60
|
+
const commandsToExecute = {
|
|
61
|
+
generateClass: "npx php generate class",
|
|
62
|
+
update: "npx php update project",
|
|
63
|
+
};
|
|
3
64
|
const main = async () => {
|
|
4
65
|
if (args.length === 0) {
|
|
5
66
|
console.log("No command provided.");
|
|
@@ -32,6 +93,7 @@ const main = async () => {
|
|
|
32
93
|
}
|
|
33
94
|
const localSettings = readJsonFile(configPath);
|
|
34
95
|
const commandArgs = [localSettings.projectName];
|
|
96
|
+
if (localSettings.backendOnly) commandArgs.push("--backend-only");
|
|
35
97
|
if (localSettings.tailwindcss) commandArgs.push("--tailwindcss");
|
|
36
98
|
if (localSettings.websocket) commandArgs.push("--websocket");
|
|
37
99
|
if (localSettings.prisma) commandArgs.push("--prisma");
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
$welcome = 'Welcome to the Prisma PHP Backend Only Starter Kit! This starter kit provides a powerful foundation for building robust PHP applications with Prisma PHP ORM, a modern database toolkit. To create a new route, follow these steps:
|
|
4
|
+
1. Create a new folder inside the "src/app" directory with the name of your route.
|
|
5
|
+
2. Inside the newly created folder, create a route.php file to define your route logic.
|
|
6
|
+
|
|
7
|
+
This will serve as your API endpoint for the newly created route. Feel free to customize and extend the functionality as needed. Happy coding!
|
|
8
|
+
|
|
9
|
+
For more information, visit the official Prisma PHP documentation: https://prismaphp.tsnc.tech/docs?doc=get-started-api';
|
|
10
|
+
|
|
11
|
+
echo json_encode($welcome);
|