create-prisma-php-app 4.0.0-alpha.14 → 4.0.0-alpha.16
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 +10 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -55,7 +55,7 @@ export async function installComposerDependencies(baseDir, dependencies) {
|
|
|
55
55
|
)
|
|
56
56
|
);
|
|
57
57
|
/* ------------------------------------------------------------------ */
|
|
58
|
-
/* 1.
|
|
58
|
+
/* 1. Try composer init (quietly fall back if it fails) */
|
|
59
59
|
/* ------------------------------------------------------------------ */
|
|
60
60
|
if (!existsAlready) {
|
|
61
61
|
const initArgs = [
|
|
@@ -71,19 +71,18 @@ export async function installComposerDependencies(baseDir, dependencies) {
|
|
|
71
71
|
"--version",
|
|
72
72
|
"1.0.0",
|
|
73
73
|
];
|
|
74
|
-
const res = spawnSync(cmd, initArgs, {
|
|
75
|
-
if (res.status !== 0)
|
|
76
|
-
|
|
77
|
-
if (!fs.existsSync(composerJsonPath)) {
|
|
74
|
+
const res = spawnSync(cmd, initArgs, { cwd: baseDir });
|
|
75
|
+
if (res.status !== 0) {
|
|
76
|
+
// Silent fallback: no logs, just write a minimal composer.json
|
|
78
77
|
fs.writeFileSync(
|
|
79
78
|
composerJsonPath,
|
|
80
79
|
JSON.stringify(
|
|
81
80
|
{
|
|
82
81
|
name: "tsnc/prisma-php-app",
|
|
83
|
-
require: { php: "^8.2" },
|
|
84
|
-
autoload: { "psr-4": { "": "src/" } },
|
|
85
82
|
type: "project",
|
|
86
83
|
version: "1.0.0",
|
|
84
|
+
require: { php: "^8.2" },
|
|
85
|
+
autoload: { "psr-4": { "": "src/" } },
|
|
87
86
|
},
|
|
88
87
|
null,
|
|
89
88
|
2
|
|
@@ -91,17 +90,13 @@ export async function installComposerDependencies(baseDir, dependencies) {
|
|
|
91
90
|
);
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
|
-
/*
|
|
95
|
-
/* 2. Garantizar autoload PSR-4 */
|
|
96
|
-
/* ------------------------------------------------------------------ */
|
|
93
|
+
/* 2. Ensure PSR-4 autoload entry ---------------------------------- */
|
|
97
94
|
const json = JSON.parse(fs.readFileSync(composerJsonPath, "utf8"));
|
|
98
95
|
json.autoload ??= {};
|
|
99
96
|
json.autoload["psr-4"] ??= {};
|
|
100
97
|
json.autoload["psr-4"][""] ??= "src/";
|
|
101
98
|
fs.writeFileSync(composerJsonPath, JSON.stringify(json, null, 2));
|
|
102
|
-
/*
|
|
103
|
-
/* 3. Instalar dependencias */
|
|
104
|
-
/* ------------------------------------------------------------------ */
|
|
99
|
+
/* 3. Install dependencies ----------------------------------------- */
|
|
105
100
|
if (dependencies.length) {
|
|
106
101
|
console.log("Installing Composer dependencies:");
|
|
107
102
|
dependencies.forEach((d) => console.log(`- ${chalk.blue(d)}`));
|
|
@@ -115,9 +110,7 @@ export async function installComposerDependencies(baseDir, dependencies) {
|
|
|
115
110
|
{ stdio: "inherit", cwd: baseDir }
|
|
116
111
|
);
|
|
117
112
|
}
|
|
118
|
-
/*
|
|
119
|
-
/* 4. Refrescar lock (solo modo update) */
|
|
120
|
-
/* ------------------------------------------------------------------ */
|
|
113
|
+
/* 4. Refresh lock when updating ----------------------------------- */
|
|
121
114
|
if (existsAlready) {
|
|
122
115
|
execSync(
|
|
123
116
|
`${cmd} ${[
|
|
@@ -130,9 +123,7 @@ export async function installComposerDependencies(baseDir, dependencies) {
|
|
|
130
123
|
{ stdio: "inherit", cwd: baseDir }
|
|
131
124
|
);
|
|
132
125
|
}
|
|
133
|
-
/*
|
|
134
|
-
/* 5. Regenerar autoloader */
|
|
135
|
-
/* ------------------------------------------------------------------ */
|
|
126
|
+
/* 5. Regenerate autoloader ---------------------------------------- */
|
|
136
127
|
execSync(`${cmd} ${[...baseArgs, "dump-autoload", "--quiet"].join(" ")}`, {
|
|
137
128
|
stdio: "inherit",
|
|
138
129
|
cwd: baseDir,
|