prisma-client-php 0.0.27 → 0.0.28
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/init.js +29 -1
- package/package.json +1 -1
package/dist/init.js
CHANGED
|
@@ -3,6 +3,13 @@ import path from "path";
|
|
|
3
3
|
import { execSync } from "child_process";
|
|
4
4
|
import { getFileMeta } from "./utils.js";
|
|
5
5
|
const { __dirname } = getFileMeta();
|
|
6
|
+
let projectSettings = null;
|
|
7
|
+
function checkExcludeFiles(destPath) {
|
|
8
|
+
return (
|
|
9
|
+
projectSettings?.excludeFilePath?.includes(destPath.replace(/\\/g, "/")) ??
|
|
10
|
+
false
|
|
11
|
+
);
|
|
12
|
+
}
|
|
6
13
|
/**
|
|
7
14
|
* Recursively copies all files and folders from `src` to `dest`,
|
|
8
15
|
* overwriting existing files if they already exist.
|
|
@@ -24,6 +31,7 @@ function copyRecursiveSync(src, dest, base = src, isPrismaPHP = false) {
|
|
|
24
31
|
const destPath = path.join(dest, entry.name);
|
|
25
32
|
const relative = path.relative(base, srcPath);
|
|
26
33
|
const display = path.join(path.basename(base), relative);
|
|
34
|
+
if (checkExcludeFiles(destPath)) return;
|
|
27
35
|
// **Normalize Path to Avoid Issues on Windows**
|
|
28
36
|
const relativePath = path.relative(__dirname, srcPath);
|
|
29
37
|
const validatorFile = path.normalize("src/Lib/Validator.php");
|
|
@@ -149,6 +157,10 @@ function runComposerInstall(packages) {
|
|
|
149
157
|
console.error("Error installing Composer packages:", error);
|
|
150
158
|
}
|
|
151
159
|
}
|
|
160
|
+
const readJsonFile = (filePath) => {
|
|
161
|
+
const jsonData = fs.readFileSync(filePath, "utf8");
|
|
162
|
+
return JSON.parse(jsonData);
|
|
163
|
+
};
|
|
152
164
|
/**
|
|
153
165
|
* Main execution flow.
|
|
154
166
|
*
|
|
@@ -158,8 +170,24 @@ function runComposerInstall(packages) {
|
|
|
158
170
|
*/
|
|
159
171
|
async function main() {
|
|
160
172
|
const isPrismaPHP = process.argv.includes("--prisma-php");
|
|
173
|
+
const currentDir = process.cwd();
|
|
174
|
+
const configPath = path.join(currentDir, "prisma-php.json");
|
|
161
175
|
if (isPrismaPHP) {
|
|
162
|
-
|
|
176
|
+
if (fs.existsSync(configPath)) {
|
|
177
|
+
const localSettings = readJsonFile(configPath);
|
|
178
|
+
let excludeFiles = [];
|
|
179
|
+
localSettings.excludeFiles?.map((file) => {
|
|
180
|
+
const filePath = path.join(currentDir, file);
|
|
181
|
+
if (fs.existsSync(filePath))
|
|
182
|
+
excludeFiles.push(filePath.replace(/\\/g, "/"));
|
|
183
|
+
});
|
|
184
|
+
projectSettings = {
|
|
185
|
+
...localSettings,
|
|
186
|
+
excludeFiles: localSettings.excludeFiles ?? [],
|
|
187
|
+
excludeFilePath: excludeFiles ?? [],
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
await updateComposerJson(currentDir);
|
|
163
191
|
} else {
|
|
164
192
|
runComposerInstall([
|
|
165
193
|
"ezyang/htmlpurifier:^4.18.0",
|
package/package.json
CHANGED