create-prisma-php-app 1.6.43 → 1.6.44
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 +2 -6
- package/dist/prisma-php.js +23 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -166,18 +166,14 @@ function copyRecursiveSync(src, dest) {
|
|
|
166
166
|
const exists = fs.existsSync(src);
|
|
167
167
|
const stats = exists && fs.statSync(src);
|
|
168
168
|
const isDirectory = exists && stats && stats.isDirectory();
|
|
169
|
-
console.log("🚀 ~ copyRecursiveSync ~ isDirectory:", isDirectory);
|
|
170
169
|
if (isDirectory) {
|
|
171
|
-
|
|
172
|
-
// fs.rmSync(dest, { recursive: true, force: true }); // Remove the directory if it exists
|
|
173
|
-
// }
|
|
174
|
-
fs.mkdirSync(dest, { recursive: true }); // Recreate the directory
|
|
170
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
175
171
|
fs.readdirSync(src).forEach((childItemName) => {
|
|
176
172
|
copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
|
|
177
173
|
});
|
|
178
174
|
}
|
|
179
175
|
else {
|
|
180
|
-
fs.copyFileSync(src, dest, 0);
|
|
176
|
+
fs.copyFileSync(src, dest, 0);
|
|
181
177
|
}
|
|
182
178
|
}
|
|
183
179
|
// Function to execute the recursive copy for entire directories
|
package/dist/prisma-php.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import chalk from "chalk";
|
|
2
3
|
import { spawn } from "child_process";
|
|
3
4
|
import fs from "fs";
|
|
4
5
|
import path from "path";
|
|
@@ -28,29 +29,42 @@ const executeCommand = (command, args = [], options = {}) => {
|
|
|
28
29
|
});
|
|
29
30
|
});
|
|
30
31
|
};
|
|
32
|
+
async function getAnswer() {
|
|
33
|
+
const questions = [
|
|
34
|
+
{
|
|
35
|
+
type: "toggle",
|
|
36
|
+
name: "shouldProceed",
|
|
37
|
+
message: `This command will update the ${chalk.blue("create-prisma-php-app")} package and overwrite all default files. Do you want to proceed?`,
|
|
38
|
+
initial: false,
|
|
39
|
+
active: "Yes",
|
|
40
|
+
inactive: "No",
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
const onCancel = () => {
|
|
44
|
+
return false;
|
|
45
|
+
};
|
|
46
|
+
const response = await prompts(questions, { onCancel });
|
|
47
|
+
if (Object.keys(response).length === 0) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return response;
|
|
51
|
+
}
|
|
31
52
|
const main = async () => {
|
|
32
53
|
if (args.length > 0 && args[0] === "update") {
|
|
33
54
|
try {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
name: "value",
|
|
37
|
-
message: "This will overwrite existing files and directories. Do you want to continue?",
|
|
38
|
-
initial: false,
|
|
39
|
-
});
|
|
40
|
-
if (!shouldProceed.value) {
|
|
55
|
+
const answer = await getAnswer();
|
|
56
|
+
if (!(answer === null || answer === void 0 ? void 0 : answer.shouldProceed)) {
|
|
41
57
|
console.log("Operation cancelled by the user.");
|
|
42
58
|
return;
|
|
43
59
|
}
|
|
44
60
|
const currentDir = process.cwd();
|
|
45
61
|
const configPath = path.join(currentDir, "prisma-php.json");
|
|
46
62
|
const localSettings = readJsonFile(configPath);
|
|
47
|
-
console.log("🚀 ~ main ~ localSettings:", localSettings);
|
|
48
63
|
const commandArgs = [localSettings.projectName];
|
|
49
64
|
if (localSettings.tailwindcss)
|
|
50
65
|
commandArgs.push("--tailwindcss");
|
|
51
66
|
if (localSettings.websocket)
|
|
52
67
|
commandArgs.push("--websocket");
|
|
53
|
-
console.log("🚀 ~ main ~ commandArgs:", commandArgs);
|
|
54
68
|
console.log("Executing command...\n");
|
|
55
69
|
await executeCommand("npx", [
|
|
56
70
|
"create-prisma-php-app@alpha-update-command",
|