create-prisma-php-app 1.2.11 → 1.2.12
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 +26 -28
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28,25 +28,25 @@ function configureBrowserSyncCommand(baseDir, projectSettings) {
|
|
|
28
28
|
// We replace instances of "//" that are not preceded by ":"
|
|
29
29
|
const cleanUrl = proxyUrl.replace(/(?<!:)(\/\/+)/g, "/");
|
|
30
30
|
// TypeScript content to write
|
|
31
|
-
const bsConfigTsContent = `
|
|
32
|
-
const { createProxyMiddleware } = require("http-proxy-middleware");
|
|
33
|
-
|
|
34
|
-
module.exports = {
|
|
35
|
-
// Use the 'middleware' option to create a proxy that masks the deep URL.
|
|
36
|
-
middleware: [
|
|
37
|
-
// This middleware intercepts requests to the root and proxies them to the deep path.
|
|
38
|
-
createProxyMiddleware("/", {
|
|
39
|
-
target:
|
|
40
|
-
"${cleanUrl}",
|
|
41
|
-
changeOrigin: true,
|
|
42
|
-
pathRewrite: {
|
|
43
|
-
"^/": "${relativeWebPath}", // Rewrite the path.
|
|
44
|
-
},
|
|
45
|
-
}),
|
|
46
|
-
],
|
|
47
|
-
proxy: "http://localhost:3000", // Proxy the BrowserSync server.
|
|
48
|
-
serveStatic: ["src/app"], // Serve static files from this directory.
|
|
49
|
-
notify: false,
|
|
31
|
+
const bsConfigTsContent = `
|
|
32
|
+
const { createProxyMiddleware } = require("http-proxy-middleware");
|
|
33
|
+
|
|
34
|
+
module.exports = {
|
|
35
|
+
// Use the 'middleware' option to create a proxy that masks the deep URL.
|
|
36
|
+
middleware: [
|
|
37
|
+
// This middleware intercepts requests to the root and proxies them to the deep path.
|
|
38
|
+
createProxyMiddleware("/", {
|
|
39
|
+
target:
|
|
40
|
+
"${cleanUrl}",
|
|
41
|
+
changeOrigin: true,
|
|
42
|
+
pathRewrite: {
|
|
43
|
+
"^/": "${relativeWebPath}", // Rewrite the path.
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
],
|
|
47
|
+
proxy: "http://localhost:3000", // Proxy the BrowserSync server.
|
|
48
|
+
serveStatic: ["src/app"], // Serve static files from this directory.
|
|
49
|
+
notify: false,
|
|
50
50
|
};`;
|
|
51
51
|
// Determine the path and write the bs-config.js
|
|
52
52
|
const bsConfigPath = path.join(baseDir, "settings", "bs-config.cjs");
|
|
@@ -165,10 +165,6 @@ async function createDirectoryStructure(baseDir, answer, projectSettings) {
|
|
|
165
165
|
srcDir: "/prisma",
|
|
166
166
|
destDir: "/prisma",
|
|
167
167
|
},
|
|
168
|
-
{
|
|
169
|
-
srcDir: "/public",
|
|
170
|
-
destDir: "/public",
|
|
171
|
-
},
|
|
172
168
|
{
|
|
173
169
|
srcDir: "/src",
|
|
174
170
|
destDir: "/src",
|
|
@@ -298,13 +294,15 @@ async function main() {
|
|
|
298
294
|
// execSync(`composer dump-autoload`, { stdio: "inherit" });
|
|
299
295
|
// Create settings file
|
|
300
296
|
const settingsPath = path.join(projectPath, "settings", "project-settings.js");
|
|
301
|
-
const settingsCode = `export const projectSettings = {
|
|
302
|
-
PROJECT_NAME: "${answer.projectName}",
|
|
303
|
-
PROJECT_ROOT_PATH: "${projectPath.replace(/\\/g, "\\\\")}",
|
|
304
|
-
PHP_ROOT_PATH_EXE: "D:\\\\xampp\\\\php\\\\php.exe",
|
|
305
|
-
PHP_GENERATE_CLASS_PATH: "src/lib/prisma/classes",
|
|
297
|
+
const settingsCode = `export const projectSettings = {
|
|
298
|
+
PROJECT_NAME: "${answer.projectName}",
|
|
299
|
+
PROJECT_ROOT_PATH: "${projectPath.replace(/\\/g, "\\\\")}",
|
|
300
|
+
PHP_ROOT_PATH_EXE: "D:\\\\xampp\\\\php\\\\php.exe",
|
|
301
|
+
PHP_GENERATE_CLASS_PATH: "src/lib/prisma/classes",
|
|
306
302
|
};`;
|
|
307
303
|
fs.writeFileSync(settingsPath, settingsCode);
|
|
304
|
+
// Create public directory
|
|
305
|
+
fs.mkdirSync(path.join(projectPath, "public"));
|
|
308
306
|
console.log(`${chalk.green("Success!")} Prisma PHP project successfully created in ${answer.projectName}!`);
|
|
309
307
|
}
|
|
310
308
|
catch (error) {
|