create-prisma-php-app 1.2.10 → 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 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");
@@ -135,6 +135,14 @@ function modifyIndexPHP(baseDir, useTailwind) {
135
135
  // Insert before the closing </head> tag
136
136
  indexContent = indexContent.replace("</head>", `${tailwindLink}\n</head>`);
137
137
  fs.writeFileSync(indexPath, indexContent, "utf8");
138
+ // Remove src/css if tailwind is not chosen
139
+ if (!useTailwind) {
140
+ const cssPath = path.join(baseDir, "src", "app", "css");
141
+ fs.rm(cssPath, { recursive: true }, (err) => {
142
+ if (err)
143
+ throw err;
144
+ });
145
+ }
138
146
  console.log(chalk.green(`index.php modified successfully for ${useTailwind ? "local Tailwind CSS" : "Tailwind CSS CDN"}.`));
139
147
  }
140
148
  catch (error) {
@@ -148,9 +156,6 @@ async function createDirectoryStructure(baseDir, answer, projectSettings) {
148
156
  { src: "/../composer.json", dest: "/composer.json" },
149
157
  { src: "/../composer.lock", dest: "/composer.lock" },
150
158
  ];
151
- if (answer.tailwindcss) {
152
- filesToCopy.push({ src: "/styles.css", dest: "/src/app/css/styles.css" }, { src: "/tailwind.css", dest: "/src/app/css/tailwind.css" });
153
- }
154
159
  const directoriesToCopy = [
155
160
  {
156
161
  srcDir: "/settings",
@@ -289,13 +294,15 @@ async function main() {
289
294
  // execSync(`composer dump-autoload`, { stdio: "inherit" });
290
295
  // Create settings file
291
296
  const settingsPath = path.join(projectPath, "settings", "project-settings.js");
292
- const settingsCode = `export const projectSettings = {
293
- PROJECT_NAME: "${answer.projectName}",
294
- PROJECT_ROOT_PATH: "${projectPath.replace(/\\/g, "\\\\")}",
295
- PHP_ROOT_PATH_EXE: "D:\\\\xampp\\\\php\\\\php.exe",
296
- 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",
297
302
  };`;
298
303
  fs.writeFileSync(settingsPath, settingsCode);
304
+ // Create public directory
305
+ fs.mkdirSync(path.join(projectPath, "public"));
299
306
  console.log(`${chalk.green("Success!")} Prisma PHP project successfully created in ${answer.projectName}!`);
300
307
  }
301
308
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.2.10",
3
+ "version": "1.2.12",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
File without changes
File without changes