create-prisma-php-app 4.3.6 → 4.3.7

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.
@@ -13,11 +13,12 @@ import {
13
13
  } from "./class-imports";
14
14
  import { checkComponentImports } from "./component-import-checker";
15
15
  import { DebouncedWorker, createSrcWatcher, DEFAULT_AWF } from "./utils.js";
16
+ import chalk from "chalk";
16
17
 
17
18
  const { __dirname } = getFileMeta();
18
19
  const bs: BrowserSyncInstance = browserSync.create();
19
20
 
20
- const PUBLIC_IGNORE_DIRS = [''];
21
+ const PUBLIC_IGNORE_DIRS = [""];
21
22
 
22
23
  const pipeline = new DebouncedWorker(
23
24
  async () => {
@@ -46,18 +47,18 @@ const pipeline = new DebouncedWorker(
46
47
  }
47
48
  },
48
49
  350,
49
- "bs-pipeline"
50
+ "bs-pipeline",
50
51
  );
51
52
 
52
53
  const publicPipeline = new DebouncedWorker(
53
54
  async () => {
54
- console.log("→ Public directory changed, reloading browser...");
55
+ console.log(chalk.cyan("→ Public directory changed, reloading browser..."));
55
56
  if (bs.active) {
56
57
  bs.reload();
57
58
  }
58
59
  },
59
60
  350,
60
- "bs-public-pipeline"
61
+ "bs-public-pipeline",
61
62
  );
62
63
 
63
64
  createSrcWatcher(join(SRC_DIR, "**", "*"), {
@@ -90,16 +91,17 @@ createSrcWatcher(join(PUBLIC_DIR, "**", "*"), {
90
91
 
91
92
  const viteFlagFile = join(__dirname, "..", ".pp", ".vite-build-complete");
92
93
  mkdirSync(dirname(viteFlagFile), { recursive: true });
93
- writeFileSync(viteFlagFile, "");
94
94
 
95
95
  if (!existsSync(viteFlagFile)) {
96
96
  writeFileSync(viteFlagFile, "0");
97
+ } else {
98
+ writeFileSync(viteFlagFile, "");
97
99
  }
98
100
 
99
101
  createSrcWatcher(viteFlagFile, {
100
102
  onEvent: (ev) => {
101
103
  if (ev === "change" && bs.active) {
102
- console.log("→ Vite build complete, reloading browser...");
104
+ console.log(chalk.green("→ Vite build complete, reloading browser..."));
103
105
  bs.reload();
104
106
  }
105
107
  },
@@ -125,30 +127,57 @@ bs.init(
125
127
  pathRewrite: {},
126
128
  }),
127
129
  ],
128
-
129
130
  notify: false,
130
131
  open: false,
131
132
  ghostMode: false,
132
133
  codeSync: true,
134
+ logLevel: "silent",
133
135
  },
134
136
  (err, bsInstance) => {
135
137
  if (err) {
136
- console.error("BrowserSync failed to start:", err);
138
+ console.error(chalk.red("BrowserSync failed to start:"), err);
137
139
  return;
138
140
  }
139
141
 
140
142
  const urls = bsInstance.getOption("urls");
143
+ const localUrl = urls.get("local");
144
+ const externalUrl = urls.get("external");
145
+ const uiUrl = urls.get("ui");
146
+ const uiExtUrl = urls.get("ui-external");
147
+
148
+ console.log("");
149
+ console.log(chalk.green.bold("✔ Ports Configured:"));
150
+ console.log(
151
+ ` ${chalk.blue.bold("Frontend (BrowserSync):")} ${chalk.magenta(localUrl)}`,
152
+ );
153
+ console.log(
154
+ ` ${chalk.yellow.bold("Backend (PHP Target):")} ${chalk.magenta(
155
+ prismaPhpConfigJson.bsTarget || "http://localhost:80",
156
+ )}`,
157
+ );
158
+ console.log(chalk.gray(" ------------------------------------"));
159
+
160
+ if (externalUrl) {
161
+ console.log(
162
+ ` ${chalk.bold("External:")} ${chalk.magenta(externalUrl)}`,
163
+ );
164
+ }
165
+
166
+ if (uiUrl) {
167
+ console.log(` ${chalk.bold("UI:")} ${chalk.magenta(uiUrl)}`);
168
+ }
169
+
141
170
  const out = {
142
- local: urls.get("local"),
143
- external: urls.get("external"),
144
- ui: urls.get("ui"),
145
- uiExternal: urls.get("ui-external"),
171
+ local: localUrl,
172
+ external: externalUrl,
173
+ ui: uiUrl,
174
+ uiExternal: uiExtUrl,
146
175
  };
147
176
 
148
177
  writeFileSync(
149
178
  join(__dirname, "bs-config.json"),
150
- JSON.stringify(out, null, 2)
179
+ JSON.stringify(out, null, 2),
151
180
  );
152
- console.log("\n\x1b[90mPress Ctrl+C to stop.\x1b[0m\n");
153
- }
181
+ console.log(`\n${chalk.gray("Press Ctrl+C to stop.")}\n`);
182
+ },
154
183
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "4.3.6",
3
+ "version": "4.3.7",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",