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.
- package/dist/index.js +42 -22
- 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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
null,
|
|
92
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
156
|
+
"@tailwindcss/postcss": "^4.1.12",
|
|
138
157
|
"@types/browser-sync": "^2.29.0",
|
|
139
|
-
"@types/node": "^24.
|
|
158
|
+
"@types/node": "^24.3.0",
|
|
140
159
|
"@types/prompts": "^2.4.9",
|
|
141
160
|
"browser-sync": "^3.0.4",
|
|
142
|
-
chalk: "^5.
|
|
143
|
-
|
|
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.
|
|
151
|
-
tsx: "^4.20.
|
|
170
|
+
tailwindcss: "^4.1.12",
|
|
171
|
+
tsx: "^4.20.5",
|
|
152
172
|
typescript: "^5.9.2",
|
|
153
173
|
};
|
|
154
174
|
function npmPkg(name) {
|