create-backlist 6.2.1 → 6.2.2
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/package.json +1 -1
- package/src/generators/java.js +4 -13
package/package.json
CHANGED
package/src/generators/java.js
CHANGED
|
@@ -183,23 +183,23 @@ async function generateJavaProject(options) {
|
|
|
183
183
|
await fs.ensureDir(controllerDir);
|
|
184
184
|
|
|
185
185
|
for (const model of modelsToGenerate.values()) {
|
|
186
|
-
// FIXED: Added '
|
|
186
|
+
// FIXED: Added 'modelName: model.name' to satisfy the EJS template
|
|
187
187
|
await renderAndWrite(
|
|
188
188
|
getTemplatePath("java-spring/partials/Entity.java.ejs"),
|
|
189
189
|
path.join(entityDir, `${model.name}.java`),
|
|
190
|
-
{ projectName, groupId, artifactId, group: groupId, model }
|
|
190
|
+
{ projectName, groupId, artifactId, group: groupId, model, modelName: model.name }
|
|
191
191
|
);
|
|
192
192
|
|
|
193
193
|
await renderAndWrite(
|
|
194
194
|
getTemplatePath("java-spring/partials/Repository.java.ejs"),
|
|
195
195
|
path.join(repoDir, `${model.name}Repository.java`),
|
|
196
|
-
{ projectName, groupId, artifactId, group: groupId, model }
|
|
196
|
+
{ projectName, groupId, artifactId, group: groupId, model, modelName: model.name }
|
|
197
197
|
);
|
|
198
198
|
|
|
199
199
|
await renderAndWrite(
|
|
200
200
|
getTemplatePath("java-spring/partials/Controller.java.ejs"),
|
|
201
201
|
path.join(controllerDir, `${model.name}Controller.java`),
|
|
202
|
-
{ projectName, groupId, artifactId, group: groupId, model }
|
|
202
|
+
{ projectName, groupId, artifactId, group: groupId, model, modelName: model.name }
|
|
203
203
|
);
|
|
204
204
|
}
|
|
205
205
|
} else {
|
|
@@ -215,15 +215,6 @@ async function generateJavaProject(options) {
|
|
|
215
215
|
} catch (error) {
|
|
216
216
|
if (error && error.response && error.response.status) {
|
|
217
217
|
console.error(chalk.red(` -> Initializr error status: ${error.response.status}`));
|
|
218
|
-
try {
|
|
219
|
-
if (error.response.data) {
|
|
220
|
-
let text = "";
|
|
221
|
-
for await (const chunk of error.response.data) text += chunk.toString();
|
|
222
|
-
console.error(chalk.yellow(" -> Initializr response body:"), text);
|
|
223
|
-
}
|
|
224
|
-
} catch {
|
|
225
|
-
// ignore
|
|
226
|
-
}
|
|
227
218
|
throw new Error(`Failed to download from Spring Initializr. Status: ${error.response.status}`);
|
|
228
219
|
}
|
|
229
220
|
throw error;
|