create-prisma-php-app 1.21.1 → 1.21.3
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/bootstrap.php +2 -2
- package/dist/prisma-php.js +1 -62
- package/package.json +1 -1
package/dist/bootstrap.php
CHANGED
|
@@ -672,7 +672,7 @@ try {
|
|
|
672
672
|
}
|
|
673
673
|
|
|
674
674
|
$filePath = APP_PATH . '/' . $uri;
|
|
675
|
-
if (file_exists($filePath)) {
|
|
675
|
+
if (file_exists($filePath) && (!$_fileToInclude === 'route.php' || !$_fileToInclude === 'index.php')) {
|
|
676
676
|
// Check if the file is a PHP file
|
|
677
677
|
if (pathinfo($filePath, PATHINFO_EXTENSION) === 'php') {
|
|
678
678
|
// Include the PHP file without setting the JSON header
|
|
@@ -696,7 +696,7 @@ try {
|
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
698
|
|
|
699
|
-
if (!empty($_contentToInclude) &&
|
|
699
|
+
if (!empty($_contentToInclude) && $_fileToInclude === 'route.php') {
|
|
700
700
|
header('Content-Type: application/json');
|
|
701
701
|
require_once $_contentToInclude;
|
|
702
702
|
exit;
|
package/dist/prisma-php.js
CHANGED
|
@@ -1,66 +1,5 @@
|
|
|
1
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
|
-
};
|
|
2
|
+
import chalk from"chalk";import{spawn}from"child_process";import fs from"fs";import path from"path";import prompts from"prompts";import{fileURLToPath}from"url";const __filename=fileURLToPath(import.meta.url),__dirname=path.dirname(__filename),args=process.argv.slice(2),readJsonFile=e=>{const t=fs.readFileSync(e,"utf8");return JSON.parse(t)},executeCommand=(e,t=[],o={})=>new Promise(((r,a)=>{const s=spawn(e,t,Object.assign({stdio:"inherit",shell:!0},o));s.on("error",(e=>{a(e)})),s.on("close",(e=>{0===e?r():a(new Error(`Process exited with code ${e}`))}))}));async function getAnswer(){const e=[{type:"toggle",name:"shouldProceed",message:`This command will update the ${chalk.blue("create-prisma-php-app")} package and overwrite all default files. ${chalk.blue("Do you want to proceed")}?`,initial:!1,active:"Yes",inactive:"No"}],t=await prompts(e,{onCancel:()=>{process.exit(0)}});return 0===Object.keys(t).length?null:t}const commandsToExecute={generateClass:"npx php generate class",update:"npx php update project"};
|
|
64
3
|
const main = async () => {
|
|
65
4
|
if (args.length === 0) {
|
|
66
5
|
console.log("No command provided.");
|