create-prisma-php-app 4.0.0-alpha.71 → 4.0.0-alpha.72

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.
Files changed (2) hide show
  1. package/dist/index.js +42 -22
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -78,28 +78,47 @@ export async function installComposerDependencies(baseDir, dependencies) {
78
78
  const res = spawnSync(cmd, initArgs, { cwd: baseDir });
79
79
  if (res.status !== 0) {
80
80
  // Silent fallback: no logs, just write a minimal composer.json
81
- fs.writeFileSync(
82
- composerJsonPath,
83
- JSON.stringify(
84
- {
85
- name: "tsnc/prisma-php-app",
86
- type: "project",
87
- version: "1.0.0",
88
- require: { php: "^8.2" },
89
- autoload: { "psr-4": { "": "src/" } },
90
- },
91
- null,
92
- 2
93
- )
94
- );
81
+ try {
82
+ const defaultComposerJson = {
83
+ name: "tsnc/prisma-php-app",
84
+ type: "project",
85
+ version: "1.0.0",
86
+ require: { php: "^8.2" },
87
+ autoload: { "psr-4": { "": "src/" } },
88
+ };
89
+ fs.writeFileSync(
90
+ composerJsonPath,
91
+ JSON.stringify(defaultComposerJson, null, 2)
92
+ );
93
+ console.log("Created fallback composer.json");
94
+ } catch (writeError) {
95
+ console.error("Failed to create fallback composer.json:", writeError);
96
+ throw writeError;
97
+ }
95
98
  }
96
99
  }
97
100
  /* 2. Ensure PSR-4 autoload entry ---------------------------------- */
98
- const json = JSON.parse(fs.readFileSync(composerJsonPath, "utf8"));
101
+ // Add safety check before reading
102
+ if (!fs.existsSync(composerJsonPath)) {
103
+ console.error(`composer.json not found at ${composerJsonPath}`);
104
+ throw new Error("Failed to create or find composer.json");
105
+ }
106
+ let json;
107
+ try {
108
+ json = JSON.parse(fs.readFileSync(composerJsonPath, "utf8"));
109
+ } catch (readError) {
110
+ console.error("Failed to read composer.json:", readError);
111
+ throw readError;
112
+ }
99
113
  json.autoload ??= {};
100
114
  json.autoload["psr-4"] ??= {};
101
115
  json.autoload["psr-4"][""] ??= "src/";
102
- fs.writeFileSync(composerJsonPath, JSON.stringify(json, null, 2));
116
+ try {
117
+ fs.writeFileSync(composerJsonPath, JSON.stringify(json, null, 2));
118
+ } catch (writeError) {
119
+ console.error("Failed to update composer.json:", writeError);
120
+ throw writeError;
121
+ }
103
122
  /* 3. Install dependencies ----------------------------------------- */
104
123
  if (dependencies.length) {
105
124
  console.log("Installing Composer dependencies:");
@@ -134,21 +153,22 @@ export async function installComposerDependencies(baseDir, dependencies) {
134
153
  });
135
154
  }
136
155
  const npmPinnedVersions = {
137
- "@tailwindcss/postcss": "^4.1.11",
156
+ "@tailwindcss/postcss": "^4.1.12",
138
157
  "@types/browser-sync": "^2.29.0",
139
- "@types/node": "^24.2.1",
158
+ "@types/node": "^24.3.0",
140
159
  "@types/prompts": "^2.4.9",
141
160
  "browser-sync": "^3.0.4",
142
- chalk: "^5.5.0",
143
- cssnano: "^7.1.0",
161
+ chalk: "^5.6.0",
162
+ "chokidar-cli": "^3.0.0",
163
+ cssnano: "^7.1.1",
144
164
  "http-proxy-middleware": "^3.0.5",
145
165
  "npm-run-all": "^4.1.5",
146
166
  "php-parser": "^3.2.5",
147
167
  postcss: "^8.5.6",
148
168
  "postcss-cli": "^11.0.1",
149
169
  prompts: "^2.4.2",
150
- tailwindcss: "^4.1.11",
151
- tsx: "^4.20.3",
170
+ tailwindcss: "^4.1.12",
171
+ tsx: "^4.20.5",
152
172
  typescript: "^5.9.2",
153
173
  };
154
174
  function npmPkg(name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "4.0.0-alpha.71",
3
+ "version": "4.0.0-alpha.72",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",